EnterVehicle fix, reduce NPC

This commit is contained in:
Sardelka 2022-05-31 09:55:54 +08:00
parent 2181a52d6c
commit a48170fec8
4 changed files with 14 additions and 7 deletions

View File

@ -58,6 +58,10 @@ namespace RageCoop.Client
public Vector3 Rotation { get; set; }
public Vector3 Velocity { get; set; }
public abstract void Update();
public void PauseUpdate(ulong frames)
{
LastUpdated=Main.Ticked+frames;
}
}
}

View File

@ -288,7 +288,7 @@ namespace RageCoop.Client
var allProjectiles=World.GetAllProjectiles();
if (Main.Settings.WorldVehicleSoftLimit>-1)
{
if (Main.Ticked%100==0) { if (allVehicles.Length>Main.Settings.WorldVehicleSoftLimit) { SetBudget(0); } else { SetBudget(3); } }
if (Main.Ticked%100==0) { if (allVehicles.Length>Main.Settings.WorldVehicleSoftLimit) { SetBudget(0); } else { SetBudget(1); } }
}
#if BENCHMARK

View File

@ -123,12 +123,13 @@ namespace RageCoop.Client {
private static void HandleLeaveVehicle(Packets.LeaveVehicle p)
{
var ped = EntityPool.GetPedByID(p.ID)?.MainPed;
var ped = EntityPool.GetPedByID(p.ID);
var flag = LeaveVehicleFlags.None;
if (ped.MainPed?.CurrentVehicle==null) { return; }
// Bail out
if (ped?.CurrentVehicle==null) { return; }
if (ped.CurrentVehicle.Speed>5) { flag|=LeaveVehicleFlags.BailOut;}
ped.Task.LeaveVehicle(flag) ;
if (ped.MainPed.CurrentVehicle.Speed>5) { flag|=LeaveVehicleFlags.BailOut;}
ped.PauseUpdate((ulong)Game.FPS*2);
ped.MainPed.Task.LeaveVehicle(flag) ;
}
private static void HandlePedKilled(Packets.PedKilled p)
{
@ -288,6 +289,8 @@ namespace RageCoop.Client {
public static void Check(SyncedPed c)
{
Ped subject = c.MainPed;
// Check bullets
if (subject.IsShooting)
{
if (!subject.IsUsingProjectileWeapon())

View File

@ -83,8 +83,8 @@ namespace RageCoop.Client
Function.Call(Hash.SET_RANDOM_TRAINS, true);
Function.Call(Hash.SET_RANDOM_BOATS, true);
Function.Call(Hash.SET_GARBAGE_TRUCKS, true);
Function.Call(Hash.SET_PED_POPULATION_BUDGET, 3); // 0 - 3
Function.Call(Hash.SET_VEHICLE_POPULATION_BUDGET, 3); // 0 - 3
Function.Call(Hash.SET_PED_POPULATION_BUDGET, 1); // 0 - 3
Function.Call(Hash.SET_VEHICLE_POPULATION_BUDGET, 1); // 0 - 3
Function.Call(Hash.SET_ALL_VEHICLE_GENERATORS_ACTIVE);
Function.Call(Hash.SET_ALL_LOW_PRIORITY_VEHICLE_GENERATORS_ACTIVE, true);
Function.Call(Hash.SET_NUMBER_OF_PARKED_VEHICLES, -1);