From c68107be3414065c21151ffc20dfe85cb9afdc08 Mon Sep 17 00:00:00 2001 From: jenz Date: Wed, 25 Oct 2023 21:49:04 +0200 Subject: [PATCH] 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 --- AutismBotIngame/scripting/autism_bot_info.sp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/AutismBotIngame/scripting/autism_bot_info.sp b/AutismBotIngame/scripting/autism_bot_info.sp index cbb579ae..7822b2bd 100644 --- a/AutismBotIngame/scripting/autism_bot_info.sp +++ b/AutismBotIngame/scripting/autism_bot_info.sp @@ -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