1
Fork 0
mirror of https://github.com/thegeneralist01/Scene-Manager-DevRepo synced 2026-01-11 23:50:29 +01:00

Fix vehicles with disappearing drivers

This commit is contained in:
TheGeneralist 2025-01-05 10:44:53 +01:00
parent b6131c0b0e
commit 6bd369845e
No known key found for this signature in database
GPG key ID: C391D4D52D630F45
5 changed files with 95 additions and 32 deletions

View file

@ -0,0 +1,38 @@
using Rage;
using System.Collections.Generic;
using System.Linq;
using SceneManager.Utils;
using SceneManager.Waypoints;
using SceneManager.Paths;
namespace SceneManager.CollectedPeds
{
internal class CollectedVehicle : Vehicle
{
internal CollectedPed BoundPed;
internal CollectedVehicle(Vehicle baseVehicle, CollectedPed ped) : base(baseVehicle.Handle)
{
Handle = baseVehicle.Handle;
BoundPed = ped;
//GameFiber.StartNew(() => AssignWaypointTasks(), "Task Assignment Fiber");
}
public bool OptionalCleanUp()
{
if (!this) return true;
if (!BoundPed
|| (BoundPed && (BoundPed.IsDead || !BoundPed.CurrentVehicle || (BoundPed.CurrentVehicle && BoundPed.CurrentVehicle.Handle != Handle))))
{
if (this.IsOnFire || this.IsDead)
{
this.Repair();
}
this.Delete();
return true;
}
return false;
}
}
}