From b4434b1981860e9412fb25239d612960008bb81c Mon Sep 17 00:00:00 2001 From: Mittendrein Markus Date: Wed, 10 Feb 2016 14:22:21 +0100 Subject: Rework QueryCatchBlow --- TemplePushing.c4s/System.c4g/Arrow.c | 17 +++++++++++++++++ TemplePushing.c4s/System.c4g/Arrowpack.c | 4 ++-- TemplePushing.c4s/System.c4g/BigRock.c | 8 ++++++++ TemplePushing.c4s/System.c4g/Clonk.c | 3 ++- TemplePushing.c4s/System.c4g/ShootInventory.c | 12 +++++++++++- 5 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 TemplePushing.c4s/System.c4g/Arrow.c create mode 100644 TemplePushing.c4s/System.c4g/BigRock.c diff --git a/TemplePushing.c4s/System.c4g/Arrow.c b/TemplePushing.c4s/System.c4g/Arrow.c new file mode 100644 index 0000000..f4e2202 --- /dev/null +++ b/TemplePushing.c4s/System.c4g/Arrow.c @@ -0,0 +1,17 @@ +/*-- Don't hit shooter directly after shooting --*/ +#strict 2 +#appendto ARRW +#appendto FARW + +local shooter; + +func Launch(object shooterClonk) +{ + if (shooterClonk) shooter = shooterClonk; + return _inherited(shooterClonk, ...); +} + +func QueryOwnCatchBlow(object target) +{ + return target == shooter; +} diff --git a/TemplePushing.c4s/System.c4g/Arrowpack.c b/TemplePushing.c4s/System.c4g/Arrowpack.c index da2c5ec..0bdf5a1 100644 --- a/TemplePushing.c4s/System.c4g/Arrowpack.c +++ b/TemplePushing.c4s/System.c4g/Arrowpack.c @@ -33,7 +33,7 @@ protected func Activate(object clonk) // 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(); + arrow->~Launch(clonk); // Start cooldown coolingDown = true; @@ -43,4 +43,4 @@ protected func Activate(object clonk) Sound("Arrow"); return 1; -} \ No newline at end of file +} diff --git a/TemplePushing.c4s/System.c4g/BigRock.c b/TemplePushing.c4s/System.c4g/BigRock.c new file mode 100644 index 0000000..30d3555 --- /dev/null +++ b/TemplePushing.c4s/System.c4g/BigRock.c @@ -0,0 +1,8 @@ +/*-- Big rocks from rock strike don't hit friends --*/ +#appendto BIRK +#strict 2 + +func QueryOwnCatchBlow(object target) +{ + return !Hostile(GetOwner(), target->GetOwner()); +} diff --git a/TemplePushing.c4s/System.c4g/Clonk.c b/TemplePushing.c4s/System.c4g/Clonk.c index 546f74c..09c4b20 100644 --- a/TemplePushing.c4s/System.c4g/Clonk.c +++ b/TemplePushing.c4s/System.c4g/Clonk.c @@ -84,7 +84,8 @@ protected func Death(int killedBy) public func QueryCatchBlow(object arrow) { - return arrow->GetOwner() == GetOwner(); + if (arrow->~QueryOwnCatchBlow(this)) return 1; + return _inherited(arrow, ...); } private func FxCheckStuck2Timer(object pTarget, int iEffectNumber, int iEffectTime) diff --git a/TemplePushing.c4s/System.c4g/ShootInventory.c b/TemplePushing.c4s/System.c4g/ShootInventory.c index b0260b5..dd4ce1f 100644 --- a/TemplePushing.c4s/System.c4g/ShootInventory.c +++ b/TemplePushing.c4s/System.c4g/ShootInventory.c @@ -13,6 +13,8 @@ #appendto TSWB #appendto METO +local shotFrame, shooter; + protected func Activate(object clonk) { [$Shoot$|Image=GNPW] @@ -86,6 +88,14 @@ protected func Activate(object clonk) SetYDir(-15); SetXDir(-80 + 160 * clonk->GetDir()); } + + shotFrame = FrameCounter(); + shooter = clonk; return 1; -} \ No newline at end of file +} + +func QueryOwnCatchBlow(object target) +{ + return target == shooter && FrameCounter() - shotFrame < 3; +} -- cgit v1.2.3-54-g00ecf