Unstable 1.8.4.0

This commit is contained in:
Markus Isberg
2025-03-12 12:56:27 +00:00
parent a4c3e868e4
commit a4a3427e4e
627 changed files with 29860 additions and 10018 deletions
@@ -14,7 +14,8 @@ namespace Barotrauma
private Deconstructor deconstructor;
private AIObjectiveDecontainItem decontainObjective;
private AIObjectiveMoveItem moveItemObjective;
private AIObjectiveGoTo gotoObjective;
public AIObjectiveDeconstructItem(Item item, Character character, AIObjectiveManager objectiveManager, float priorityModifier = 1)
: base(character, objectiveManager, priorityModifier)
@@ -36,8 +37,8 @@ namespace Barotrauma
}
}
TryAddSubObjective(ref decontainObjective,
constructor: () => new AIObjectiveDecontainItem(character, Item, objectiveManager,
TryAddSubObjective(ref moveItemObjective,
constructor: () => new AIObjectiveMoveItem(character, Item, objectiveManager,
sourceContainer: Item.Container?.GetComponent<ItemContainer>(), targetContainer: deconstructor.InputContainer, priorityModifier: PriorityModifier)
{
Equip = true,
@@ -45,15 +46,25 @@ namespace Barotrauma
},
onCompleted: () =>
{
StartDeconstructor();
//make sure the item gets moved to the main sub if the crew leaves while a bot is deconstructing something in the outpost
if (deconstructor.Item.Submarine is { Info.IsOutpost: true })
if (character.CanInteractWith(deconstructor.Item))
{
HumanAIController.HandleRelocation(Item);
deconstructor.RelocateOutputToMainSub = true;
StartDeconstruction();
}
IsCompleted = true;
RemoveSubObjective(ref decontainObjective);
else
{
TryAddSubObjective(ref gotoObjective,
constructor: () => new AIObjectiveGoTo(Item, character, objectiveManager, priorityModifier: PriorityModifier),
onCompleted: () =>
{
StartDeconstruction();
RemoveSubObjective(ref gotoObjective);
},
onAbandon: () =>
{
Abandon = true;
});
}
RemoveSubObjective(ref moveItemObjective);
},
onAbandon: () =>
{
@@ -61,6 +72,18 @@ namespace Barotrauma
});
}
private void StartDeconstruction()
{
StartDeconstructor();
//make sure the item gets moved to the main sub if the crew leaves while a bot is deconstructing something in the outpost
if (deconstructor.Item.Submarine is { Info.IsOutpost: true })
{
HumanAIController.HandleRelocation(Item);
deconstructor.RelocateOutputToMainSub = true;
}
IsCompleted = true;
}
private Deconstructor FindDeconstructor()
{
Deconstructor closestDeconstructor = null;
@@ -86,7 +109,7 @@ namespace Barotrauma
deconstructor.SetActive(active: true, user: character, createNetworkEvent: true);
}
protected override bool CheckObjectiveSpecific()
protected override bool CheckObjectiveState()
{
if (Item.IgnoreByAI(character))
{
@@ -102,7 +125,7 @@ namespace Barotrauma
public override void Reset()
{
base.Reset();
decontainObjective = null;
moveItemObjective = null;
}
public void DropTarget()