- EntitySpawner recursively deletes contained items when an item is deleted

- items in the inventories of the characters inside the shuttle are deleted when resetting the respawn shuttle
- fixed host's character not being taken into account when assigning jobs for respawning characters if the host is not respawning
This commit is contained in:
Regalis
2017-03-24 18:49:03 +02:00
parent ccc09560a1
commit 067db912f4
4 changed files with 32 additions and 24 deletions
+13 -2
View File
@@ -118,12 +118,23 @@ namespace Barotrauma
removeQueue.Enqueue(entity);
}
public void Update()
public void AddToRemoveQueue(Item item)
{
if (GameMain.Client != null) return;
if (!spawnQueue.Any()) return;
removeQueue.Enqueue(item);
if (item.ContainedItems == null) return;
foreach (Item containedItem in item.ContainedItems)
{
if (containedItem != null) AddToRemoveQueue(containedItem);
}
}
public void Update()
{
if (GameMain.Client != null) return;
while (spawnQueue.Count>0)
{
var entitySpawnInfo = spawnQueue.Dequeue();