summaryrefslogtreecommitdiffstats
path: root/Targets.c4d/System.c4g/CannonTower.c
diff options
context:
space:
mode:
Diffstat (limited to 'Targets.c4d/System.c4g/CannonTower.c')
-rw-r--r--Targets.c4d/System.c4g/CannonTower.c41
1 files changed, 41 insertions, 0 deletions
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);
+ }
+ }
+}