summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarkus Mittendrein <git@maxmitti.tk>2019-01-02 18:00:46 +0100
committerMarkus Mittendrein <git@maxmitti.tk>2019-01-23 23:50:09 +0100
commit5badcdda466313f7ca34af1e6d0779dc17c6eee9 (patch)
tree6d4467d1a3aa5ea937837d69f5e3273c3b0202ae
parent761a93b98b47c9d06e1b540ef025a02d79281135 (diff)
downloadtempelschubsen-5badcdda466313f7ca34af1e6d0779dc17c6eee9.tar.gz
tempelschubsen-5badcdda466313f7ca34af1e6d0779dc17c6eee9.zip
Fix falling down in some circumstances when directly on a corner (laying on the corner while sleeping and tumbling onto the corner with high speed)
-rw-r--r--TemplePushing.c4s/System.c4g/Clonk.c34
1 files changed, 25 insertions, 9 deletions
diff --git a/TemplePushing.c4s/System.c4g/Clonk.c b/TemplePushing.c4s/System.c4g/Clonk.c
index 459a3f0..adc3c41 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("CheckGlitches", this, 20, 1, this);
+ AddEffect("CheckGlitches", this, 1000, 1, this);
AddEffect("CheckBurn", this, 101, 0, this);
SetPhysical("Fight", 75000, PHYS_Temporary, this);
SetPhysical("Scale", 60000, PHYS_Temporary, this);
@@ -105,7 +105,7 @@ private func FxCheckGlitchesTimer(object pTarget, int iEffectNumber, int iEffect
{
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))
+ 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");
@@ -116,14 +116,30 @@ private func FxCheckGlitchesTimer(object pTarget, int iEffectNumber, int iEffect
EffectVar(1, pTarget, iEffectNumber) = pTarget->GetYDir(0, 65535);
EffectVar(2, pTarget, iEffectNumber) = pTarget->GetPhase();
- if (GetAction(pTarget) != "Walk") return;
-
- if (!pTarget->GBackSolid(0, 4) && !pTarget->GBackSolid(d, 3) && pTarget->GBackSolid(d, 4))
+ var action = GetAction(pTarget);
+ if (action == "Walk")
+ {
+ if (!pTarget->GBackSolid(0, 4) && !pTarget->GBackSolid(d, 3) && pTarget->GBackSolid(d, 4))
+ {
+ SetPosition(GetX(pTarget), GetY(pTarget) - 1, pTarget);
+ ObjectSetAction(pTarget, "KneelDown");
+ pTarget->Schedule("SetXDir(0)", 1);
+ if ((d == -1 && comDir != COMD_Left) || (d == 1 && comDir != COMD_Right)) SetComDir(COMD_Up, pTarget);
+ }
+ }
+ else if (action == "FlatUp")
{
- SetPosition(GetX(pTarget), GetY(pTarget) - 1, pTarget);
- ObjectSetAction(pTarget, "KneelDown");
- pTarget->Schedule("SetXDir(0)", 1);
- if ((d == -1 && GetComDir(pTarget) != COMD_Left) || (d == 1 && GetComDir(pTarget) != COMD_Right)) SetComDir(COMD_Up, pTarget);
+ if ((d == -1) != (GetContact(pTarget, 5, -1) == CNAT_Bottom))
+ {
+ d *= -1;
+ }
+ if (!pTarget->GBackSolid(0, 4) && (!pTarget->GBackSolid(d * 2, 3) && pTarget->GBackSolid(d * 2, 4)))
+ {
+ if (comDir != COMD_Down && comDir != COMD_Up && ((d == -1 && comDir != COMD_Left) || (d == 1 && comDir != COMD_Right)))
+ {
+ SetPosition(GetX(pTarget), GetY(pTarget) + 1, pTarget);
+ }
+ }
}
}