adding prevention for bot to fall off the edge
This commit is contained in:
parent
c3c03f4e95
commit
c72d96a714
@ -279,7 +279,7 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
|
||||
if (!(flags & FL_ONGROUND) && (flags_old[client] & FL_ONGROUND) && !(buttons_old[client] & IN_JUMP) && !(buttons & IN_JUMP) && (GetEntityMoveType(client) != MOVETYPE_LADDER) && GetEntProp(client, Prop_Data, "m_nWaterLevel") == 0)
|
||||
{
|
||||
float Vel[3], feet_origin[3], ground_pos[3], downwards[3];
|
||||
//TODO
|
||||
//TODO prevent bot from falling off edge if nothing infront
|
||||
float velocity_addition_z_axis = 300.0;
|
||||
GetEntPropVector(client, Prop_Data, "m_vecVelocity", Vel);
|
||||
Vel[2] += velocity_addition_z_axis;
|
||||
@ -312,8 +312,6 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
|
||||
float feet_origin_pre[3], human_feet_origin[3];
|
||||
GetClientAbsOrigin(client, feet_origin_pre);
|
||||
GetClientAbsOrigin(targethuman[client], human_feet_origin);
|
||||
//target human is below, get down to them
|
||||
//TODO maybe?
|
||||
if (feet_origin_pre[2] - 200 > human_feet_origin[2])
|
||||
{
|
||||
buttons_old[client] = buttons;
|
||||
@ -323,10 +321,17 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
|
||||
}
|
||||
float velocity[3];
|
||||
GetEntPropVector(client, Prop_Data, "m_vecVelocity", velocity);
|
||||
velocity[2] += 30.0;
|
||||
NegateVector(velocity);
|
||||
for (int y = 0; y < 10; y++)
|
||||
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity);
|
||||
if (velocity[0] > 0)
|
||||
velocity[0] += 150;
|
||||
else
|
||||
velocity[0] -= 150;
|
||||
if (velocity[1] > 0)
|
||||
velocity[1] += 150;
|
||||
else
|
||||
velocity[1] -= 150;
|
||||
velocity[2] += 150;
|
||||
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -403,7 +408,6 @@ public Action recursive_pressing(Handle timer, any data)
|
||||
dist_target = get_power_distance(client, pos);
|
||||
}
|
||||
|
||||
//TODO maybe disable if requested
|
||||
if (IsValidClient(target_enemy[client]))
|
||||
{
|
||||
GetEntPropVector(target_enemy[client], Prop_Send, "m_vecOrigin", pos);
|
||||
|
Loading…
Reference in New Issue
Block a user