Reduce more script usage

This commit is contained in:
ineedbots 2021-06-04 14:07:11 -06:00
parent 168a2e621c
commit 4dcea05c2a
3 changed files with 28 additions and 5 deletions

View File

@ -1750,7 +1750,7 @@ killWalkOnEvents()
self endon("disconnect");
self endon("death");
ret = self waittill_any_return("flash_rumble_loop", "new_enemy", "new_goal_internal", "goal_internal", "bad_path_internal");
self waittill_any("flash_rumble_loop", "new_enemy", "new_goal_internal", "goal_internal", "bad_path_internal");
waittillframeend;
@ -1764,12 +1764,11 @@ doWalkScriptNotify()
{
self endon("disconnect");
self endon("death");
self endon("kill_goal");
ret = self waittill_any_return("kill_goal", "goal_internal", "bad_path_internal");
if (ret == "goal_internal")
if (self waittill_either_return("goal_internal", "bad_path_internal") == "goal_internal")
self notify("goal");
else if (ret == "bad_path_internal")
else
self notify("bad_path");
}

View File

@ -37,6 +37,9 @@ connected()
self thread onSpawned();
// cod4x has a force respawn in the exe
wait 0.1;
self.challengeData = [];
}
/*

View File

@ -459,6 +459,27 @@ GetEyePos()
return self getTagOrigin("tag_eye");
}
/*
helper
*/
waittill_either_return_(str1, str2)
{
self endon(str1);
self waittill(str2);
return true;
}
/*
Returns which string gets notified first
*/
waittill_either_return(str1, str2)
{
if (!isDefined(self waittill_either_return_(str1, str2)))
return str1;
return str2;
}
/*
Waits until either of the nots.
*/