summaryrefslogtreecommitdiffstats
path: root/TemplePushing.c4s/System.c4g/Clonk.c
diff options
context:
space:
mode:
authorJan <>2015-02-02 17:05:03 +0100
committerJan <_>2015-07-10 17:44:33 +0200
commitf5a80c493dcefbc8f45987b8fd454d974f739cf7 (patch)
tree724195326f990379940b35e0f5eaacb37e4860bc /TemplePushing.c4s/System.c4g/Clonk.c
downloadtempelschubsen-f5a80c493dcefbc8f45987b8fd454d974f739cf7.tar.gz
tempelschubsen-f5a80c493dcefbc8f45987b8fd454d974f739cf7.zip
TemplePushBeta.c4s
Diffstat (limited to 'TemplePushing.c4s/System.c4g/Clonk.c')
-rw-r--r--TemplePushing.c4s/System.c4g/Clonk.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/TemplePushing.c4s/System.c4g/Clonk.c b/TemplePushing.c4s/System.c4g/Clonk.c
new file mode 100644
index 0000000..2308576
--- /dev/null
+++ b/TemplePushing.c4s/System.c4g/Clonk.c
@@ -0,0 +1,27 @@
+#strict 2
+#appendto CLNK
+
+protected func ControlSpecial()
+{
+ [$Push$|Image=CXIV]
+
+ if (GetAction() != "Walk") return 0;
+
+ // Use action "Throw" starting with phase 3
+ SetAction("Throw");
+ SetPhase(3);
+
+ // Find clonks in range
+ var clonks = FindObjects(
+ Find_ID(CLNK),
+ Find_InRect(-10 + GetDir() * 20, 0, 10, 10),
+ Find_OCF(OCF_Alive),
+ // Only include allied players' clonks if "friendly pushing" rule is present
+ Find_Or(Find_Func(FindObject(FYPG)), Find_Hostile(GetOwner())));
+
+ if (GetLength(clonks) == 0) return 0;
+
+ // Randomly select clonk to be pushed
+ Fling(clonks[Random(GetLength(clonks))], -1 + GetDir() * 2, -1);
+ return 1;
+}