slight changes to seeing

This commit is contained in:
christian 2021-04-25 01:01:05 +02:00
parent 03c8fe953e
commit 2443349e8f

View File

@ -298,7 +298,34 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
{ {
float angles_eye[3]; float angles_eye[3];
GetClientEyeAngles(client, angles_eye); GetClientEyeAngles(client, angles_eye);
feet_origin[2] += 10.0; //feet_origin[2] += 10.0;
TR_TraceRayFilter(feet_origin, angles_eye, MASK_ALL, RayType_Infinite, TraceRayDontHitSelf, client);
if (TR_DidHit())
{
TR_GetEndPosition(ground_pos);
ground_distance = GetVectorDistance(feet_origin, ground_pos);
float forward_distance = GetVectorDistance(feet_origin, ground_pos);
if (forward_distance > 280)
{
float velocity[3];
GetEntPropVector(client, Prop_Data, "m_vecVelocity", velocity);
NegateVector(velocity);
if (velocity[0] > 0)
velocity[0] += 850;
else
velocity[0] -= 850;
if (velocity[1] > 0)
velocity[1] += 850;
else
velocity[1] -= 850;
velocity[2] += 150;
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity);
}
}
/*
TR_TraceRayFilter(feet_origin, angles_eye, MASK_ALL, RayType_Infinite, TraceRayDontHitSelf, client); TR_TraceRayFilter(feet_origin, angles_eye, MASK_ALL, RayType_Infinite, TraceRayDontHitSelf, client);
if (TR_DidHit()) if (TR_DidHit())
{ {
@ -323,17 +350,18 @@ public void OnPlayerRunCmdPost(int client, int buttons, int impulse, const float
GetEntPropVector(client, Prop_Data, "m_vecVelocity", velocity); GetEntPropVector(client, Prop_Data, "m_vecVelocity", velocity);
NegateVector(velocity); NegateVector(velocity);
if (velocity[0] > 0) if (velocity[0] > 0)
velocity[0] += 150; velocity[0] += 450;
else else
velocity[0] -= 150; velocity[0] -= 450;
if (velocity[1] > 0) if (velocity[1] > 0)
velocity[1] += 150; velocity[1] += 450;
else else
velocity[1] -= 150; velocity[1] -= 450;
velocity[2] += 150; velocity[2] += 150;
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity); TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, velocity);
} }
} }
*/
} }
} }
TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, Vel); TeleportEntity(client, NULL_VECTOR, NULL_VECTOR, Vel);
@ -372,8 +400,6 @@ public Action recursive_pressing(Handle timer, any data)
} }
if (IsPlayerAlive(client)) if (IsPlayerAlive(client))
{ {
if (GetEntityMoveType(client) == MOVETYPE_LADDER)
continue;
int targeteam = 0; int targeteam = 0;
if (GetClientTeam(client) != 3) if (GetClientTeam(client) != 3)
{ {
@ -397,6 +423,7 @@ public Action recursive_pressing(Handle timer, any data)
reset_target_human_tp_coord(client); reset_target_human_tp_coord(client);
continue; continue;
} }
//no target in water somehow
target_enemy[client] = GetClosestClient_option1(targeteam == 2 ? 3 : 2, client); target_enemy[client] = GetClosestClient_option1(targeteam == 2 ? 3 : 2, client);
targethuman[client] = GetClosestClient_option1(targeteam == 2 ? 2 : 3, client); targethuman[client] = GetClosestClient_option1(targeteam == 2 ? 2 : 3, client);
float enemy_distance = -1.0; float enemy_distance = -1.0;
@ -688,6 +715,8 @@ public int GetClosestClient_option1(int targeteam, int client)
{ {
float nearestdistance = -1.0; float nearestdistance = -1.0;
int nearest = -1; int nearest = -1;
if (GetEntityMoveType(client) == MOVETYPE_LADDER)
return nearest;
for (int i = 1; i <= MaxClients; i++) for (int i = 1; i <= MaxClients; i++)
if (IsValidClient(i) && IsPlayerAlive(i) && i != client && GetClientTeam(i) == targeteam) if (IsValidClient(i) && IsPlayerAlive(i) && i != client && GetClientTeam(i) == targeteam)
{ {
@ -720,22 +749,6 @@ public int GetClosestClient_option1(int targeteam, int client)
nearestdistance = dist_target; nearestdistance = dist_target;
} }
} }
if (nearest == -1)
{
for (int i = 1; i <= MaxClients; i++)
if (IsValidClient(i) && IsPlayerAlive(i) && i != client && GetClientTeam(i) == targeteam)
{
float pos[3];
GetEntPropVector(i, Prop_Send, "m_vecOrigin", pos);
float dist_target = get_power_distance(client, pos);
if (nearestdistance < 0 || dist_target < nearestdistance)
{
nearest = i;
nearestdistance = dist_target;
}
}
}
return nearest; return nearest;
} }
@ -862,7 +875,7 @@ public bool Filter_NoPlayers(int entity, int mask)
public bool IsPointVisible(const float start[3], const float end[3]) public bool IsPointVisible(const float start[3], const float end[3])
{ {
TR_TraceRayFilter(start, end, MASK_ALL, RayType_EndPoint, Filter_NoPlayers); TR_TraceRayFilter(start, end, MASK_SOLID, RayType_EndPoint, Filter_NoPlayers);
return TR_GetFraction() == 1.0; return TR_GetFraction() == 1.0;
} }