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:
@@ -54,13 +54,13 @@ namespace Barotrauma
|
||||
|
||||
if (container.Item.inventory == character.Inventory)
|
||||
{
|
||||
var containedItems = container.inventory.Items;
|
||||
var containedItems = container.Inventory.Items;
|
||||
//if there's already something in the mask (empty oxygen tank?), drop it
|
||||
var existingItem = containedItems.FirstOrDefault(i => i != null);
|
||||
if (existingItem != null) existingItem.Drop(character);
|
||||
|
||||
character.Inventory.RemoveItem(itemToContain);
|
||||
container.inventory.TryPutItem(itemToContain, null, false);
|
||||
container.Inventory.TryPutItem(itemToContain, null, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -90,35 +90,42 @@ namespace Barotrauma
|
||||
{
|
||||
character.Inventory.TryPutItem(targetItem, targetSlot, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (int i = 0; i<10 && currSearchIndex<Item.ItemList.Count; i++)
|
||||
for (int i = 0; i<10 && currSearchIndex<Item.ItemList.Count-2; i++)
|
||||
{
|
||||
currSearchIndex++;
|
||||
|
||||
if (!Item.ItemList[currSearchIndex].HasTag(itemName) && Item.ItemList[currSearchIndex].Name != itemName) continue;
|
||||
if (IgnoreContainedItems && Item.ItemList[currSearchIndex].container != null) continue;
|
||||
if (Item.ItemList[currSearchIndex].inventory is CharacterInventory) continue;
|
||||
|
||||
targetItem = Item.ItemList[currSearchIndex];
|
||||
|
||||
targetItem = Item.ItemList[currSearchIndex];
|
||||
|
||||
AddGoToObjective(targetItem);
|
||||
|
||||
Item moveToTarget = targetItem;
|
||||
while (moveToTarget.container != null)
|
||||
{
|
||||
moveToTarget = moveToTarget.container;
|
||||
}
|
||||
|
||||
subObjectives.Add(new AIObjectiveGoTo(moveToTarget, character));
|
||||
return;
|
||||
}
|
||||
|
||||
if (currSearchIndex >= Item.ItemList.Count) canBeCompleted = false;
|
||||
}
|
||||
|
||||
private void AddGoToObjective(Item item)
|
||||
{
|
||||
Item moveToTarget = item;
|
||||
while (moveToTarget.container != null)
|
||||
{
|
||||
moveToTarget = moveToTarget.container;
|
||||
}
|
||||
|
||||
AddSubObjective(new AIObjectiveGoTo(moveToTarget, character));
|
||||
}
|
||||
|
||||
public override bool IsDuplicate(AIObjective otherObjective)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,14 @@ namespace Barotrauma
|
||||
{
|
||||
if (repeat) return true;
|
||||
var pathSteering = character.AIController.SteeringManager as IndoorsSteeringManager;
|
||||
return (pathSteering.CurrentPath == null || !pathSteering.CurrentPath.Unreachable);
|
||||
|
||||
//path doesn't exist (= hasn't been searched for yet), assume for now that the target is reachable
|
||||
if (pathSteering.CurrentPath == null) return true;
|
||||
//steeringmanager is still targeting some other position, assume for now that the target is reachable
|
||||
if ((target != null && Vector2.Distance(target.Position, targetPos) > 5.0f) ||
|
||||
Vector2.Distance(pathSteering.CurrentTarget, targetPos) > 5.0f) return true;
|
||||
|
||||
return (!pathSteering.CurrentPath.Unreachable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user