Fixed AIObjectiveGoto terminating if previous path was unreachable, BackGroundSpriteManager won't place a sprite if a suitable position isn't found, StatusEffect fire position fix, UI improvements, door convexhull fix, progress on Fabricators & Deconstructors, mapentities sorted by category in edit mode, item descriptions, TutorialMode refactoring to make it easier to add new types of tutorials
This commit is contained in:
@@ -8,30 +8,76 @@ namespace Barotrauma
|
||||
{
|
||||
class ItemSpawner
|
||||
{
|
||||
private Queue<Pair<ItemPrefab, Vector2>> spawnQueue;
|
||||
private Queue<Pair<ItemPrefab, object>> spawnQueue;
|
||||
|
||||
public ItemSpawner()
|
||||
{
|
||||
spawnQueue = new Queue<Pair<ItemPrefab, Vector2>>();
|
||||
spawnQueue = new Queue<Pair<ItemPrefab, object>>();
|
||||
}
|
||||
|
||||
public void QueueItem(ItemPrefab itemPrefab, Vector2 position)
|
||||
{
|
||||
var itemInfo = new Pair<ItemPrefab, Vector2>();
|
||||
var itemInfo = new Pair<ItemPrefab, object>();
|
||||
itemInfo.First = itemPrefab;
|
||||
itemInfo.Second = position;
|
||||
|
||||
spawnQueue.Enqueue(itemInfo);
|
||||
}
|
||||
|
||||
public void QueueItem(ItemPrefab itemPrefab, Inventory inventory)
|
||||
{
|
||||
var itemInfo = new Pair<ItemPrefab, object>();
|
||||
itemInfo.First = itemPrefab;
|
||||
itemInfo.Second = inventory;
|
||||
|
||||
spawnQueue.Enqueue(itemInfo);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
while (spawnQueue.Count>0)
|
||||
{
|
||||
var itemInfo = spawnQueue.Dequeue();
|
||||
|
||||
if (itemInfo.Second is Vector2)
|
||||
{
|
||||
new Item(itemInfo.First, (Vector2)itemInfo.Second - Submarine.HiddenSubPosition, null);
|
||||
}
|
||||
else if (itemInfo.Second is Inventory)
|
||||
{
|
||||
|
||||
var item = new Item(itemInfo.First, Vector2.Zero, null);
|
||||
|
||||
var inventory = itemInfo.Second as Inventory;
|
||||
inventory.TryPutItem(item, null, false);
|
||||
}
|
||||
//!!!!!!!!!!!!!!!!!!!!!!
|
||||
new Item(itemInfo.First, itemInfo.Second, null);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ItemRemover
|
||||
{
|
||||
private Queue<Item> removeQueue;
|
||||
|
||||
public ItemRemover()
|
||||
{
|
||||
removeQueue = new Queue<Item>();
|
||||
}
|
||||
|
||||
public void QueueItem(Item item)
|
||||
{
|
||||
removeQueue.Enqueue(item);
|
||||
}
|
||||
|
||||
public void Update()
|
||||
{
|
||||
while (removeQueue.Count > 0)
|
||||
{
|
||||
var item = removeQueue.Dequeue();
|
||||
|
||||
item.Remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user