Always sync vehicles with synced peds
This commit is contained in:
@ -3,6 +3,7 @@ using Lidgren.Network;
|
||||
using RageCoop.Client.Menus;
|
||||
using RageCoop.Core;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace RageCoop.Client
|
||||
@ -306,7 +307,7 @@ namespace RageCoop.Client
|
||||
if (c == null)
|
||||
{
|
||||
// Main.Logger.Debug($"Creating character for incoming sync:{packet.ID}");
|
||||
if (EntityPool.allPeds.Length < Main.Settings.GlobalPedSoftLimit || PlayerList.Players.ContainsKey(packet.ID))
|
||||
if (EntityPool.allPeds.Length < Main.Settings.GlobalPedSoftLimit + PlayerList.Players.Count || PlayerList.Players.ContainsKey(packet.ID))
|
||||
EntityPool.ThreadSafe.Add(c = new SyncedPed(packet.ID));
|
||||
else return;
|
||||
}
|
||||
@ -356,7 +357,7 @@ namespace RageCoop.Client
|
||||
SyncedVehicle v = EntityPool.GetVehicleByID(packet.ID);
|
||||
if (v == null)
|
||||
{
|
||||
if (EntityPool.allVehicles.Length < Main.Settings.GlobalVehicleSoftLimit)
|
||||
if (EntityPool.allVehicles.Length < Main.Settings.GlobalVehicleSoftLimit || EntityPool.PedsByID.Any(x => x.Value.Position.DistanceTo(packet.Position) < 2f))
|
||||
EntityPool.ThreadSafe.Add(v = new SyncedVehicle(packet.ID));
|
||||
else return;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ namespace RageCoop.Client
|
||||
PedsByID.Clear();
|
||||
PedsByHandle.Clear();
|
||||
|
||||
foreach (int id in new List<int>(VehiclesByID.Keys))
|
||||
foreach (int id in VehiclesByID.Keys.ToArray())
|
||||
{
|
||||
if (keepMine && (VehiclesByID[id].OwnerID == Main.LocalPlayerID)) { continue; }
|
||||
RemoveVehicle(id);
|
||||
@ -359,11 +359,11 @@ namespace RageCoop.Client
|
||||
lock (PedsLock)
|
||||
{
|
||||
AddPlayer();
|
||||
var mainCharacters = new List<PedHash> { PedHash.Michael, PedHash.Franklin, PedHash.Franklin02, PedHash.Trevor };
|
||||
|
||||
foreach (Ped p in allPeds)
|
||||
{
|
||||
SyncedPed c = GetPedByHandle(p.Handle);
|
||||
List<PedHash> mainCharacters = new List<PedHash> { PedHash.Michael, PedHash.Franklin, PedHash.Franklin02, PedHash.Trevor };
|
||||
if (c == null && p != Game.Player.Character && !mainCharacters.Contains((PedHash)p.Model.Hash))
|
||||
{
|
||||
if (allPeds.Length > Main.Settings.WorldPedSoftLimit && p.PopulationType == EntityPopulationType.RandomAmbient && !p.IsInVehicle())
|
||||
|
Reference in New Issue
Block a user