Unstable 0.17.0.0
This commit is contained in:
+16
-13
@@ -8,7 +8,7 @@ namespace Barotrauma
|
||||
{
|
||||
public const float MaxImportance = 100f;
|
||||
public const float MinImportance = 0f;
|
||||
public Order SuggestedOrderPrefab { get; }
|
||||
public Order SuggestedOrder { get; }
|
||||
|
||||
private float importance;
|
||||
public float Importance
|
||||
@@ -25,11 +25,11 @@ namespace Barotrauma
|
||||
public float CurrentRedundancy { get; set; }
|
||||
|
||||
public readonly ShipCommandManager shipCommandManager;
|
||||
public string Option { get; set; }
|
||||
public Identifier Option => SuggestedOrder.Option;
|
||||
public Character OrderedCharacter { get; set; }
|
||||
public Order CurrentOrder { get; private set; }
|
||||
public ItemComponent TargetItemComponent { get; protected set; }
|
||||
public Item TargetItem { get; protected set; }
|
||||
public ItemComponent TargetItemComponent => SuggestedOrder.TargetItemComponent;
|
||||
public Item TargetItem => SuggestedOrder.TargetEntity as Item;
|
||||
public bool Active { get; protected set; } = true; // used to turn off the instance if errors are detected
|
||||
|
||||
protected virtual Character CommandingCharacter => shipCommandManager.character;
|
||||
@@ -38,25 +38,28 @@ namespace Barotrauma
|
||||
public virtual bool StopDuringEmergency => true; // limit certain issue assessments when invaded by the enemies
|
||||
public virtual bool AllowEasySwitching => false;
|
||||
|
||||
public ShipIssueWorker(ShipCommandManager shipCommandManager, Order suggestedOrderPrefab, string option = null)
|
||||
public ShipIssueWorker(ShipCommandManager shipCommandManager, Order suggestedOrder)
|
||||
{
|
||||
this.shipCommandManager = shipCommandManager;
|
||||
SuggestedOrderPrefab = suggestedOrderPrefab;
|
||||
Option = option;
|
||||
SuggestedOrder = suggestedOrder;
|
||||
}
|
||||
|
||||
public void SetOrder(Character orderedCharacter)
|
||||
{
|
||||
OrderedCharacter = orderedCharacter;
|
||||
if (OrderedCharacter.AIController is HumanAIController humanAI && humanAI.ObjectiveManager.CurrentOrders.None(o => o.MatchesOrder(SuggestedOrderPrefab, Option)))
|
||||
if (OrderedCharacter.AIController is HumanAIController humanAI && humanAI.ObjectiveManager.CurrentOrders.None(o => o.MatchesOrder(SuggestedOrder.Identifier, Option)))
|
||||
{
|
||||
if (orderedCharacter != CommandingCharacter)
|
||||
{
|
||||
CommandingCharacter.Speak(SuggestedOrderPrefab.GetChatMessage(OrderedCharacter.Name, "", false), minDurationBetweenSimilar: 5);
|
||||
CommandingCharacter.Speak(SuggestedOrder.GetChatMessage(OrderedCharacter.Name, "", false), minDurationBetweenSimilar: 5);
|
||||
}
|
||||
CurrentOrder = new Order(SuggestedOrderPrefab, TargetItem, TargetItemComponent, CommandingCharacter);
|
||||
OrderedCharacter.SetOrder(CurrentOrder, Option, priority: CharacterInfo.HighestManualOrderPriority, CommandingCharacter, CommandingCharacter != OrderedCharacter);
|
||||
OrderedCharacter.Speak(TextManager.Get("DialogAffirmative"), delay: 1.0f, minDurationBetweenSimilar: 5);
|
||||
CurrentOrder = SuggestedOrder
|
||||
.WithOption(Option)
|
||||
.WithItemComponent(TargetItem, TargetItemComponent)
|
||||
.WithOrderGiver(CommandingCharacter)
|
||||
.WithManualPriority(CharacterInfo.HighestManualOrderPriority);
|
||||
OrderedCharacter.SetOrder(CurrentOrder, CommandingCharacter != OrderedCharacter);
|
||||
OrderedCharacter.Speak(TextManager.Get("DialogAffirmative").Value, delay: 1.0f, minDurationBetweenSimilar: 5);
|
||||
}
|
||||
TimeSinceLastAttempt = 0f;
|
||||
}
|
||||
@@ -113,7 +116,7 @@ namespace Barotrauma
|
||||
}
|
||||
|
||||
// accept only the highest priority order
|
||||
if (CurrentOrder != null && OrderedCharacter.GetCurrentOrderWithTopPriority()?.Order != CurrentOrder)
|
||||
if (CurrentOrder != null && OrderedCharacter.GetCurrentOrderWithTopPriority() != CurrentOrder)
|
||||
{
|
||||
#if DEBUG
|
||||
ShipCommandManager.ShipCommandLog($"Order {CurrentOrder.Name} did not match current order for character {OrderedCharacter} in {this}");
|
||||
|
||||
+1
-5
@@ -4,11 +4,7 @@ namespace Barotrauma
|
||||
{
|
||||
abstract class ShipIssueWorkerItem : ShipIssueWorker
|
||||
{
|
||||
public ShipIssueWorkerItem(ShipCommandManager shipCommandManager, Order order, Item targetItem, ItemComponent targetItemComponent, string option = null) : base(shipCommandManager, order, option)
|
||||
{
|
||||
TargetItemComponent = targetItemComponent;
|
||||
TargetItem = targetItem;
|
||||
}
|
||||
public ShipIssueWorkerItem(ShipCommandManager shipCommandManager, Order order) : base(shipCommandManager, order) { }
|
||||
|
||||
protected override bool IsIssueViable()
|
||||
{
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ namespace Barotrauma
|
||||
|
||||
public override bool AllowEasySwitching => true;
|
||||
|
||||
public ShipIssueWorkerOperateWeapons(ShipCommandManager shipCommandManager, Order order, Item targetItem, ItemComponent targetItemComponent) : base(shipCommandManager, order, targetItem, targetItemComponent) { }
|
||||
public ShipIssueWorkerOperateWeapons(ShipCommandManager shipCommandManager, Order order) : base(shipCommandManager, order) { }
|
||||
|
||||
float GetTargetingImportance(Entity entity)
|
||||
{
|
||||
|
||||
+1
-3
@@ -4,9 +4,7 @@ namespace Barotrauma
|
||||
{
|
||||
class ShipIssueWorkerPowerUpReactor : ShipIssueWorkerItem
|
||||
{
|
||||
public ShipIssueWorkerPowerUpReactor(ShipCommandManager shipCommandManager, Order order, Item targetItem, ItemComponent targetItemComponent, string option) : base(shipCommandManager, order, targetItem, targetItemComponent, option)
|
||||
{
|
||||
}
|
||||
public ShipIssueWorkerPowerUpReactor(ShipCommandManager shipCommandManager, Order order) : base(shipCommandManager, order) { }
|
||||
|
||||
public override void CalculateImportanceSpecific()
|
||||
{
|
||||
|
||||
+1
-1
@@ -7,7 +7,7 @@ namespace Barotrauma
|
||||
// The AI could be set to steer automatically through a specialized job or autonomous objectives
|
||||
// but the logic involved doesn't really allow that without some annoyingly specific changes
|
||||
// hence the AI will command itself to steer if steering is not being taken care of or the target location is wrong
|
||||
public ShipIssueWorkerSteer(ShipCommandManager shipCommandManager, Order order, Item targetItem, ItemComponent targetItemComponent, string option) : base(shipCommandManager, order, targetItem, targetItemComponent, option) { }
|
||||
public ShipIssueWorkerSteer(ShipCommandManager shipCommandManager, Order order) : base(shipCommandManager, order) { }
|
||||
public override void CalculateImportanceSpecific()
|
||||
{
|
||||
if (shipCommandManager.NavigationState == ShipCommandManager.NavigationStates.Inactive) { return; }
|
||||
|
||||
Reference in New Issue
Block a user