well less mistakes happen now
This commit is contained in:
parent
31d550bbcf
commit
c1da687fa8
@ -105,7 +105,6 @@ public Action UpdateHide(Handle timer)
|
|||||||
if (!g_hCVar_HideEnabled.BoolValue)
|
if (!g_hCVar_HideEnabled.BoolValue)
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
|
|
||||||
bool CheckedEachOtherDistance[MAXPLAYERS + 1][MAXPLAYERS + 1];
|
|
||||||
g_iLeader = Leader_CurrentLeader();
|
g_iLeader = Leader_CurrentLeader();
|
||||||
|
|
||||||
for (int client = 1; client <= MaxClients; client++)
|
for (int client = 1; client <= MaxClients; client++)
|
||||||
@ -161,22 +160,22 @@ public Action UpdateHide(Handle timer)
|
|||||||
}
|
}
|
||||||
g_bHasTobeVisible[client] = true;
|
g_bHasTobeVisible[client] = true;
|
||||||
}
|
}
|
||||||
//but the human leader and human item users may still want to hide the remaining human players. (one direction)
|
//but the human leader and human item users may still want to hide the remaining human players.
|
||||||
if (ClientIsAlive && ClientIsHuman && (g_iLeader == client || ClientHasItem))
|
if (ClientIsAlive && ClientIsHuman && (g_iLeader == client || ClientHasItem))
|
||||||
{
|
{
|
||||||
DoTheTargetCheck(client, true, CheckedEachOtherDistance);
|
DoTheTargetCheck(client);
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
g_bHasTobeVisible[client] = false;
|
g_bHasTobeVisible[client] = false;
|
||||||
|
|
||||||
//all the remaining checks for clients with hide enabled that are alive humans and not leaders or item users.
|
//all the remaining checks for clients with hide enabled that are alive humans and not leaders or item users.
|
||||||
DoTheTargetCheck(client, false, CheckedEachOtherDistance); //(both directions)
|
DoTheTargetCheck(client);
|
||||||
}
|
}
|
||||||
return Plugin_Continue;
|
return Plugin_Continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DoTheTargetCheck(int client, bool OneDirectional, bool[][] CheckedEachOtherDistance)
|
public void DoTheTargetCheck(int client)
|
||||||
{
|
{
|
||||||
float fOriginClient[3];
|
float fOriginClient[3];
|
||||||
float fOriginTarget[3];
|
float fOriginTarget[3];
|
||||||
@ -190,13 +189,6 @@ public void DoTheTargetCheck(int client, bool OneDirectional, bool[][] CheckedEa
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!OneDirectional && CheckedEachOtherDistance[client][target])
|
|
||||||
{
|
|
||||||
//the distance between these two Alive humans is already calculated.
|
|
||||||
//They both are not leader and have no items and they both have hide enabled.
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//the target is not the leader, has no item, is alive and is a human. so consider him for the distance check.
|
//the target is not the leader, has no item, is alive and is a human. so consider him for the distance check.
|
||||||
if (g_iLeader != target && !EW_ClientHasItem(target) && IsPlayerAlive(target) && ZR_IsClientHuman(target) && target != client)
|
if (g_iLeader != target && !EW_ClientHasItem(target) && IsPlayerAlive(target) && ZR_IsClientHuman(target) && target != client)
|
||||||
{
|
{
|
||||||
@ -209,23 +201,9 @@ public void DoTheTargetCheck(int client, bool OneDirectional, bool[][] CheckedEa
|
|||||||
//the client here cannot be a fakeclient. thats already checked.
|
//the client here cannot be a fakeclient. thats already checked.
|
||||||
TransmitManager_SetEntityState(target, client, false); //the player is hiding the teammate due to distance
|
TransmitManager_SetEntityState(target, client, false); //the player is hiding the teammate due to distance
|
||||||
g_bHidePlayers[client][target] = true;
|
g_bHidePlayers[client][target] = true;
|
||||||
//client it not a leader, not an item user and target has hide enabled
|
//LogMessage("client: %N is %s. target: %N is %s", client, ZR_IsClientHuman(client) ? "Human" : "Zombie", target, ZR_IsClientHuman(target) ? "Human" : "Zombie");
|
||||||
if (!OneDirectional && g_iHideRange[target] != DISABLED)
|
|
||||||
{
|
|
||||||
//the target here could be a fakeclient. so check that its not.
|
|
||||||
if (!IsFakeClient(target))
|
|
||||||
{
|
|
||||||
TransmitManager_SetEntityState(client, target, false); //the teammate is hiding the player due to distance
|
|
||||||
}
|
|
||||||
g_bHidePlayers[target][client] = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
g_bHasSomebodyToHide[client] = true; //theres at least one target to hide for the player, the teammate
|
g_bHasSomebodyToHide[client] = true; //theres at least one target to hide for the player, the teammate
|
||||||
//client it not a leader, not an item user and target has hide enabled
|
|
||||||
if (!OneDirectional && g_iHideRange[target] != DISABLED)
|
|
||||||
{
|
|
||||||
g_bHasSomebodyToHide[target] = true; //theres at least one target to hide for the teammate, the player
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -234,22 +212,9 @@ public void DoTheTargetCheck(int client, bool OneDirectional, bool[][] CheckedEa
|
|||||||
{
|
{
|
||||||
TransmitManager_SetEntityState(target, client, true); //the player is seeing the teammate due to distance
|
TransmitManager_SetEntityState(target, client, true); //the player is seeing the teammate due to distance
|
||||||
g_bHidePlayers[client][target] = false;
|
g_bHidePlayers[client][target] = false;
|
||||||
//client it not a leader, not an item user and target has hide enabled
|
|
||||||
if (!OneDirectional && g_iHideRange[target] != DISABLED)
|
|
||||||
{
|
|
||||||
TransmitManager_SetEntityState(target, client, true); //the teammate is seeing the player due to distance
|
|
||||||
g_bHidePlayers[target][client] = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//client it not a leader, not an item user and target has hide enabled
|
|
||||||
if (!OneDirectional && g_iHideRange[target] != DISABLED)
|
|
||||||
{
|
|
||||||
CheckedEachOtherDistance[client][target] = true;
|
|
||||||
CheckedEachOtherDistance[target][client] = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user