Merge ped packet
Back to old project family (for debugging) Fix blip name Delete newly spawned traffic if limit exceeded
This commit is contained in:
@ -333,7 +333,7 @@ namespace RageCoop.Client
|
||||
allProjectiles=World.GetAllProjectiles();
|
||||
vehStatesPerFrame=allVehicles.Length*2/(int)Game.FPS+1;
|
||||
pedStatesPerFrame=allPeds.Length*2/(int)Game.FPS+1;
|
||||
|
||||
/*
|
||||
if (Main.Ticked%50==0)
|
||||
{
|
||||
bool flag1 = allVehicles.Length>Main.Settings.WorldVehicleSoftLimit && Main.Settings.WorldVehicleSoftLimit>-1;
|
||||
@ -343,7 +343,7 @@ namespace RageCoop.Client
|
||||
else if(!_trafficSpawning)
|
||||
{ SetBudget(1); _trafficSpawning=true; }
|
||||
}
|
||||
|
||||
*/
|
||||
#if BENCHMARK
|
||||
|
||||
Debug.TimeStamps[TimeStamp.GetAllEntities]=PerfCounter.ElapsedTicks;
|
||||
@ -410,6 +410,14 @@ namespace RageCoop.Client
|
||||
SyncedPed c = EntityPool.GetPedByHandle(p.Handle);
|
||||
if (c==null && (p!=Game.Player.Character))
|
||||
{
|
||||
if (allPeds.Length>Main.Settings.WorldPedSoftLimit)
|
||||
{
|
||||
if (p.PopulationType!=EntityPopulationType.RandomAmbient)
|
||||
{
|
||||
p.Delete();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Main.Logger.Trace($"Creating SyncEntity for ped, handle:{p.Handle}");
|
||||
c=new SyncedPed(p);
|
||||
|
||||
@ -446,13 +454,7 @@ namespace RageCoop.Client
|
||||
// event check
|
||||
SyncEvents.Check(c);
|
||||
|
||||
Networking.SendPed(c);
|
||||
|
||||
// Send state
|
||||
if ((i-pedStateIndex)<pedStatesPerFrame)
|
||||
{
|
||||
Networking.SendPedState(c);
|
||||
}
|
||||
Networking.SendPed(c, (i-pedStateIndex)<pedStatesPerFrame);
|
||||
#if BENCHMARK
|
||||
|
||||
Debug.TimeStamps[TimeStamp.SendPed]=PerfCounter2.ElapsedTicks-start;
|
||||
@ -489,6 +491,24 @@ namespace RageCoop.Client
|
||||
{
|
||||
if (!Handle_Vehicles.ContainsKey(veh.Handle))
|
||||
{
|
||||
if (allVehicles.Length>Main.Settings.WorldVehicleSoftLimit)
|
||||
{
|
||||
var type = veh.PopulationType;
|
||||
if (type==EntityPopulationType.RandomAmbient || type==EntityPopulationType.RandomParked)
|
||||
{
|
||||
foreach(var p in veh.Occupants)
|
||||
{
|
||||
p.Delete();
|
||||
var c = EntityPool.GetPedByHandle(p.Handle);
|
||||
if (c!=null)
|
||||
{
|
||||
EntityPool.RemovePed(c.ID,"ThrottleTraffic");
|
||||
}
|
||||
}
|
||||
veh.Delete();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Main.Logger.Debug($"Creating SyncEntity for vehicle, handle:{veh.Handle}");
|
||||
|
||||
EntityPool.Add(new SyncedVehicle(veh));
|
||||
|
Reference in New Issue
Block a user