jav points

This commit is contained in:
Your Name 2020-09-05 11:23:42 -06:00
parent bc322b5ab4
commit bf75ea6813
2 changed files with 46 additions and 13 deletions

View File

@ -1177,7 +1177,8 @@ bot_think_follow()
if (!isDefined(toFollow)) if (!isDefined(toFollow))
continue; continue;
self followPlayer(toFollow, randomIntRange(10,20)); self thread killFollowAfterTime(randomIntRange(10,20));
self followPlayer(toFollow);
} }
} }
@ -1210,12 +1211,11 @@ killFollowAfterTime(time)
self notify("kill_follow_bot"); self notify("kill_follow_bot");
} }
followPlayer(who, time) followPlayer(who)
{ {
self endon("kill_follow_bot"); self endon("kill_follow_bot");
self thread watchForFollowNewGoal(); self thread watchForFollowNewGoal();
self thread killFollowAfterTime(time);
for (;;) for (;;)
{ {
@ -1398,19 +1398,50 @@ bot_jav_loc_think()
if (self IsUsingRemote()) if (self IsUsingRemote())
continue; continue;
traceForward = self maps\mp\_javelin::EyeTraceForward(); javWp = undefined;
if (!isDefined(traceForward))
continue;
loc = traceForward[0]; for (i = 0; i < level.waypointsJav.size; i++)
if (self maps\mp\_javelin::TargetPointTooClose(loc)) {
continue; if (Distance(self.origin, level.waypointsJav[i].origin) > 1024)
continue;
if (!bulletTracePassed(self.origin + (0, 0, 5), self.origin + (0, 0, 2048), false, self)) if (isDefined(javWp) && closer(self.origin, javWp.origin, level.waypointsJav[i].origin))
continue; continue;
if (!bulletTracePassed(loc + (0, 0, 5), loc + (0, 0, 2048), false, self)) javWp = level.waypointsJav[i];
continue; }
loc = undefined;
if (!isDefined(javWp) || self HasScriptGoal() || self.bot_lock_goal)
{
traceForward = self maps\mp\_javelin::EyeTraceForward();
if (!isDefined(traceForward))
continue;
loc = traceForward[0];
if (self maps\mp\_javelin::TargetPointTooClose(loc))
continue;
if (!bulletTracePassed(self.origin + (0, 0, 5), self.origin + (0, 0, 2048), false, self))
continue;
if (!bulletTracePassed(loc + (0, 0, 5), loc + (0, 0, 2048), false, self))
continue;
}
else
{
loc = javWp.jav_point;
self SetScriptGoal(javWp.origin, 16);
ret = self waittill_any_return("new_goal", "goal", "bad_path");
if (ret != "new_goal")
self ClearScriptGoal();
if (ret != "goal")
continue;
}
self SetBotJavelinLocation(loc); self SetBotJavelinLocation(loc);
self setSpawnWeapon("javelin_mp"); self setSpawnWeapon("javelin_mp");

View File

@ -121,6 +121,8 @@ HasScriptGoal()
*/ */
SetScriptGoal(goal, dist) SetScriptGoal(goal, dist)
{ {
if (!isDefined(dist))
dist = 16;
self.bot.script_goal = goal; self.bot.script_goal = goal;
self.bot.script_goal_dist = dist; self.bot.script_goal_dist = dist;
waittillframeend; waittillframeend;