Skip to content

Commit

Permalink
Server: Ability pings
Browse files Browse the repository at this point in the history
  • Loading branch information
Zheneq committed Jan 22, 2023
1 parent 7098805 commit 7bc4829
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
30 changes: 27 additions & 3 deletions Assembly-CSharp/ActorController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,16 +191,40 @@ internal void CmdSendMinimapPing(int teamIndex, Vector3 worldPosition, PingType
if (num == -1)
{
m_actor.PingOnClient(teamIndex, worldPosition, pingType, true);
return;
}
m_lastPings[num] = Time.time;
m_actor.PingOnClient(teamIndex, worldPosition, pingType, false);
else
{
m_lastPings[num] = Time.time;
m_actor.PingOnClient(teamIndex, worldPosition, pingType, false);
}
#endif
}

[Command]
// was empty in reactor
internal void CmdSendAbilityPing(int teamIndex, LocalizationArg_AbilityPing localizedPing)
{
#if SERVER
// custom
int num = -1;
for (int i = 0; i < m_lastPings.Length; i++)
{
if (m_lastPings[i] + 10f < Time.time)
{
num = i;
break;
}
}
if (num == -1)
{
m_actor.PingOnClient(teamIndex, localizedPing, true);
}
else
{
m_lastPings[num] = Time.time;
m_actor.PingOnClient(teamIndex, localizedPing, false);
}
#endif
}

public void ClearHighlights()
Expand Down
11 changes: 11 additions & 0 deletions Assembly-CSharp/ActorData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6489,6 +6489,17 @@ public void PingOnClient(int teamIndex, Vector3 worldPosition, ActorController.P
}
#endif

#if SERVER
// custom
public void PingOnClient(int teamIndex, LocalizationArg_AbilityPing localizedPing, bool spam)
{
if (m_teamSensitiveData_friendly != null)
{
m_teamSensitiveData_friendly.CallRpcReceivedAbilityPingInfo(teamIndex, localizedPing, spam);
}
}
#endif

public void SendPingRequestToServer(int teamIndex, Vector3 worldPosition, ActorController.PingType pingType)
{
if (GetActorController() != null)
Expand Down

0 comments on commit 7bc4829

Please sign in to comment.