25 protected override void Act(
float deltaTime)
29 if (deconstructor ==
null)
31 deconstructor = FindDeconstructor();
32 if (deconstructor ==
null)
39 TryAddSubObjective(ref decontainObjective,
44 RemoveExistingWhenNecessary = true
50 if (deconstructor.Item.Submarine is { Info.IsOutpost: true })
56 RemoveSubObjective(ref decontainObjective);
67 float bestDistFactor = 0;
68 foreach (var otherItem
in Item.ItemList)
70 var potentialDeconstructor = otherItem.GetComponent<
Deconstructor>();
71 if (potentialDeconstructor?.InputContainer ==
null) {
continue; }
72 if (!potentialDeconstructor.InputContainer.Inventory.CanBePut(Item)) {
continue; }
73 if (!potentialDeconstructor.Item.HasAccess(character)) {
continue; }
74 float distFactor = GetDistanceFactor(
Item.WorldPosition, potentialDeconstructor.Item.WorldPosition, factorAtMaxDistance: 0.2f);
75 if (distFactor > bestDistFactor)
77 closestDeconstructor = potentialDeconstructor;
78 bestDistFactor = distFactor;
81 return closestDeconstructor;
84 private void StartDeconstructor()
86 deconstructor.
SetActive(active:
true, user: character, createNetworkEvent:
true);
95 else if (deconstructor !=
null && deconstructor.Item.IgnoreByAI(character))
99 return !Abandon && IsCompleted;
105 decontainObjective =
null;
110 if (
Item !=
null && character.HasItem(
Item))
override bool AllowInFriendlySubs
AIObjectiveDeconstructItem(Item item, Character character, AIObjectiveManager objectiveManager, float priorityModifier=1)
override bool AllowWhileHandcuffed
override Identifier Identifier
override bool CheckObjectiveSpecific()
Should return whether the objective is completed or not.
override void Act(float deltaTime)
readonly Character character
readonly List< AIObjective > subObjectives
readonly AIObjectiveManager objectiveManager
void HandleRelocation(Item item)
void Drop(Character dropper, bool createNetworkEvent=true, bool setTransform=true)
bool IgnoreByAI(Character character)
void SetActive(bool active, Character user=null, bool createNetworkEvent=false)
ItemContainer InputContainer
bool RelocateOutputToMainSub
Should the output items left in the deconstructor be automatically moved to the main sub at the end o...