(3bb9485ad) Add automatic orders as objectives instead of orders so that we can take advantage of the existing priority system. Turn the priority values defined in the xml into modifiers.

This commit is contained in:
Joonas Rikkonen
2019-05-16 05:04:53 +03:00
parent 5def53f7bd
commit d0795791e7
38 changed files with 172 additions and 105 deletions
@@ -55,7 +55,6 @@ namespace Barotrauma
objectiveManager = new AIObjectiveManager(c);
objectiveManager.AddObjective(new AIObjectiveFindSafety(c));
objectiveManager.AddObjective(new AIObjectiveIdle(c));
// TODO: do this only when the player hasn't issued an order for a while
foreach (var automaticOrder in c.Info.Job.Prefab.AutomaticOrders)
{
var orderPrefab = Order.PrefabList.Find(o => o.AITag == automaticOrder.aiTag);
@@ -66,16 +65,8 @@ namespace Barotrauma
matchingItems.RemoveAll(it => it.Submarine != c.Submarine);
var item = matchingItems.GetRandom();
var order = new Order(orderPrefab, item ?? c.CurrentHull as Entity, item?.Components.FirstOrDefault(ic => ic.GetType() == orderPrefab.ItemComponentType));
SetOrder(order, automaticOrder.option, c, true);
//#if CLIENT
// GameMain.GameSession?.CrewManager?.SetCharacterOrder(c, order, automaticOrder.option, c);
//#endif
// if (GameMain.GameSession?.CrewManager != null && GameMain.GameSession.CrewManager.AddOrder(order, order.FadeOutTime))
// {
// Character.Speak(order.GetChatMessage("", Character.CurrentHull?.RoomName, givingOrderToSelf: true), ChatMessageType.Order);
// }
//SetOrder(order, automaticOrder.option, c, true);
objectiveManager.AddObjective(objectiveManager.CreateObjective(order, automaticOrder.option, c, automaticOrder.priorityModifier));
}
updateObjectiveTimer = Rand.Range(0.0f, UpdateObjectiveInterval);