2 using Microsoft.Xna.Framework;
3 using System.Collections.Generic;
21 private const float DelayOnRoundStart = 30.0f;
23 private const float DefaultInspectDistance = 200.0f;
27 private const float ExtendedInspectDistance = 400.0f;
31 private const float CriminalInspectDistance = 500.0f;
33 private const float CriminalInspectProbability = 1.0f;
39 private float inspectDistance = DefaultInspectDistance;
41 private float? overrideInspectProbability;
50 if (overrideInspectProbability.HasValue)
52 return overrideInspectProbability.Value;
56 if (campaign.Map?.CurrentLocation?.Reputation is { } reputation)
58 return MathHelper.Lerp(
59 campaign.Settings.PatdownProbabilityMax,
60 campaign.Settings.PatdownProbabilityMin,
61 reputation.NormalizedValue);
72 private static readonly Dictionary<Character, double> lastInspectionTimes =
new Dictionary<Character, double>();
74 private const float NormalInspectionInterval = 120.0f;
75 private const float CriminalInspectionInterval = 30.0f;
78 : base(character, objectiveManager, priorityModifier) { }
87 float inspectDist = target.
IsCriminal ? CriminalInspectDistance : inspectDistance;
88 if (Vector2.DistanceSquared(target.
WorldPosition, character.WorldPosition) > inspectDist * inspectDist) {
return false; }
89 if (lastInspectionTimes.TryGetValue(target, out
double lastInspectionTime))
91 float inspectionInterval = target.
IsCriminal ? CriminalInspectionInterval : NormalInspectionInterval;
92 if (Timing.TotalTime < lastInspectionTime + inspectionInterval)
104 if (character.IsClimbing)
110 return subObjectives.Any() ? 50 : 0;
115 lastInspectionTimes.Clear();
116 overrideInspectProbability = 1.0f;
117 inspectDistance = ExtendedInspectDistance;
124 if (Rand.Range(0.0f, 1.0f, Rand.RandSync.Unsynced) >= probabity)
126 checkStolenItemsObjective.ForceComplete();
127 lastInspectionTimes[target] = Timing.TotalTime;
129 return checkStolenItemsObjective;
132 private float checkVisibleStolenItemsTimer;
133 private const float CheckVisibleStolenItemsInterval = 5.0f;
135 public override void Update(
float deltaTime)
137 base.Update(deltaTime);
138 if (checkVisibleStolenItemsTimer > 0.0f || character.IsClimbing)
140 checkVisibleStolenItemsTimer -= deltaTime;
143 if (character.SelectedSecondaryItem?.GetComponent<
Controller>() !=
null)
146 character.SelectedSecondaryItem =
null;
152 if (target.Inventory.AllItems.Any(it => it.Illegitimate && target.HasEquippedItem(it)) &&
153 character.CanSeeTarget(target, seeThroughWindows:
true))
157 if (existingObjective ==
null)
160 lastInspectionTimes[target] = Timing.TotalTime;
164 checkVisibleStolenItemsTimer = CheckVisibleStolenItemsInterval;
169 if (target ==
null || target.
Removed) {
return false; }
171 if (target == character) {
return false; }
172 if (target.
Submarine ==
null) {
return false; }
173 if (character.
Submarine ==
null) {
return false; }
183 if (HumanAIController.IsTrueForAnyBotInTheCrew(bot =>
184 bot != HumanAIController &&
185 ((bot.ObjectiveManager.GetActiveObjective() is AIObjectiveCheckStolenItems checkObj && checkObj.Target == target) ||
186 (bot.ObjectiveManager.GetActiveObjective() is AIObjectiveCombat combatObj && combatObj.Enemy == target))))
196 lastInspectionTimes[target] = Timing.TotalTime;
override void Update(float deltaTime)
override float GetTargetPriority()
Returns a priority value based on the current targets (e.g. high prio when there's lots of severe fir...
float??? InspectProbability
Chance of inspecting a valid target. The NPC won't try to inspect that target again for NormalInspect...
override bool IgnoreUnsafeHulls
override bool IsValidTarget(Character target)
override float TargetUpdateTimeMultiplier
override void OnDeselected()
override Identifier Identifier
override float IgnoreListClearInterval
override AIObjective ObjectiveConstructor(Character target)
override void OnObjectiveCompleted(AIObjective objective, Character target)
AIObjectiveFindThieves(Character character, AIObjectiveManager objectiveManager, float priorityModifier=1)
override IEnumerable< Character > GetList()
List of all possible items of the specified type. Used for filtering the removed objectives.
An objective that creates specific kinds of subobjectives for specific types of targets,...
CharacterTeamType?? OriginalTeamID
bool IsCriminal
Do the outpost security officers treat the character as a criminal? Triggers when the character has e...
static readonly List< Character > CharacterList
virtual Vector2 WorldPosition
static GameSession?? GameSession