From 8b0f73bc418e340132ba99305baa5ea1605a2d11 Mon Sep 17 00:00:00 2001 From: Markus Mittendrein Date: Fri, 4 Jan 2019 23:56:55 +0100 Subject: Execute pushes in a random order instead of in network execution order --- TemplePushing.c4s/System.c4g/Clonk.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'TemplePushing.c4s/System.c4g/Clonk.c') diff --git a/TemplePushing.c4s/System.c4g/Clonk.c b/TemplePushing.c4s/System.c4g/Clonk.c index adc3c41..9753271 100644 --- a/TemplePushing.c4s/System.c4g/Clonk.c +++ b/TemplePushing.c4s/System.c4g/Clonk.c @@ -39,11 +39,14 @@ protected func ControlThrow(object byObj) } */ -protected func ControlSpecial() +protected func CanPush() { - [$Push$|Image=CXIV] + return GetAction() == "Walk"; +} - if (GetAction() != "Walk") return 0; +func ExecutePush() +{ + if (!CanPush()) return 0; // Use action "Throw" starting with phase 3 SetAction("Throw"); @@ -52,10 +55,10 @@ protected func ControlSpecial() // Find clonks in range var clonks = FindObjects( Find_ID(CLNK), - Find_InRect(-20 + GetDir() * 29, 0, 12, 10), - Find_OCF(OCF_Alive), - Find_Hostile(GetOwner()), - Find_Not(Find_Action("Tumble"))); + Find_InRect(-20 + GetDir() * 29, 0, 12, 10), + Find_OCF(OCF_Alive), + Find_Hostile(GetOwner()), + Find_Not(Find_Action("Tumble"))); if (GetLength(clonks) == 0) return 0; @@ -71,7 +74,15 @@ protected func ControlSpecial() Fling(target, -1 + GetDir() * 2, -1); target->SetKiller(GetOwner()); } +} + +protected func ControlSpecial() +{ + [$Push$|Image=CXIV|Condition=CanPush] + + if (!CanPush()) return 0; + PushExecuter->RequestPush(this); return 1; } -- cgit v1.2.3-54-g00ecf