flag.solid = SOLID_TRIGGER;
flag.ctf_dropper = player;
flag.ctf_droptime = time;
- navigation_dynamicgoal_set(flag);
flag.flags = FL_ITEM | FL_NOTARGET; // clear FL_ONGROUND for MOVETYPE_TOSS
flag_velocity = (('0 0 1' * autocvar_g_ctf_throw_velocity_up) + ((v_forward * autocvar_g_ctf_throw_velocity_forward) * ((player.items & ITEM_Strength.m_itemid) ? autocvar_g_ctf_throw_strengthmultiplier : 1)));
flag.velocity = W_CalculateProjectileVelocity(player, player.velocity, flag_velocity, false);
ctf_Handle_Drop(flag, player, droptype);
+ navigation_dynamicgoal_set(flag, player);
break;
}
{
flag.velocity = W_CalculateProjectileVelocity(player, player.velocity, (('0 0 1' * autocvar_g_ctf_drop_velocity_up) + ((('0 1 0' * crandom()) + ('1 0 0' * crandom())) * autocvar_g_ctf_drop_velocity_side)), false);
ctf_Handle_Drop(flag, player, droptype);
+ navigation_dynamicgoal_set(flag, player);
break;
}
}
settouch(this, ka_TouchEvent);
setthink(this, ka_RespawnBall);
this.nextthink = time + autocvar_g_keepawayball_respawntime;
- navigation_dynamicgoal_set(this);
+ navigation_dynamicgoal_set(this, NULL);
Send_Effect(EFFECT_ELECTRO_COMBO, oldballorigin, '0 0 0', 1);
Send_Effect(EFFECT_ELECTRO_COMBO, this.origin, '0 0 0', 1);
ball.effects &= ~EF_NODRAW;
setorigin(ball, plyr.origin + '0 0 10');
ball.velocity = '0 0 200' + '0 100 0'*crandom() + '100 0 0'*crandom();
- entity e = ball.owner; ball.owner = NULL;
+ entity e = ball.owner;
+ ball.owner = NULL;
e.ballcarried = NULL;
GameRules_scoring_vip(e, false);
- navigation_dynamicgoal_set(ball);
+ navigation_dynamicgoal_set(ball, e);
// reset the player effects
plyr.glow_trail = false;
key.takedamage = DAMAGE_YES;
// let key.team stay
key.modelindex = kh_key_dropped;
- navigation_dynamicgoal_set(key);
+ navigation_dynamicgoal_set(key, key.owner);
key.kh_previous_owner = key.owner;
key.kh_previous_owner_playerid = key.owner.playerid;
}
.entity bot_basewaypoint;
.bool navigation_dynamicgoal;
void navigation_dynamicgoal_init(entity this, bool initially_static);
-void navigation_dynamicgoal_set(entity this);
+void navigation_dynamicgoal_set(entity this, entity dropper);
void navigation_dynamicgoal_unset(entity this);
entity navigation_findnearestwaypoint(entity ent, float walkfromwp);
void navigation_goalrating_end(entity this);
this.nearestwaypointtimeout = time;
}
-void navigation_dynamicgoal_set(entity this)
+void navigation_dynamicgoal_set(entity this, entity dropper)
{
this.nearestwaypointtimeout = time;
+ if (dropper && dropper.nearestwaypointtimeout && dropper.nearestwaypointtimeout < time + 2)
+ this.nearestwaypoint = dropper.nearestwaypoint;
if (this.nearestwaypoint)
this.nearestwaypointtimeout += 2;
}
// updates the best goal according to a weighted calculation of travel cost and item value of a new proposed item
void navigation_routerating(entity this, entity e, float f, float rangebias)
{
- if (!e)
- return;
-
- if(e.blacklisted)
- return;
+ if (!e || e.blacklisted) { return; }
rangebias = waypoint_getlinearcost(rangebias);
f = waypoint_getlinearcost(f);
.entity bot_basewaypoint;
.bool navigation_dynamicgoal;
void navigation_dynamicgoal_init(entity this, bool initially_static);
-void navigation_dynamicgoal_set(entity this);
+void navigation_dynamicgoal_set(entity this, entity dropper);
void navigation_dynamicgoal_unset(entity this);
.int nav_submerged_state;