fix go and do action

This commit is contained in:
Your Name 2020-09-18 16:39:08 -06:00
parent 6458b3929b
commit fc73fde866

View File

@ -1593,7 +1593,13 @@ bot_use_tube_think()
self endon("death"); self endon("death");
level endon("game_ended"); level endon("game_ended");
doFastContinue = false;
for (;;) for (;;)
{
if (doFastContinue)
doFastContinue = false;
else
{ {
wait randomintRange(3, 7); wait randomintRange(3, 7);
@ -1603,6 +1609,7 @@ bot_use_tube_think()
if (randomInt(100) > chance) if (randomInt(100) > chance)
continue; continue;
}
tube = self getValidTube(); tube = self getValidTube();
if (!isDefined(tube)) if (!isDefined(tube))
@ -1633,6 +1640,10 @@ bot_use_tube_think()
if (self InLastStand() && !self InFinalStand()) if (self InLastStand() && !self InFinalStand())
continue; continue;
loc = undefined;
if (!self nearAnyOfWaypoints(128, level.waypointsTube))
{
tubeWps = []; tubeWps = [];
for (i = 0; i < level.waypointsTube.size; i++) for (i = 0; i < level.waypointsTube.size; i++)
{ {
@ -1643,7 +1654,6 @@ bot_use_tube_think()
} }
tubeWp = random(tubeWps); tubeWp = random(tubeWps);
loc = undefined;
myEye = self GetEye(); myEye = self GetEye();
if (!isDefined(tubeWp) || self HasScriptGoal() || self.bot_lock_goal) if (!isDefined(tubeWp) || self HasScriptGoal() || self.bot_lock_goal)
{ {
@ -1664,8 +1674,6 @@ bot_use_tube_think()
} }
else else
{ {
loc = tubeWp.origin + AnglesToForward(tubeWp.angles) * 2048;
self SetScriptGoal(tubeWp.origin, 16); self SetScriptGoal(tubeWp.origin, 16);
ret = self waittill_any_return("new_goal", "goal", "bad_path"); ret = self waittill_any_return("new_goal", "goal", "bad_path");
@ -1675,7 +1683,19 @@ bot_use_tube_think()
if (ret != "goal") if (ret != "goal")
continue; continue;
doFastContinue = true;
continue;
} }
}
else
{
tubeWp = self getNearestWaypointOfWaypoints(level.waypointsTube);
loc = tubeWp.origin + AnglesToForward(tubeWp.angles) * 2048;
}
if (!isDefined(loc))
continue;
self SetScriptAimPos(loc); self SetScriptAimPos(loc);
self BotStopMoving(true); self BotStopMoving(true);
@ -1701,6 +1721,7 @@ fire_current_weapon()
{ {
self endon("death"); self endon("death");
self endon("disconnect"); self endon("disconnect");
self endon("weapon_change");
self endon("stop_firing_weapon"); self endon("stop_firing_weapon");
for (;;) for (;;)
@ -1716,7 +1737,13 @@ bot_use_equipment_think()
self endon("death"); self endon("death");
level endon("game_ended"); level endon("game_ended");
doFastContinue = false;
for (;;) for (;;)
{
if (doFastContinue)
doFastContinue = false;
else
{ {
wait randomintRange(2, 4); wait randomintRange(2, 4);
@ -1726,6 +1753,7 @@ bot_use_equipment_think()
if (randomInt(100) > chance) if (randomInt(100) > chance)
continue; continue;
}
nade = undefined; nade = undefined;
if (self GetAmmoCount("claymore_mp")) if (self GetAmmoCount("claymore_mp"))
@ -1761,6 +1789,10 @@ bot_use_equipment_think()
if (self inLastStand() && !self _hasPerk("specialty_laststandoffhand") && !self inFinalStand()) if (self inLastStand() && !self _hasPerk("specialty_laststandoffhand") && !self inFinalStand())
continue; continue;
loc = undefined;
if (!self nearAnyOfWaypoints(128, level.waypointsClay))
{
clayWps = []; clayWps = [];
for (i = 0; i < level.waypointsClay.size; i++) for (i = 0; i < level.waypointsClay.size; i++)
{ {
@ -1771,7 +1803,6 @@ bot_use_equipment_think()
} }
clayWp = random(clayWps); clayWp = random(clayWps);
loc = undefined;
if (!isDefined(clayWp) || self HasScriptGoal() || self.bot_lock_goal) if (!isDefined(clayWp) || self HasScriptGoal() || self.bot_lock_goal)
{ {
myEye = self GetEye(); myEye = self GetEye();
@ -1782,8 +1813,6 @@ bot_use_equipment_think()
} }
else else
{ {
loc = clayWp.origin + AnglesToForward(clayWp.angles) * 2048;
self SetScriptGoal(clayWp.origin, 16); self SetScriptGoal(clayWp.origin, 16);
ret = self waittill_any_return("new_goal", "goal", "bad_path"); ret = self waittill_any_return("new_goal", "goal", "bad_path");
@ -1793,7 +1822,19 @@ bot_use_equipment_think()
if (ret != "goal") if (ret != "goal")
continue; continue;
doFastContinue = true;
continue;
} }
}
else
{
clayWp = self getNearestWaypointOfWaypoints(level.waypointsClay);
loc = clayWp.origin + AnglesToForward(clayWp.angles) * 2048;
}
if (!isDefined(loc))
continue;
self SetScriptAimPos(loc); self SetScriptAimPos(loc);
self BotStopMoving(true); self BotStopMoving(true);
@ -1812,7 +1853,13 @@ bot_use_grenade_think()
self endon("death"); self endon("death");
level endon("game_ended"); level endon("game_ended");
doFastContinue = false;
for (;;) for (;;)
{
if (doFastContinue)
doFastContinue = false;
else
{ {
wait randomintRange(4, 7); wait randomintRange(4, 7);
@ -1822,6 +1869,7 @@ bot_use_grenade_think()
if (randomInt(100) > chance) if (randomInt(100) > chance)
continue; continue;
}
nade = self getValidGrenade(); nade = self getValidGrenade();
if (!isDefined(nade)) if (!isDefined(nade))
@ -1852,6 +1900,10 @@ bot_use_grenade_think()
if (self inLastStand() && !self _hasPerk("specialty_laststandoffhand") && !self inFinalStand()) if (self inLastStand() && !self _hasPerk("specialty_laststandoffhand") && !self inFinalStand())
continue; continue;
loc = undefined;
if (!self nearAnyOfWaypoints(128, level.waypointsGren))
{
nadeWps = []; nadeWps = [];
for (i = 0; i < level.waypointsGren.size; i++) for (i = 0; i < level.waypointsGren.size; i++)
{ {
@ -1862,7 +1914,6 @@ bot_use_grenade_think()
} }
nadeWp = random(nadeWps); nadeWp = random(nadeWps);
loc = undefined;
myEye = self GetEye(); myEye = self GetEye();
if (!isDefined(nadeWp) || self HasScriptGoal() || self.bot_lock_goal) if (!isDefined(nadeWp) || self HasScriptGoal() || self.bot_lock_goal)
{ {
@ -1883,8 +1934,6 @@ bot_use_grenade_think()
} }
else else
{ {
loc = nadeWp.origin + AnglesToForward(nadeWp.angles) * 2048;
self SetScriptGoal(nadeWp.origin, 16); self SetScriptGoal(nadeWp.origin, 16);
ret = self waittill_any_return("new_goal", "goal", "bad_path"); ret = self waittill_any_return("new_goal", "goal", "bad_path");
@ -1894,7 +1943,19 @@ bot_use_grenade_think()
if (ret != "goal") if (ret != "goal")
continue; continue;
doFastContinue = true;
continue;
} }
}
else
{
nadeWp = self getNearestWaypointOfWaypoints(level.waypointsGren);
loc = nadeWp.origin + AnglesToForward(nadeWp.angles) * 2048;
}
if (!isDefined(loc))
continue;
self SetScriptAimPos(loc); self SetScriptAimPos(loc);
self BotStopMoving(true); self BotStopMoving(true);
@ -2016,6 +2077,9 @@ bot_jav_loc_think()
loc = javWp.jav_point; loc = javWp.jav_point;
} }
if (!isDefined(loc))
continue;
self SetBotJavelinLocation(loc); self SetBotJavelinLocation(loc);
self notify("bot_force_check_switch"); self notify("bot_force_check_switch");