public void AddVehicle(VehicleObject v) { if (v.Name == "rpg_PlayerVehicle") { var existingPlayerVehicle = Vehicles.FirstOrDefault(vh => vh.Name == "rpg_PlayerVehicle"); var vx = Game.Player.Character.CurrentVehicle; if (existingPlayerVehicle != null && (vx == null || vx.Handle != existingPlayerVehicle.EntityHandle)) { existingPlayerVehicle.Destroy(); } RPG.PlayerData.CurrentVehicle = v.Veh; } Vehicles.Add(v); if (v.Name != "rpg_PlayerVehicle") { TreatObjectAsDeletableIfTooMany(v); } }
public void RemoveVehicle(VehicleObject veh) { Vehicles.Remove(veh); }