38f1ddb...178a853: v0.8.9.1, removed content folder
This commit is contained in:
+47
@@ -0,0 +1,47 @@
|
||||
using System.Linq;
|
||||
|
||||
namespace Barotrauma
|
||||
{
|
||||
class AIObjectiveExtinguishFires : AIObjective
|
||||
{
|
||||
public AIObjectiveExtinguishFires(Character character) :
|
||||
base(character, "")
|
||||
{
|
||||
if (!Hull.hullList.Any(h => h.FireSources.Count > 0))
|
||||
{
|
||||
character?.Speak(TextManager.Get("DialogNoFire"), null, 3.0f, "nofire", 30.0f);
|
||||
}
|
||||
}
|
||||
|
||||
public override float GetPriority(AIObjectiveManager objectiveManager)
|
||||
{
|
||||
if (objectiveManager.CurrentObjective == this)
|
||||
{
|
||||
return AIObjectiveManager.OrderPriority;
|
||||
}
|
||||
|
||||
return Hull.hullList.Count(h => h.FireSources.Count > 0) * 10;
|
||||
}
|
||||
|
||||
public override bool IsCompleted()
|
||||
{
|
||||
return !Hull.hullList.Any(h => h.FireSources.Count > 0);
|
||||
}
|
||||
|
||||
public override bool IsDuplicate(AIObjective otherObjective)
|
||||
{
|
||||
return otherObjective is AIObjectiveExtinguishFires;
|
||||
}
|
||||
|
||||
protected override void Act(float deltaTime)
|
||||
{
|
||||
foreach (Hull hull in Hull.hullList)
|
||||
{
|
||||
if (hull.FireSources.Count > 0)
|
||||
{
|
||||
AddSubObjective(new AIObjectiveExtinguishFire(character, hull));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user