From ca61c54b9bd69af897e4cc9d4385137fb56fd11a Mon Sep 17 00:00:00 2001 From: Jan <> Date: Mon, 2 Feb 2015 17:58:18 +0100 Subject: TemplePushingBeta.c4s --- TemplePushing.c4s/System.c4g/Arrowpack.c | 43 ++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 TemplePushing.c4s/System.c4g/Arrowpack.c (limited to 'TemplePushing.c4s/System.c4g/Arrowpack.c') 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 -- cgit v1.2.3-54-g00ecf