Build 1.1.4.0

This commit is contained in:
Markus Isberg
2023-03-31 18:40:44 +03:00
parent efba17e0ff
commit 9470edead3
483 changed files with 17487 additions and 8548 deletions
@@ -19,8 +19,6 @@ namespace Barotrauma
private IEnumerable<Character> affectedNpcs;
private AIObjectiveGoTo gotoObjective;
public override void Update(float deltaTime)
{
if (isFinished) { return; }
@@ -33,19 +31,18 @@ namespace Barotrauma
if (Wait)
{
gotoObjective = new AIObjectiveGoTo(npc, npc, humanAiController.ObjectiveManager, repeat: true)
var gotoObjective = new AIObjectiveGoTo(
AIObjectiveGoTo.GetTargetHull(npc) as ISpatialEntity ?? npc, npc, humanAiController.ObjectiveManager, repeat: true)
{
OverridePriority = 100.0f
OverridePriority = 100.0f,
SourceEventAction = this
};
humanAiController.ObjectiveManager.AddObjective(gotoObjective);
humanAiController.ObjectiveManager.WaitTimer = 0.0f;
}
else
{
if (gotoObjective != null)
{
gotoObjective.Abandon = true;
}
AbandonGoToObjectives(humanAiController);
}
}
isFinished = true;
@@ -62,17 +59,25 @@ namespace Barotrauma
{
foreach (var npc in affectedNpcs)
{
if (npc.Removed || npc.AIController is not HumanAIController) { continue; }
if (gotoObjective != null)
{
gotoObjective.Abandon = true;
}
if (npc.Removed || npc.AIController is not HumanAIController aiController) { continue; }
AbandonGoToObjectives(aiController);
}
affectedNpcs = null;
}
isFinished = false;
}
private void AbandonGoToObjectives(HumanAIController aiController)
{
foreach (var objective in aiController.ObjectiveManager.Objectives)
{
if (objective is AIObjectiveGoTo gotoObjective && gotoObjective.SourceEventAction?.ParentEvent == ParentEvent)
{
gotoObjective.Abandon = true;
}
}
}
public override string ToDebugString()
{
return $"{ToolBox.GetDebugSymbol(isFinished)} {nameof(NPCWaitAction)} -> (NPCTag: {NPCTag.ColorizeObject()}, Wait: {Wait.ColorizeObject()})";