summaryrefslogtreecommitdiffstats
path: root/Targets.c4d/System.c4g
diff options
context:
space:
mode:
Diffstat (limited to 'Targets.c4d/System.c4g')
-rw-r--r--Targets.c4d/System.c4g/Bridge.c14
-rw-r--r--Targets.c4d/System.c4g/CannonTower.c41
-rw-r--r--Targets.c4d/System.c4g/DirectShootCannons.c6
-rw-r--r--Targets.c4d/System.c4g/LiquidCannon.c4
-rw-r--r--Targets.c4d/System.c4g/StringTblDE.txt15
-rw-r--r--Targets.c4d/System.c4g/StringTblUS.txt15
-rw-r--r--Targets.c4d/System.c4g/Towers.c48
7 files changed, 143 insertions, 0 deletions
diff --git a/Targets.c4d/System.c4g/Bridge.c b/Targets.c4d/System.c4g/Bridge.c
new file mode 100644
index 0000000..7aacda6
--- /dev/null
+++ b/Targets.c4d/System.c4g/Bridge.c
@@ -0,0 +1,14 @@
+#strict 2
+#appendto BRDG
+
+func RemoteControlMap()
+{
+ return [
+ [RC7I_Control_T, "LockSafe", "$BRDG_Lock$"],
+ [RC7I_Control_U, "ReleaseSafe", "$BRDG_Release$"],
+ [RC7I_Control_Q, "ControlDigDouble", "$BRDG_Toggle$"]
+ ];
+}
+
+func LockSafe() { return !IsLocked() && Lock(); }
+func ReleaseSafe() { return IsLocked() && Release(); }
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);
+ }
+ }
+}
diff --git a/Targets.c4d/System.c4g/DirectShootCannons.c b/Targets.c4d/System.c4g/DirectShootCannons.c
new file mode 100644
index 0000000..c956dee
--- /dev/null
+++ b/Targets.c4d/System.c4g/DirectShootCannons.c
@@ -0,0 +1,6 @@
+#strict 2
+#appendto CTW6
+#appendto ACT2
+#appendto ACT4
+
+func IsDirectShoot() { return true; }
diff --git a/Targets.c4d/System.c4g/LiquidCannon.c b/Targets.c4d/System.c4g/LiquidCannon.c
new file mode 100644
index 0000000..fa0998d
--- /dev/null
+++ b/Targets.c4d/System.c4g/LiquidCannon.c
@@ -0,0 +1,4 @@
+#strict 2
+#appendto LICA
+
+func CannonAmmo(object obj) { return IsFilledBarrel(obj); }
diff --git a/Targets.c4d/System.c4g/StringTblDE.txt b/Targets.c4d/System.c4g/StringTblDE.txt
new file mode 100644
index 0000000..9caa9c2
--- /dev/null
+++ b/Targets.c4d/System.c4g/StringTblDE.txt
@@ -0,0 +1,15 @@
+BRDG_Lock=Verankern
+BRDG_Release=Loslösen
+BRDG_Toggle=Verankern/Loslösen
+
+CTW0_DirectShoot=Schießen
+
+TWR2_LeftGate=Linkes Tor
+TWR2_RightGate=Rechts Tor
+TWR2_GateOpen=%s öffnen
+TWR2_GateClose=%s schließen
+TWR2_GateOpenClose=%s öffnen/schließen
+
+TWR2_DrawBridgeUp=Zugbrücke hoch
+TWR2_DrawBridgeDown=Zugbrücke runter
+TWR2_DrawBridgeUpDown=Zubrücke hoch/runter
diff --git a/Targets.c4d/System.c4g/StringTblUS.txt b/Targets.c4d/System.c4g/StringTblUS.txt
new file mode 100644
index 0000000..a3849c2
--- /dev/null
+++ b/Targets.c4d/System.c4g/StringTblUS.txt
@@ -0,0 +1,15 @@
+BRDG_Lock=Lock
+BRDG_Release=Release
+BRDG_Toggle=Lock/Release
+
+CTW0_DirectShoot=Shoot
+
+TWR2_LeftGate=Left Gate
+TWR2_RightGate=Right Gate
+TWR2_GateOpen=Open %s
+TWR2_GateClose=Close %s
+TWR2_GateOpenClose=Open/Close %s
+
+TWR2_DrawBridgeUp=Draw bridge up
+TWR2_DrawBridgeDown=Draw bridge down
+TWR2_DrawBridgeUpDown=Draw bridge up/down
diff --git a/Targets.c4d/System.c4g/Towers.c b/Targets.c4d/System.c4g/Towers.c
new file mode 100644
index 0000000..1b66297
--- /dev/null
+++ b/Targets.c4d/System.c4g/Towers.c
@@ -0,0 +1,48 @@
+#strict 2
+#appendto TWR2
+
+func IsRemoteControllable() { return false; }
+
+func FindGate(bool right) { return FindObject(0, 0, 0, 0, 0, 0, (right && "GateRight") || "GateLeft", this); }
+
+func SensorCallbacks()
+{
+ var ret = [];
+ for(var part in [[false, "$TWR2_LeftGate$", ["LeftGateOpen", "LeftGateClose", "ControlLeft"]], [true, "$TWR2_RightGate$", ["RightGateOpen", "RightGateClose", "ControlRight"]]])
+ {
+ if(FindGate(part[0]))
+ {
+ ret[GetLength(ret)] = [Format("$TWR2_GateOpen$", part[1]), part[2][0]];
+ ret[GetLength(ret)] = [Format("$TWR2_GateClose$", part[1]), part[2][1]];
+ ret[GetLength(ret)] = [Format("$TWR2_GateOpenClose$", part[1]), part[2][2]];
+ }
+ }
+ return ret;
+}
+
+func LeftGateOpen() { return GateOpen(false); }
+func LeftGateClose() { return GateClose(false); }
+
+func RightGateOpen() { return GateOpen(true); }
+func RightGateClose() { return GateClose(true); }
+
+func GateOpen(bool right) { return GateOpenClose(right, false); }
+func GateClose(bool right) { return GateOpenClose(right, true); }
+
+func GateOpenClose(bool right, bool close)
+{
+ var gate = FindGate(right);
+ if(gate)
+ {
+ gate->Activate();
+
+ if(close)
+ {
+ gate->Close();
+ }
+ else
+ {
+ gate->Open();
+ }
+ }
+}