From 761a93b98b47c9d06e1b540ef025a02d79281135 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Wed, 2 Jan 2019 01:13:01 +0100 Subject: Fix falling down when stopping while climbing directly at the corner --- TemplePushing.c4s/System.c4g/Clonk.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'TemplePushing.c4s') diff --git a/TemplePushing.c4s/System.c4g/Clonk.c b/TemplePushing.c4s/System.c4g/Clonk.c index 370d702..459a3f0 100644 --- a/TemplePushing.c4s/System.c4g/Clonk.c +++ b/TemplePushing.c4s/System.c4g/Clonk.c @@ -12,7 +12,7 @@ protected func Initialize() { teamHud = CreateObject(THUD); teamHud->Attach(this); - AddEffect("CheckStuck2", this, 20, 1, this); + AddEffect("CheckGlitches", this, 20, 1, this); AddEffect("CheckBurn", this, 101, 0, this); SetPhysical("Fight", 75000, PHYS_Temporary, this); SetPhysical("Scale", 60000, PHYS_Temporary, this); @@ -56,7 +56,7 @@ protected func ControlSpecial() Find_OCF(OCF_Alive), Find_Hostile(GetOwner()), Find_Not(Find_Action("Tumble"))); - + if (GetLength(clonks) == 0) return 0; // Randomly select clonk to be pushed @@ -101,11 +101,23 @@ public func QueryCatchBlow(object arrow) return _inherited(arrow, ...); } -private func FxCheckStuck2Timer(object pTarget, int iEffectNumber, int iEffectTime) +private func FxCheckGlitchesTimer(object pTarget, int iEffectNumber, int iEffectTime) { + var d = GetDir(pTarget)*2 - 1; + var comDir = pTarget->GetComDir(); + if(GetProcedure(pTarget) == "FLIGHT" && EffectVar(0, pTarget, iEffectNumber) == "SCALE" && EffectVar(1, pTarget, iEffectNumber) < 0 && (comDir == COMD_Stop || comDir == COMD_Down) && pTarget->GBackSolid(d * 5, 4) && !pTarget->GBackSolid(d * 5, 3)) + { + SetPosition(GetX(pTarget), GetY(pTarget) + 1, pTarget); + pTarget->SetAction("Scale"); + pTarget->SetPhase(EffectVar(2, pTarget, iEffectNumber)); + } + + EffectVar(0, pTarget, iEffectNumber) = GetProcedure(pTarget); + EffectVar(1, pTarget, iEffectNumber) = pTarget->GetYDir(0, 65535); + EffectVar(2, pTarget, iEffectNumber) = pTarget->GetPhase(); + if (GetAction(pTarget) != "Walk") return; - var d = GetDir(pTarget)*2 - 1; if (!pTarget->GBackSolid(0, 4) && !pTarget->GBackSolid(d, 3) && pTarget->GBackSolid(d, 4)) { SetPosition(GetX(pTarget), GetY(pTarget) - 1, pTarget); -- cgit v1.2.3-54-g00ecf