summaryrefslogtreecommitdiffstats
path: root/TemplePushing.c4s
diff options
context:
space:
mode:
authorMittendrein Markus <maxmitti@gmx.net>2015-07-29 20:16:14 +0200
committerMittendrein Markus <maxmitti@gmx.net>2015-07-29 20:16:14 +0200
commit85def752866d7de925f7fdedba6fac4229aa3cfc (patch)
tree1ecf2b43165ba12b483b8bffa851f75431c4432a /TemplePushing.c4s
parent070efdaa1839f28d1ca93c33945930539d0d2158 (diff)
downloadtempelschubsen-85def752866d7de925f7fdedba6fac4229aa3cfc.tar.gz
tempelschubsen-85def752866d7de925f7fdedba6fac4229aa3cfc.zip
Added CheckStuck2-Effect to Clonk.c to try to avoid stucking in a corner while walking.
Diffstat (limited to 'TemplePushing.c4s')
-rw-r--r--TemplePushing.c4s/System.c4g/Clonk.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/TemplePushing.c4s/System.c4g/Clonk.c b/TemplePushing.c4s/System.c4g/Clonk.c
index 3ac40a0..a951e0b 100644
--- a/TemplePushing.c4s/System.c4g/Clonk.c
+++ b/TemplePushing.c4s/System.c4g/Clonk.c
@@ -7,6 +7,12 @@
local rotateInJump;
local removeOnDeath;
+protected func Initialize()
+{
+ AddEffect("CheckStuck2", this, 20, 1, this);
+ return _inherited(...);
+}
+
/*
protected func ControlThrow(object byObj)
{
@@ -50,7 +56,6 @@ protected func ControlSpecial()
return 1;
}
-
protected func ControlLeft()
{
if (rotateInJump && GetAction() == "Jump" || GetAction() == "Tumble") SetDir(DIR_Left);
@@ -73,4 +78,18 @@ protected func Death(int killedBy)
public func QueryCatchBlow(object arrow)
{
return arrow->GetOwner() == GetOwner();
-} \ No newline at end of file
+}
+
+private func FxCheckStuck2Timer(object pTarget, int iEffectNumber, int iEffectTime)
+{
+ 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);
+ 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);
+ }
+}