2021-08-26 17:01:32 +02:00
|
|
|
|
namespace CoopServer
|
2021-07-07 13:36:25 +02:00
|
|
|
|
{
|
2021-08-26 17:01:32 +02:00
|
|
|
|
public struct PlayerData
|
2021-07-07 13:36:25 +02:00
|
|
|
|
{
|
|
|
|
|
public string SocialClubName { get; set; }
|
|
|
|
|
public string Username { get; set; }
|
2021-08-26 17:01:32 +02:00
|
|
|
|
private LVector3 LastPosition { get; set; }
|
|
|
|
|
private LVector3 CurrentPosition { get; set; }
|
2021-08-20 17:28:13 +02:00
|
|
|
|
public LVector3 Position
|
|
|
|
|
{
|
2021-11-25 16:32:04 +01:00
|
|
|
|
get => CurrentPosition;
|
2021-08-20 17:28:13 +02:00
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
LastPosition = CurrentPosition;
|
|
|
|
|
CurrentPosition = value;
|
|
|
|
|
|
2021-11-20 05:38:00 +01:00
|
|
|
|
if (Server.MainResource != null && !LVector3.Equals(CurrentPosition, LastPosition))
|
2021-08-20 17:28:13 +02:00
|
|
|
|
{
|
2021-11-20 05:38:00 +01:00
|
|
|
|
Server.MainResource.InvokePlayerPositionUpdate(this);
|
2021-08-20 17:28:13 +02:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-11-25 16:32:04 +01:00
|
|
|
|
private int CurrentHealth { get; set; }
|
|
|
|
|
public int Health
|
|
|
|
|
{
|
|
|
|
|
get => CurrentHealth;
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (CurrentHealth != value && Server.MainResource != null)
|
|
|
|
|
{
|
|
|
|
|
Server.MainResource.InvokePlayerHealthUpdate(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CurrentHealth = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-08-20 17:28:13 +02:00
|
|
|
|
|
|
|
|
|
public bool IsInRangeOf(LVector3 position, float distance)
|
|
|
|
|
{
|
|
|
|
|
return LVector3.Subtract(Position, position).Length() < distance;
|
|
|
|
|
}
|
2021-07-07 13:36:25 +02:00
|
|
|
|
}
|
|
|
|
|
}
|