(fdab0615d) Recharge headset batteries between rounds in single player. Partial fix to #369.

This commit is contained in:
Joonas Rikkonen
2019-06-11 21:49:43 +03:00
parent ee1f10b482
commit 3cc9abed76

View File

@@ -256,6 +256,18 @@ namespace Barotrauma
{
if (c.Info == null || c.Inventory == null) { continue; }
var inventoryElement = new XElement("inventory");
// Recharge headset batteries
var headset = c.Inventory.FindItemByIdentifier("headset");
if (headset != null)
{
var battery = headset.OwnInventory.FindItemByTag("loadable");
if (battery != null)
{
battery.Condition = battery.MaxCondition;
}
}
c.SaveInventory(c.Inventory, inventoryElement);
c.Info.InventoryData = inventoryElement;
c.Inventory?.DeleteAllItems();