MrxTaskObjectiveExtract
Module: mrxtaskobjectiveextract.lua
Overview
The MrxTaskObjectiveExtract module is responsible for handling the extraction task objective in the game. It manages the extraction process, including setting up followers, checking for allied helicopters, and handling various events related to the target’s proximity and health.
Inheritance
- Inherits from:
MrxTaskObjective - Imports:
MrxSupportData,MrxFollow,MrxUtil,MrxGui
Instance pattern
Not per-uGuid — inherits MrxTaskObjective’s class-factory pattern (itself inherited from MrxTask; see that page). Genuine per-instance fields:
self._uTgtObjFilter— the person to extract (inherited).self.oFollower— theMrxFollowescort managing the prisoner while awaiting pickup.
The extraction event handles are module-level globals, not per-instance fields:
eHeliClose,eHeliFar,uHeliHurt,eHeliFailsafe,eAIenter1,eAIenter2,_evClientJoined, andtEnterGoalare all assigned as bare globals (noself./local). Two extract objectives running at the same time would overwrite each other’s handles — this is a real latent bug in the corpus, not a per-instance design.
Functions
Activated(self)
Called when the task objective is activated. It sets default configuration values, retrieves target objects, and initializes a follower if necessary. It also creates events for object death and player join.
SendPlayerJoinEvents()
Sends player join events to the server. This function ensures that the extraction process is properly synchronized with new players joining the game.
CheckForHeli(self, uGuid)
Checks for allied helicopters in proximity to the target. If an allied helicopter is found, it sets up events for handling the extraction process.
TargetDestroyed(self, uGuid)
Cancels the part of the task related to the destroyed target.
TargetStopsForHeli(self, uGuid, tHeliExt)
Handles the scenario where the target stops for an allied helicopter. It activates the follower, sets up AI goals for entering the helicopter, and creates events for handling various extraction-related scenarios.
TargetRunsForHeli(self, uGuid, tHeliExt)
Sets up AI goals for the target to run towards the helicopter.
CheckEnter(self, tHeliExt, uGuid, nState)
Checks if the target has successfully entered the helicopter. If not, it retries entering after a short delay.
AbortExtract(self, uGuid)
Aborts the extraction process due to various failure conditions, such as the destruction of the extraction heli or the target moving too far away. It resets the prisoner’s AI goals and activates the follower again.
ResetPrisoner(self, uGuid)
Resets the prisoner’s AI goals and reactivates the follower. It also checks for allied helicopters again.
TargetIn(self, uGuid, tHeliExt, Guid, State)
Handles the scenario where the target is inside the helicopter. It completes the part of the task related to the extraction process after a short delay.
Cleanup(self)
Cleans up the module by removing the freebie associated with the extraction task and calling the base class’s cleanup function.
Events
- Listens for
Event.ObjectDeathto callTargetDestroyedwhen the target object dies. - Listens for custom event
mpPlayerJointo send player join events. - Listens for
Event.ObjectProximityto handle scenarios where the target is close or far from an allied helicopter. - Listens for
Event.ObjectHealthto handle scenarios where the extraction heli’s health drops below a certain threshold. - Listens for
Event.ObjectInSeatto handle scenarios where the target enters the helicopter.
Notes for modders
Activatedgrants a free extraction airstrike viaMrxSupportData.AddFreebie("Extraction_AL")(the Allied extraction heli), removed again inCleanup. That is what makes the pickup chopper available while the objective is live.- Extraction geometry is hardcoded (no config knobs): the heli must come within
40m to trigger the run-for-it, the run aborts if it drifts past70m or loses> 25health, with a50s failsafe timer; entering the heli completes the part after a4s delay. - Default config (via
MrxUtil.SetDefault):fDist = 40,bStop = false,bXZOnly = false,bHumansFollow = true; passoFollowerto reuse an existingMrxFollowinstead of spawning one. - Don’t run two extract objectives concurrently — see the module-globals warning above; the second would clobber the first’s heli event handles.