summaryrefslogtreecommitdiffstats
path: root/TemplePushing.c4s/System.c4g/Arrowpack.c
diff options
context:
space:
mode:
authorJan <>2015-02-02 17:58:18 +0100
committerJan <_>2015-07-10 17:51:43 +0200
commitca61c54b9bd69af897e4cc9d4385137fb56fd11a (patch)
treea4363f466cea6de48ca81fadc08273d58698d2ff /TemplePushing.c4s/System.c4g/Arrowpack.c
parent32a9632fbca3dd7a88bd3154b84a3773af39c276 (diff)
downloadtempelschubsen-ca61c54b9bd69af897e4cc9d4385137fb56fd11a.tar.gz
tempelschubsen-ca61c54b9bd69af897e4cc9d4385137fb56fd11a.zip
TemplePushingBeta.c4s
Diffstat (limited to 'TemplePushing.c4s/System.c4g/Arrowpack.c')
-rw-r--r--TemplePushing.c4s/System.c4g/Arrowpack.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/TemplePushing.c4s/System.c4g/Arrowpack.c b/TemplePushing.c4s/System.c4g/Arrowpack.c
new file mode 100644
index 0000000..e046e4c
--- /dev/null
+++ b/TemplePushing.c4s/System.c4g/Arrowpack.c
@@ -0,0 +1,43 @@
+/*-- Arrow packs shoot arrows --*/
+
+#strict 2
+
+#appendto ARWP
+
+local coolingDown;
+
+protected func Initialize()
+{
+ iUsedItems = Random(MaxPackCount() - 1);
+}
+
+private func CooledDown()
+{
+ return !coolingDown;
+}
+
+protected func Activate(object clonk)
+{
+ [$Shoot$|Image=BOW1|Condition=CooledDown]
+
+ if (!CooledDown()) return 0;
+
+ // Extract an arrow from the pack
+ var arrow = GetItem();
+
+ // Make shooting clonk responsible for possible kill and owner of the arrow
+ arrow->SetOwner(clonk->GetOwner());
+ arrow->SetController(clonk->GetOwner());
+
+ // Shoot
+ // Do not launch fire arrows too close to the clonk to prevent incineration when launched while climbing
+ var arrowPosX = IIf(arrow->GetID() == FARW, -10 + 20 * clonk->GetDir(), -3 + 6 * clonk->GetDir());
+ arrow->Exit(0, arrowPosX, 5, -90 + 180 * clonk->GetDir(), -8 + 16 * clonk->GetDir(), -2);
+ arrow->~Launch();
+
+ // Start cooldown
+ coolingDown = true;
+ Schedule("coolingDown = false", RandomX(1, 20));
+
+ return 1;
+} \ No newline at end of file