3 using System.Collections.Generic;
20 : base(character, objectiveManager, priorityModifier)
22 if (prioritizedItem !=
null)
29 : base(character, objectiveManager, priorityModifier)
36 if (
Targets.None()) {
return 0; }
37 if (objectiveManager.IsOrder(
this))
39 float prio = objectiveManager.GetOrderPriority(
this);
40 if (subObjectives.All(so => so.SubObjectives.None()))
52 System.Diagnostics.Debug.Assert(target.GetComponent<
Pickable>() is { } pickable && !pickable.
IsAttached,
"Invalid target in AIObjectiveCleanUpItems - the the objective should only be checking pickable, non-attached items.");
53 System.Diagnostics.Debug.Assert(target.
Prefab.
PreferredContainers.Any(),
"Invalid target in AIObjectiveCleanUpItems - the the objective should only be checking items that have preferred containers defined.");
84 if (item ==
null || item.
Removed) {
return false; }
85 if (character ==
null || character.
Removed) {
return false; }
87 if (item.
Submarine ==
null) {
return false; }
94 container.HasTag(Tags.AllowCleanup) &&
95 container.HasAccess(character) &&
96 container.ParentInventory ==
null && container.OwnInventory !=
null && container.OwnInventory.AllItems.Any() &&
99 !container.IsClaimedByBallastFlora;
101 public static bool IsValidTarget(
Item item,
Character character,
bool checkInventory,
bool allowUnloading =
true,
bool requireValidContainer =
true,
bool ignoreItemsMarkedForDeconstruction =
true)
103 if (item ==
null) {
return false; }
113 if (!allowUnloading) {
return false; }
116 if (ignoreItemsMarkedForDeconstruction &&
Item.
DeconstructItems.Contains(item)) {
return false; }
117 if (!item.
HasAccess(character)) {
return false; }
121 if (item.
LastEatenTime > Timing.TotalTimeUnpaused - 1.0) {
return false; }
122 var wire = item.GetComponent<
Wire>();
125 if (wire.Connections.Any(c => c !=
null)) {
return false; }
130 if (connectionPanel !=
null && connectionPanel.Connections.Any(c => c.Wires.Count > 0))
135 if (item.GetComponent<
Rope>() is { IsActive:
true, Snapped:
false })
144 return CanPutInInventory(character, item, allowWearing:
false);
150 foreach (var subObjective
in SubObjectives)
154 cleanUpObjective.DropTarget();
override Identifier Identifier
static bool IsValidTarget(Item item, Character character, bool checkInventory, bool allowUnloading=true, bool requireValidContainer=true, bool ignoreItemsMarkedForDeconstruction=true)
override AIObjective ObjectiveConstructor(Item item)
static bool IsValidContainer(Item container, Character character)
override bool ForceOrderPriority
static bool IsItemInsideValidSubmarine(Item item, Character character)
AIObjectiveCleanupItems(Character character, AIObjectiveManager objectiveManager, Item prioritizedItem=null, float priorityModifier=1)
readonly List< Item > prioritizedItems
override bool AllowAutomaticItemUnequipping
override bool KeepDivingGearOn
override float GetTargetPriority()
Returns a priority value based on the current targets (e.g. high prio when there's lots of severe fir...
override bool IsValidTarget(Item target)
override void OnDeselected()
override IEnumerable< Item > GetList()
List of all possible items of the specified type. Used for filtering the removed objectives.
override void OnObjectiveCompleted(AIObjective objective, Item target)
AIObjectiveCleanupItems(Character character, AIObjectiveManager objectiveManager, IEnumerable< Item > prioritizedItems, float priorityModifier=1)
An objective that creates specific kinds of subobjectives for specific types of targets,...
Dictionary< T, AIObjective > Objectives
const float RunPriority
Objectives with a priority equal to or higher than this make the character run.
static readonly List< Character > CharacterList
List< FireSource > FireSources
static bool IsActive(Character c)
static bool IsFriendly(Character me, Character other, bool onlySameTeam=false)
static IReadOnlyCollection< Item > CleanableItems
Items that may potentially need to be cleaned up (pickable, not attached to a wall,...
Inventory ParentInventory
bool? HasBallastFloraInHull
bool Illegitimate
Item shouldn't be in the player's inventory. If the guards find it, they will consider it as a theft.
float LastEatenTime
Timing.TotalTimeUnpaused when some character was last eating the item
bool DontCleanUp
Can be set by status effects to prevent bots from cleaning up the item
static HashSet< Item > DeconstructItems
Items that have been marked for deconstruction
bool HasAccess(Character character)
Used by the AI to check whether they can (in principle) and are allowed (in practice) to interact wit...
ImmutableArray< PreferredContainer > PreferredContainers
bool IsConnectedTo(Submarine otherSub)
Returns true if the sub is same as the other, or connected to it via docking ports.