From fa5403dccd986022b2a849e2078f043c3225348a Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Mon, 2 Jan 2017 19:33:41 +0100 Subject: Initial --- Targets.c4d/System.c4g/CannonTower.c | 41 ++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Targets.c4d/System.c4g/CannonTower.c (limited to 'Targets.c4d/System.c4g/CannonTower.c') diff --git a/Targets.c4d/System.c4g/CannonTower.c b/Targets.c4d/System.c4g/CannonTower.c new file mode 100644 index 0000000..6d7d2ce --- /dev/null +++ b/Targets.c4d/System.c4g/CannonTower.c @@ -0,0 +1,41 @@ +#strict 2 +#appendto CTW0 + +func IsRemoteControllable() { return true; } + +func RemoteControlMap() +{ + var ret = _inherited(...); + ret[GetLength(ret)] = [RC7I_Control_T, "Shoot", "$CTW0_DirectShoot$"]; + return ret; +} + +func GetNextAmmo() +{ + if(cannon) + { + for(var i = 0, content; content = Contents(i); ++i) + { + if(GetID(content) != GUNP && cannon->~CannonAmmo(content)) + { + return content; + } + } + } +} + +func Shoot(object caller) +{ + if(cannon) + { + if(cannon->~IsDirectShoot()) + { + return ContainedDig(caller); + } + else + { + var ammo = GetNextAmmo(); + return ammo && cannon->~Shoot(GetID(ammo), ammo, caller); + } + } +} -- cgit v1.2.3-54-g00ecf