diff options
Diffstat (limited to 'TemplePushing.c4s/System.c4g/Arrowpack.c')
| -rw-r--r-- | TemplePushing.c4s/System.c4g/Arrowpack.c | 43 |
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 |
