Avoid vehicle door break and repair loop

This commit is contained in:
oldnapalm
2023-11-27 10:24:35 -03:00
parent 8bd6ea15a3
commit 761156a574
2 changed files with 6 additions and 5 deletions

View File

@ -307,7 +307,8 @@ namespace RageCoop.Client
if (c == null) if (c == null)
{ {
if (EntityPool.PedsByID.Count(x => x.Value.OwnerID == packet.OwnerID) < Main.Settings.WorldPedSoftLimit / PlayerList.Players.Count || if (EntityPool.PedsByID.Count(x => x.Value.OwnerID == packet.OwnerID) < Main.Settings.WorldPedSoftLimit / PlayerList.Players.Count ||
EntityPool.VehiclesByID.Any(x => x.Value.Position.DistanceTo(packet.Position) < 2) || packet.ID == packet.OwnerID) /*EntityPool.VehiclesByID.Any(x => x.Value.Position.DistanceTo(packet.Position) < 2) ||*/ // allows players to exceed the peds limit
packet.ID == packet.OwnerID)
{ {
// Main.Logger.Debug($"Creating character for incoming sync:{packet.ID}"); // Main.Logger.Debug($"Creating character for incoming sync:{packet.ID}");
EntityPool.ThreadSafe.Add(c = new SyncedPed(packet.ID)); EntityPool.ThreadSafe.Add(c = new SyncedPed(packet.ID));

View File

@ -174,12 +174,12 @@ namespace RageCoop.Client
} }
continue; continue;
} }
else if (door.IsBroken) /*else if (door.IsBroken) // causes break/repair loop in some situations
{ {
// The vehicle can only fix a door if the vehicle was completely fixed // The vehicle can only fix a door if the vehicle was completely fixed
veh.Repair(); veh.Repair();
return; return;
} }*/
if ((model.OpenedDoors & (byte)(1 << i)) != 0) if ((model.OpenedDoors & (byte)(1 << i)) != 0)
{ {
if ((!door.IsOpen) && (!door.IsBroken)) if ((!door.IsOpen) && (!door.IsBroken))
@ -196,10 +196,10 @@ namespace RageCoop.Client
{ {
veh.Windows[(VehicleWindowIndex)i].Smash(); veh.Windows[(VehicleWindowIndex)i].Smash();
} }
else if (!veh.Windows[(VehicleWindowIndex)i].IsIntact) /*else if (!veh.Windows[(VehicleWindowIndex)i].IsIntact) // causes smash/repair loop in some situations
{ {
veh.Windows[(VehicleWindowIndex)i].Repair(); veh.Windows[(VehicleWindowIndex)i].Repair();
} }*/
} }
foreach (VehicleWheel wheel in veh.Wheels) foreach (VehicleWheel wheel in veh.Wheels)