updated hull tracing to catch a missed case where bot must jump but fails to notice. also updated the jumping again so it hopefully does not fuck up on roundstarts or teleports etc etc
This commit is contained in:
parent
98b13e96a1
commit
54c9ff0ac6
@ -93,6 +93,7 @@ public void OnPluginStart()
|
||||
RegConsoleCmd("sm_autism", cmd_talk, "talking to the bot through java application");
|
||||
RegConsoleCmd("sm_botrtv", cmd_botrtv, "making bots rtv");
|
||||
HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
|
||||
HookEvent("round_end", Event_RoundEnd, EventHookMode_PostNoCopy);
|
||||
|
||||
//UDP connection
|
||||
connect_socket();
|
||||
@ -118,6 +119,9 @@ public MRESReturn OnGetRunCmdPre(int entity, Handle hReturn)
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// Fix ladder tp aswell, they fail getting up ladders sometimes with the change. otherwise good
|
||||
//
|
||||
public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3], float angles[3], int& weapon, int& subtype, int& cmdnum, int& tickcount, int& seed, int mouse[2])
|
||||
{
|
||||
//we use info we just got from OnPlayerRunCmdPre to determine if to jump
|
||||
@ -140,7 +144,6 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
|
||||
TeleportEntity(client, coords_run_cmd[client], NULL_VECTOR, NULL_VECTOR);
|
||||
buttons |= IN_JUMP; //jump
|
||||
has_to_jump_bots[client] = 2;
|
||||
CreateTimer(1.5, reset_jump, client);
|
||||
}
|
||||
else if (GetEntityFlags(client) & FL_ONGROUND)
|
||||
{
|
||||
@ -153,15 +156,6 @@ public Action OnPlayerRunCmd(int client, int& buttons, int& impulse, float vel[3
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public Action reset_jump(Handle hTimer, int client)
|
||||
{
|
||||
if (IsValidClient(client))
|
||||
{
|
||||
has_to_jump_bots[client] = 0;
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public void OnPluginEnd()
|
||||
{
|
||||
if (g_hTimer_pressing != null)
|
||||
@ -173,6 +167,19 @@ public void OnPluginEnd()
|
||||
delete g_hTimer_bot_connect;
|
||||
}
|
||||
}
|
||||
public void Event_RoundEnd(Handle event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsValidClient(i))
|
||||
{
|
||||
if (is_bot_player(i))
|
||||
{
|
||||
has_to_jump_bots[i] = 3;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
@ -189,6 +196,8 @@ public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast
|
||||
targetfriend_prev_coords[i][0] = 0.0;
|
||||
targetfriend_prev_coords[i][1] = 0.0;
|
||||
targetfriend_prev_coords[i][2] = 0.0;
|
||||
GetEntPropVector(i, Prop_Send, "m_vecOrigin", coords_run_cmd[i]);
|
||||
has_to_jump_bots[i] = 0;
|
||||
for (int j = 1; j <= MaxClients; j++)
|
||||
{
|
||||
if (IsValidClient(j) && j != i)
|
||||
@ -502,6 +511,7 @@ public Action recursive_pressing(Handle timer, any data)
|
||||
if (!IsPointVisible(ClientPos, friend_prev) && distance_prev_friend_prior > 500.0)
|
||||
{
|
||||
bot_follow_tp[client] = true;
|
||||
has_to_jump_bots[client] = 2;
|
||||
}
|
||||
}
|
||||
if (IsValidClient(target_friend[client]) && !bot_follow_tp[client])
|
||||
@ -527,6 +537,7 @@ public Action recursive_pressing(Handle timer, any data)
|
||||
targetfriend_prev_coords[client][1] = 0.0;
|
||||
targetfriend_prev_coords[client][2] = 0.0;
|
||||
bot_follow_tp[client] = false;
|
||||
has_to_jump_bots[client] = 0;
|
||||
}
|
||||
state = 8; //if its walking into a TP or up/down a ladder it matters to use +forward;
|
||||
}
|
||||
@ -689,7 +700,17 @@ public void trace_hulling_bot(int client)
|
||||
}
|
||||
//something blocks floor crouch
|
||||
eye_position[2] += 5.0;
|
||||
TR_TraceHullFilter(eye_position, eye_position, mins, maxs, MASK_ALL, TraceRayDontHitSelf);
|
||||
float new_mins[3], new_maxs[3], new_eyes[3];
|
||||
new_mins[0] = mins[0];
|
||||
new_mins[1] = mins[1];
|
||||
new_mins[2] = crouch_min + 16.0;
|
||||
new_maxs[0] = maxs[0];
|
||||
new_maxs[1] = maxs[1];
|
||||
new_maxs[2] = maxs[2] + 16.0;
|
||||
new_eyes[0] = eye_position[0];
|
||||
new_eyes[1] = eye_position[1];
|
||||
new_eyes[2] = eye_position[2] - 64.0;
|
||||
TR_TraceHullFilter(new_eyes, new_eyes, new_mins, new_maxs, MASK_ALL, TraceRayDontHitSelf);
|
||||
if (!(TR_DidHit()))
|
||||
{
|
||||
//should not block jump level
|
||||
|
Loading…
Reference in New Issue
Block a user