(c48cb7804) Change the operate item priority calculation so that it starts from 25 and increases with devotion and is multiplied by the priority modifier. Clamp the result.

This commit is contained in:
Joonas Rikkonen
2019-05-16 05:06:11 +03:00
parent ff5a819ad3
commit b5db30ec72
15 changed files with 105 additions and 123 deletions
@@ -1056,6 +1056,8 @@ namespace Barotrauma
private bool IsProperlyLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub && SelectedAiTarget?.Entity == wallTarget?.Structure;
private bool IsProperlyLatchedOnSub => LatchOntoAI != null && LatchOntoAI.IsAttachedToSub && SelectedAiTarget?.Entity == wallTarget?.Structure;
//goes through all the AItargets, evaluates how preferable it is to attack the target,
//whether the Character can see/hear the target and chooses the most preferable target within
//sight/hearing range
@@ -49,7 +49,8 @@ namespace Barotrauma
{
return AIObjectiveManager.OrderPriority;
}
return base.GetPriority(objectiveManager);
float value = (Priority + (AIObjectiveManager.OrderPriority / 2)) * PriorityModifier;
return MathHelper.Clamp(value, 0, AIObjectiveManager.OrderPriority);
}
public AIObjectiveOperateItem(ItemComponent item, Character character, string option, bool requireEquip, Entity operateTarget = null, bool useController = false, float priorityModifier = 1) : base (character, option, priorityModifier)
@@ -2614,6 +2614,10 @@ namespace Barotrauma
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
#endif
#if CLIENT
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
#endif
#if CLIENT
GameMain.GameSession?.CrewManager?.RemoveCharacter(this);
#endif