Added support for multiple resources
This commit is contained in:
@ -1,4 +1,6 @@
|
||||
namespace CoopServer
|
||||
using System.Linq;
|
||||
|
||||
namespace CoopServer
|
||||
{
|
||||
public struct PlayerData
|
||||
{
|
||||
@ -14,9 +16,12 @@
|
||||
LastPosition = CurrentPosition;
|
||||
CurrentPosition = value;
|
||||
|
||||
if (Server.MainResource != null && !LVector3.Equals(CurrentPosition, LastPosition))
|
||||
if (Server.Resources.Any() && !LVector3.Equals(CurrentPosition, LastPosition))
|
||||
{
|
||||
Server.MainResource.InvokePlayerPositionUpdate(this);
|
||||
foreach (Resource resource in Server.Resources)
|
||||
{
|
||||
resource.InvokePlayerPositionUpdate(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -26,9 +31,12 @@
|
||||
get => CurrentHealth;
|
||||
set
|
||||
{
|
||||
if (CurrentHealth != value && Server.MainResource != null)
|
||||
if (Server.Resources.Any() && CurrentHealth != value)
|
||||
{
|
||||
Server.MainResource.InvokePlayerHealthUpdate(this);
|
||||
foreach (Resource resource in Server.Resources)
|
||||
{
|
||||
resource.InvokePlayerHealthUpdate(this);
|
||||
}
|
||||
}
|
||||
|
||||
CurrentHealth = value;
|
||||
|
Reference in New Issue
Block a user