more general changes to targeting
This commit is contained in:
parent
4fdd1670a1
commit
21b8c8c933
@ -75,8 +75,8 @@ def bot_process_movement(input_line):
|
||||
strInput += "use weapon_p90; wait 3; "
|
||||
elif targeteam == 2:
|
||||
strInput += "use weapon_knife; wait 5; "
|
||||
#print('date: ', datetime.datetime.now().time(), ' target_enemy: ', target_enemy, ' enemy distance: ', enemy_distance, ' target human: ', targethuman,
|
||||
# ' dist_target: ', dist_target)
|
||||
print('date: ', datetime.datetime.now().time(), ' target_enemy: ', target_enemy, ' enemy distance: ', enemy_distance, ' target human: ', targethuman,
|
||||
' dist_target: ', dist_target)
|
||||
strInput = strinput_append(strInput, 2)
|
||||
#print('strInput final:', strInput)
|
||||
writeCfgInput(strInput)
|
||||
@ -183,9 +183,9 @@ if __name__ == '__main__':
|
||||
if hull_info == "jump":
|
||||
strInput += "+jump; wait 5; -jump; +duck; wait 50; -duck; wait 5; "
|
||||
elif hull_info == "crouch":
|
||||
strInput += "+duck; wait 250; -duck; wait 5; "
|
||||
strInput += "+duck; wait 50; -duck; wait 5; "
|
||||
writeCfgInput(strInput)
|
||||
print(colored_text)
|
||||
#print(colored_text)
|
||||
time.sleep(0.1)
|
||||
writeCfgInput("")
|
||||
except KeyboardInterrupt:
|
||||
|
@ -15,6 +15,7 @@
|
||||
//#pragma newdecls required
|
||||
int present = 0;
|
||||
int targethuman = 0;
|
||||
int target_enemy = 0;
|
||||
int buttons_old;
|
||||
int flags_old;
|
||||
bool surf_cooldown = false;
|
||||
@ -56,6 +57,7 @@ public void OnPluginStart()
|
||||
chat_cooldown = false;
|
||||
reset_target_human_tp_coord();
|
||||
targethuman = 0;
|
||||
target_enemy = 0;
|
||||
}
|
||||
|
||||
public void reset_target_human_tp_coord()
|
||||
@ -171,6 +173,7 @@ public Action bot_chat_cooldown(Handle timer, any data)
|
||||
public void Event_RoundStart(Handle event, const char[] name, bool dontBroadcast)
|
||||
{
|
||||
targethuman = 0;
|
||||
target_enemy = 0;
|
||||
reset_target_human_tp_coord();
|
||||
}
|
||||
|
||||
@ -178,7 +181,7 @@ public void OnMapStart()
|
||||
{
|
||||
//0.2 too spammmy, 1.5 too slow
|
||||
chat_cooldown = false;
|
||||
CreateTimer(0.60, recursive_pressing, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
CreateTimer(0.30, recursive_pressing, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
CreateTimer(15.0, bot_check_connect, INVALID_HANDLE, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||
}
|
||||
|
||||
@ -265,7 +268,7 @@ public Action recursive_pressing(Handle timer, any data)
|
||||
}
|
||||
targethuman = GetClosestClient_option1(targeteam == 2 ? 2 : 3);
|
||||
float enemy_distance = -1.0;
|
||||
int target_enemy = GetClosestClient_option1(targeteam == 2 ? 3 : 2);
|
||||
target_enemy = GetClosestClient_option1(targeteam == 2 ? 3 : 2);
|
||||
float dist_target = -1.0;
|
||||
float pos[3];
|
||||
if (IsValidClient(targethuman))
|
||||
@ -424,7 +427,7 @@ public void face_call(int client)
|
||||
|
||||
public void faceclient(int target_human)
|
||||
{
|
||||
if (IsValidClient(present) && IsValidClient(target_human) && GetEntityMoveType(present) != MOVETYPE_LADDER)
|
||||
if (IsValidClient(present) && IsValidClient(target_human))
|
||||
{
|
||||
float TargetPos[3];
|
||||
float ClientPos[3];
|
||||
@ -466,7 +469,7 @@ public int GetClosestClient_option1(int targeteam)
|
||||
float pos[3];
|
||||
GetEntPropVector(i, Prop_Send, "m_vecOrigin", pos);
|
||||
float dist_target = get_power_distance(present, pos);
|
||||
if (admins[i] || vips[i])
|
||||
if (admins[i] || vips[i] || i == targethuman || i == target_enemy)
|
||||
dist_target /= 5;
|
||||
if (nearestdistance < 0 || dist_target < nearestdistance)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user