fast continue jav

This commit is contained in:
Your Name 2020-09-18 13:13:08 -06:00
parent 4905d51c9d
commit 0b13d26eb4

View File

@ -1094,6 +1094,22 @@ nearAnyOfWaypoints(dist, waypoints)
return false;
}
getNearestWaypointOfWaypoints(waypoints)
{
answer = undefined;
for (i = 0; i < waypoints.size; i++)
{
waypoint = waypoints[i];
if (isDefined(answer) && closer(self.origin, answer.origin, waypoint.origin))
continue;
answer = waypoint;
}
return answer;
}
bot_escort_obj(obj, carrier)
{
self endon( "death" );
@ -1900,7 +1916,12 @@ bot_jav_loc_think()
self endon("death");
level endon("game_ended");
doFastContinue = false;
for (;;)
{
if (doFastContinue)
doFastContinue = false;
else
{
wait randomintRange(2, 4);
@ -1910,6 +1931,7 @@ bot_jav_loc_think()
if (randomInt(100) > chance)
continue;
}
if (!self GetAmmoCount("javelin_mp"))
continue;
@ -1942,6 +1964,10 @@ bot_jav_loc_think()
if (self isEMPed())
continue;
loc = undefined;
if (!self nearAnyOfWaypoints(128, level.waypointsJav))
{
javWps = [];
for (i = 0; i < level.waypointsJav.size; i++)
{
@ -1952,7 +1978,6 @@ bot_jav_loc_think()
}
javWp = random(javWps);
loc = undefined;
if (!isDefined(javWp) || self HasScriptGoal() || self.bot_lock_goal)
{
traceForward = self maps\mp\_javelin::EyeTraceForward();
@ -1971,8 +1996,6 @@ bot_jav_loc_think()
}
else
{
loc = javWp.jav_point;
self SetScriptGoal(javWp.origin, 16);
ret = self waittill_any_return("new_goal", "goal", "bad_path");
@ -1982,6 +2005,15 @@ bot_jav_loc_think()
if (ret != "goal")
continue;
doFastContinue = true;
continue;
}
}
else
{
javWp = self getNearestWaypointOfWaypoints(level.waypointsJav);
loc = javWp.jav_point;
}
self SetBotJavelinLocation(loc);