If you buy more than a full box worth of stuff at the store instead of not letting you start the mission it will put the extra stuff in extra boxes for you
This commit is contained in:
@@ -110,6 +110,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
Dictionary<ItemContainer, int> availableContainers = new Dictionary<ItemContainer, int>();
|
||||
ItemPrefab containerPrefab = null;
|
||||
foreach (PurchasedItem Pi in itemsToSpawn)
|
||||
{
|
||||
Vector2 position = new Vector2(
|
||||
@@ -125,7 +126,7 @@ namespace Barotrauma
|
||||
|
||||
if (itemContainer == null)
|
||||
{
|
||||
var containerPrefab = MapEntityPrefab.List.Find(ep =>
|
||||
containerPrefab = MapEntityPrefab.List.Find(ep =>
|
||||
ep.NameMatches(Pi.itemPrefab.CargoContainerName) ||
|
||||
(ep.Tags != null && ep.Tags.Contains(Pi.itemPrefab.CargoContainerName.ToLowerInvariant()))) as ItemPrefab;
|
||||
|
||||
@@ -151,6 +152,13 @@ namespace Barotrauma
|
||||
}
|
||||
for (int i = 0; i < Pi.quantity; i++)
|
||||
{
|
||||
if (!availableContainers.ContainsKey(itemContainer))
|
||||
{
|
||||
Item containerItemOverFlow = new Item(containerPrefab, position, wp.Submarine);
|
||||
itemContainer = containerItemOverFlow.GetComponent<ItemContainer>();
|
||||
availableContainers.Add(itemContainer, itemContainer.Capacity);
|
||||
}
|
||||
|
||||
if (itemContainer == null)
|
||||
{
|
||||
//no container, place at the waypoint
|
||||
@@ -177,7 +185,8 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
//reduce the number of available slots in the container
|
||||
if (availableContainers.Count() > 0)
|
||||
//if there is a container
|
||||
if (availableContainers.ContainsKey(itemContainer))
|
||||
{
|
||||
availableContainers[itemContainer]--;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user