fix vehicle death inventory clear
This commit is contained in:
@@ -1122,10 +1122,17 @@ namespace ReallifeGamemode.Server.Managers
|
||||
{
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
|
||||
Vehicle vehicle = NAPI.Pools.GetAllVehicles().Find(v => v.Id == id);
|
||||
ServerVehicle sV = vehicle.GetServerVehicle(dbContext);
|
||||
|
||||
var items = InventoryManager.GetVehicleItems(vehicle);
|
||||
if (items.Any())
|
||||
{
|
||||
string itemsStr = string.Join(", ", items.Select(i => $"{i.ItemId} (amount: {i.Amount})"));
|
||||
logger.LogInformation("Vehicle {0} died and lost the items: {1}", sV.Id, itemsStr);
|
||||
InventoryManager.RemoveAllItemsfromVehicleInventory(vehicle);
|
||||
}
|
||||
|
||||
if (sV is UserVehicle uV)
|
||||
{
|
||||
|
||||
@@ -1154,14 +1161,6 @@ namespace ReallifeGamemode.Server.Managers
|
||||
Vehicle newVeh = sV.Spawn(vehicle);
|
||||
newVeh.Repair();
|
||||
}
|
||||
|
||||
var items = InventoryManager.GetVehicleItems(vehicle);
|
||||
if (items.Any())
|
||||
{
|
||||
string itemsStr = string.Join(", ", items.Select(i => $"{i.ItemId} (amount: {i.Amount})"));
|
||||
logger.LogInformation("Vehicle {0} died and lost the items: {1}", sV.Id, itemsStr);
|
||||
InventoryManager.RemoveAllItemsfromVehicleInventory(vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user