Add Client.EntitiesCount
This commit is contained in:
parent
c201b94897
commit
203e3b2528
@ -16,7 +16,7 @@ using System.Resources;
|
||||
|
||||
|
||||
// Version informationr(
|
||||
[assembly: AssemblyVersion("1.5.1.27")]
|
||||
[assembly: AssemblyFileVersion("1.5.1.27")]
|
||||
[assembly: AssemblyVersion("1.5.1.28")]
|
||||
[assembly: AssemblyFileVersion("1.5.1.28")]
|
||||
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
|
||||
|
||||
|
@ -20,6 +20,11 @@ namespace RageCoop.Server
|
||||
{
|
||||
Server=server;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the total number of entities owned by this client
|
||||
/// </summary>
|
||||
public int EntitiesCount { get; internal set; }
|
||||
/// <summary>
|
||||
/// Th client's IP address and port.
|
||||
/// </summary>
|
||||
|
@ -15,7 +15,7 @@ using System.Resources;
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Version informationr(
|
||||
[assembly: AssemblyVersion("1.5.1.26")]
|
||||
[assembly: AssemblyFileVersion("1.5.1.26")]
|
||||
[assembly: AssemblyVersion("1.5.1.27")]
|
||||
[assembly: AssemblyFileVersion("1.5.1.27")]
|
||||
[assembly: NeutralResourcesLanguageAttribute( "en-US" )]
|
||||
|
||||
|
@ -27,6 +27,8 @@ namespace RageCoop.Server.Scripting
|
||||
{
|
||||
if (Server.Settings.WeatherTimeSync)
|
||||
{
|
||||
if (e.Client != API.Host) { e.Client.SendCustomEvent(CustomEvents.IsHost, false); return; }
|
||||
|
||||
foreach (var c in API.GetAllClients().Values)
|
||||
{
|
||||
if (c==e.Client)
|
||||
|
@ -211,11 +211,20 @@ namespace RageCoop.Server.Scripting
|
||||
ped.Owner=sender;
|
||||
ped.Health=p.Health;
|
||||
ped._rot=p.Rotation;
|
||||
ped.Owner=sender;
|
||||
if (p.Speed>=4 && Vehicles.TryGetValue(p.VehicleID,out var v))
|
||||
{
|
||||
ped.LastVehicle=v;
|
||||
}
|
||||
|
||||
if (ped.Owner != sender)
|
||||
{
|
||||
if (ped.Owner != null)
|
||||
{
|
||||
ped.Owner.EntitiesCount--;
|
||||
}
|
||||
ped.Owner = sender;
|
||||
sender.EntitiesCount++;
|
||||
}
|
||||
}
|
||||
internal void Update(Packets.VehicleSync p, Client sender)
|
||||
{
|
||||
@ -226,8 +235,16 @@ namespace RageCoop.Server.Scripting
|
||||
veh.ID=p.ID;
|
||||
}
|
||||
veh._pos = p.Position+p.Velocity*sender.Latency;
|
||||
veh.Owner=sender;
|
||||
veh._quat=p.Quaternion;
|
||||
if(veh.Owner != sender)
|
||||
{
|
||||
if (veh.Owner != null)
|
||||
{
|
||||
veh.Owner.EntitiesCount--;
|
||||
}
|
||||
veh.Owner = sender;
|
||||
sender.EntitiesCount++;
|
||||
}
|
||||
}
|
||||
internal void CleanUp(Client left)
|
||||
{
|
||||
@ -252,7 +269,11 @@ namespace RageCoop.Server.Scripting
|
||||
}
|
||||
internal void RemoveVehicle(int id)
|
||||
{
|
||||
Vehicles.TryRemove(id, out _);
|
||||
Vehicles.TryRemove(id, out var veh);
|
||||
if (veh.Owner != null)
|
||||
{
|
||||
veh.Owner.EntitiesCount--;
|
||||
}
|
||||
}
|
||||
|
||||
internal void RemoveProp(int id)
|
||||
@ -265,7 +286,11 @@ namespace RageCoop.Server.Scripting
|
||||
}
|
||||
internal void RemovePed(int id)
|
||||
{
|
||||
Peds.TryRemove(id, out _);
|
||||
Peds.TryRemove(id, out var ped);
|
||||
if (ped.Owner != null)
|
||||
{
|
||||
ped.Owner.EntitiesCount--;
|
||||
}
|
||||
}
|
||||
|
||||
internal void Add(ServerPed ped)
|
||||
|
@ -104,5 +104,11 @@
|
||||
/// The zerotier network id to join, default value is zerotier's public Earth network.
|
||||
/// </summary>
|
||||
public string ZeroTierNetworkID { get; set; } = "8056c2e21c000001";
|
||||
/*
|
||||
/// <summary>
|
||||
/// Kick godmode and spamming idiots
|
||||
/// </summary>
|
||||
public bool AntiIdiots { get; set; } = true;
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user