made extra check before teleport autismbot back, to ensure that the map teleporting the bot wont be missunderstood as the bot jumping off an edge

This commit is contained in:
jenz 2023-10-25 21:49:04 +02:00
parent d5833f09cd
commit c68107be34

View File

@ -133,21 +133,33 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
GetEntPropVector(client, Prop_Send, "m_vecOrigin", coords_run_cmd[client]);
return Plugin_Continue;
}
//on voodoo island bots managed to skip tp. either due to water or due to ladder
if (GetEntProp(client, Prop_Data, "m_nWaterLevel") != 0)
{
has_to_jump_bots[client] = 2;
return Plugin_Continue;
}
//make sure fell of an edge instead of actually jumping
if (buttons & IN_JUMP && has_to_jump_bots[client] == 1)
{
has_to_jump_bots[client] = 2;
return Plugin_Continue;
}
//!bot_follow_tp[client] ensures that bot is not busy with running into a teleporter
if (has_to_jump_bots[client] == 1 && !bot_follow_tp[client])
{
//this check accomedates checking for if the bot actually was teleported by the map because then he should not teleport back again to coords_run_cmd
//the famous voodoo incidents that people have seen.
float distance_bot_current_position_last_position = get_power_distance(client, coords_run_cmd[client]);
//PrintToChatAll("distance_bot_current_position_last_position: %f %N", distance_bot_current_position_last_position, client);
if (distance_bot_current_position_last_position > 500.0)
{
has_to_jump_bots[client] = 2;
return Plugin_Continue;
}
//teleport back on ground so can jump
TeleportEntity(client, coords_run_cmd[client], NULL_VECTOR, NULL_VECTOR);
buttons |= IN_JUMP; //jump