wall detection update
This commit is contained in:
parent
d59b90c187
commit
fa55ea1e17
@ -74,20 +74,20 @@ def bot_process_movement(input_line):
|
||||
dist_target = input_line[input_line.index("dist_target:") + len("dist_target:"):input_line.index("targethuman:")]
|
||||
targethuman = input_line[input_line.index("targethuman:") + len("targethuman:"):input_line.index("bot_on_type:")]
|
||||
bot_on_type = input_line[input_line.index("bot_on_type:") + len("bot_on_type:"):input_line.index("enemy_distance:")]
|
||||
enemy_distance = input_line[input_line.index("enemy_distance:") + len("enemy_distance:"):input_line.index("bot_stuck:")]
|
||||
bot_stuck = input_line[input_line.index("bot_stuck:") + len("bot_stuck:"):input_line.index("targeteam:")]
|
||||
enemy_distance = input_line[input_line.index("enemy_distance:") + len("enemy_distance:"):input_line.index("crouch_or_jump:")]
|
||||
crouch_or_jump = input_line[input_line.index("crouch_or_jump:") + len("crouch_or_jump:"):input_line.index("targeteam:")]
|
||||
targeteam = input_line[input_line.index("targeteam:") + len("targeteam:"):]
|
||||
dist_target = float(dist_target)
|
||||
enemy_distance = float(enemy_distance)
|
||||
bot_on_type = int(bot_on_type)
|
||||
bot_stuck = int(bot_stuck)
|
||||
crouch_or_jump = int(crouch_or_jump)
|
||||
targeteam = int(targeteam)
|
||||
#maybe 0.8 instead
|
||||
min_distance_target_human = 0.1
|
||||
strInput = "-attack; wait 2; -use; wait 5; -jump; wait 5; -duck; wait 5; +attack; wait 5; cl_minmodels 1; wait 2; +use; +forward; wait 2; "
|
||||
if bot_stuck:
|
||||
print('bot stuck')
|
||||
strInput += "+jump; wait 5; +duck; wait 5; -jump; wait 15; -duck; wait 3;"
|
||||
if crouch_or_jump > 0:
|
||||
print('crouch_or_jump')
|
||||
strInput += "+jump; wait 5; +duck; wait 5; -jump; wait 500; -duck; wait 3;"
|
||||
if dist_target > min_distance_target_human:
|
||||
strInput += "use weapon_elite; wait 3; "
|
||||
elif targeteam == 3:
|
||||
@ -214,3 +214,6 @@ if __name__ == '__main__':
|
||||
#cd /home/gameservers/ze_runner_files
|
||||
#./play.sh
|
||||
#screen -A -d -m -S ze_runner ./play.sh
|
||||
|
||||
#before steam login: export SDL_VIDEO_X11_VISUALID=0x074
|
||||
#to find correct SDL_VIDEO_X11_VISUALID use glxinfo in X2GO
|
||||
|
@ -18,7 +18,6 @@ int targethuman = 0;
|
||||
int buttons_old;
|
||||
int flags_old;
|
||||
int surf_delay = 0;
|
||||
float bot_old_coords[3];
|
||||
float client_old_coords[MAXPLAYERS + 1][3];
|
||||
float targethuman_teleported[3];
|
||||
float g_vCurrent[3];
|
||||
@ -68,7 +67,6 @@ public void OnPluginStart()
|
||||
cmdpost_run_cooldown = false;
|
||||
bot_surf_plane = false;
|
||||
reset_target_human_tp_coord();
|
||||
reset_bot_old_coords();
|
||||
targethuman = 0;
|
||||
}
|
||||
|
||||
@ -258,19 +256,19 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
|
||||
if (IsValidClient(targethuman))
|
||||
{
|
||||
//TODO maybe?
|
||||
GetEntPropVector(present, Prop_Send, "m_vecOrigin", bot_old_coords);
|
||||
if (client_old_coords[targethuman][2] != bot_old_coords[2])
|
||||
/*
|
||||
{
|
||||
Vel[0] -= velocity_addition_z_axis / 10;
|
||||
Vel[1] -= velocity_addition_z_axis / 10;
|
||||
}
|
||||
*/
|
||||
}
|
||||
Vel[2] += velocity_addition_z_axis;
|
||||
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, Vel);
|
||||
check_bot_surfing();
|
||||
}
|
||||
buttons_old = buttons;
|
||||
flags_old = flags;
|
||||
check_bot_surfing();
|
||||
}
|
||||
}
|
||||
|
||||
@ -293,7 +291,6 @@ public Action recursive_pressing(Handle timer, any data)
|
||||
targeteam = 3;
|
||||
}
|
||||
bool find_closest_match = true;
|
||||
bool bot_stuck = false;
|
||||
|
||||
//check ladder = 0, water = 1, in air(surfing) = 2, downhill = 3, teleporter = 4
|
||||
int bot_on_type = -1;
|
||||
@ -338,6 +335,7 @@ public Action recursive_pressing(Handle timer, any data)
|
||||
int target_enemy = find_closest_enemy(present, targeteam);
|
||||
bool chasing_enemy = false;
|
||||
float dist_target = -1.0;
|
||||
bool crouch_or_jump = false;
|
||||
if (bot_on_type != 0 && bot_on_type != 2 && bot_on_type != 4)
|
||||
{
|
||||
float pos[3];
|
||||
@ -367,7 +365,7 @@ public Action recursive_pressing(Handle timer, any data)
|
||||
}
|
||||
}
|
||||
//zombie aiming for human
|
||||
if (targeteam == 2 && 0 < enemy_distance <= min_enemy_distance * 10)
|
||||
if (targeteam == 2 && 0 < enemy_distance)
|
||||
{
|
||||
chasing_enemy = true;
|
||||
face_call(target_enemy);
|
||||
@ -375,38 +373,58 @@ public Action recursive_pressing(Handle timer, any data)
|
||||
}
|
||||
if (IsValidClient(targethuman) && !chasing_enemy)
|
||||
face_call(targethuman);
|
||||
if (round_start_stuck)
|
||||
bot_stuck = is_bot_stuck();
|
||||
crouch_or_jump = wall_circle();
|
||||
}
|
||||
//TODO in some cases crouch under obstacles or jump more? maybe trace raying all obstacles, maybe use TR_GetPlaneNormal
|
||||
//make this replace is_bot_stuck() probably
|
||||
//crouch_or_jump = 0: nothing. crouch_or_jump = 1: crouch. crouch_or_jump = 2: jump.
|
||||
int crouch_or_jump = trace_geometry();
|
||||
|
||||
if (bot_on_type != 2)
|
||||
{
|
||||
if (IsValidClient(targethuman))
|
||||
Format(message, sizeof(message), "dist_target: %f targethuman: %N bot_on_type: %i enemy_distance: %f bot_stuck: %i targeteam: %i", dist_target, targethuman, bot_on_type, enemy_distance, bot_stuck, targeteam);
|
||||
Format(message, sizeof(message), "dist_target: %f targethuman: %N bot_on_type: %i enemy_distance: %f crouch_or_jump: %i targeteam: %i", dist_target, targethuman, bot_on_type, enemy_distance, crouch_or_jump, targeteam);
|
||||
else
|
||||
Format(message, sizeof(message), "dist_target: %f targethuman: none bot_on_type: %i enemy_distance: %f bot_stuck: %i targeteam: %i", dist_target, bot_on_type, enemy_distance, bot_stuck, targeteam);
|
||||
Format(message, sizeof(message), "dist_target: %f targethuman: none bot_on_type: %i enemy_distance: %f crouch_or_jump: %i targeteam: %i", dist_target, bot_on_type, enemy_distance, crouch_or_jump, targeteam);
|
||||
send_socket_msg(message, strlen(message));
|
||||
}
|
||||
}
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
public int trace_geometry()
|
||||
public bool wall_circle()
|
||||
{
|
||||
float vPos[3];
|
||||
float angles[3];
|
||||
//GetClientEyeAngles(client, angles);
|
||||
GetEntPropVector(present, Prop_Data, "m_vecOrigin", vPos);
|
||||
TR_TraceRay(vPos, angles, MASK_PLAYERSOLID_BRUSHONLY, RayType_Infinite);
|
||||
if (TR_DidHit())
|
||||
{
|
||||
|
||||
}
|
||||
return 0;
|
||||
//TODO maybe
|
||||
float min_cap_distance = 50.0;
|
||||
for (float AngleRotate = 0.0; AngleRotate < 360.0; AngleRotate += 30.0)
|
||||
{
|
||||
float StartOrigin[3];
|
||||
float Angles[3];
|
||||
Angles[0] = 0.0;
|
||||
Angles[1] = AngleRotate;
|
||||
Angles[2] = 0.0;
|
||||
GetClientEyePosition(present, StartOrigin);
|
||||
TR_TraceRayFilter(StartOrigin, Angles, MASK_SOLID, RayType_Infinite, TraceRayDontHitSelf);
|
||||
if (TR_DidHit())
|
||||
{
|
||||
float EndOrigin[3];
|
||||
TR_GetEndPosition(EndOrigin, INVALID_HANDLE);
|
||||
float Distance = (GetVectorDistance(StartOrigin, EndOrigin));
|
||||
if (Distance < min_cap_distance)
|
||||
return true;
|
||||
}
|
||||
float StartOrigin1[3];
|
||||
float Angles1[3];
|
||||
Angles1[0] = AngleRotate;
|
||||
Angles1[1] = 0.0;
|
||||
Angles1[2] = 0.0;
|
||||
GetClientEyePosition(present, StartOrigin1);
|
||||
TR_TraceRayFilter(StartOrigin1, Angles1, MASK_SOLID, RayType_Infinite, TraceRayDontHitSelf);
|
||||
if (TR_DidHit())
|
||||
{
|
||||
float EndOrigin[3];
|
||||
TR_GetEndPosition(EndOrigin, INVALID_HANDLE);
|
||||
float Distance = (GetVectorDistance(StartOrigin1, EndOrigin));
|
||||
if (Distance < min_cap_distance)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void check_bot_surfing()
|
||||
@ -522,16 +540,6 @@ public bool TraceRayDontHitSelf(int entity, int mask, any data)
|
||||
return entity != data && !(0 < entity <= MaxClients);
|
||||
}
|
||||
|
||||
public bool is_bot_stuck()
|
||||
{
|
||||
if (!round_start_stuck)
|
||||
return false;
|
||||
float min_distance_cap = 0.05;
|
||||
float bot_own_distance = get_power_distance(present, bot_old_coords);
|
||||
GetEntPropVector(present, Prop_Send, "m_vecOrigin", bot_old_coords);
|
||||
return bot_own_distance <= min_distance_cap;
|
||||
}
|
||||
|
||||
public void face_call(int client)
|
||||
{
|
||||
for (int j = 0; j < 5; j++)
|
||||
@ -670,13 +678,6 @@ public float get_power_distance(int target_player, float [3]pos)
|
||||
return power_distance / defaultcap;
|
||||
}
|
||||
|
||||
public void reset_bot_old_coords()
|
||||
{
|
||||
bot_old_coords[0] = 0.0;
|
||||
bot_old_coords[1] = 0.0;
|
||||
bot_old_coords[2] = 0.0;
|
||||
}
|
||||
|
||||
public void OnClientPostAdminCheck(int client)
|
||||
{
|
||||
//STEAM_0:1:34783317
|
||||
@ -688,13 +689,11 @@ public void OnClientPostAdminCheck(int client)
|
||||
if (StrEqual("[U:1:120378081]", auth, false))
|
||||
{
|
||||
present = client;
|
||||
reset_bot_old_coords();
|
||||
bot_send_connected_msg();
|
||||
}
|
||||
else if (StrEqual("STEAM_0:1:60189040", auth, false))
|
||||
{
|
||||
present = client;
|
||||
reset_bot_old_coords();
|
||||
bot_send_connected_msg();
|
||||
}
|
||||
if (CheckCommandAccess(client, "sm_kick", ADMFLAG_KICK))
|
||||
|
Loading…
Reference in New Issue
Block a user