PursuitCopter
Module: pursuitcopter.lua
Overview
The PursuitCopter module represents a pursuit helicopter that lands near the player and deploys passengers. It is part of the support system in the game, designed to provide reinforcements or additional forces during missions.
Inheritance
- Inherits from:
VehicleBlippable(βOrientedBlippableβBlippableβInheritable) - Imports:
MrxSupport
Instance pattern
This is a per-instance object module (keyed by uGuid), but pursuitcopter.lua itself defines no Create β it inherits one through the chain VehicleBlippable β OrientedBlippable β Blippable β Inheritable, none of which override Create after Inheritable, so self:Create(uGuid, uRuntimeOwner) (called from FoundPosition, line 76) resolves all the way to Inheritable.Create β the standard setmetatable/tInstance[uGuid] factory described on Resident Modules. Module-level (not per-instance) state:
tCopters: a table (used as a queue) of GUIDs for copters currently mid-LZ-search.tRetries: retry counts, keyed byuGuid.
selfhere is a module-level global set togetfenv()inStart(self = getfenv(), nolocal), not a per-instance handle.FoundPosition/FindLZ/AllOutall read that sharedself, so this module effectively assumes one pursuit copter is being processed at a time β matching the singletCopters[1]queue-head it always operates on.
Module constants & tunables
Blip cosmetics (read up the chain by Blippable.AddObjective) and the LZ-search geometry:
| Constant / value | Value | Where |
|---|---|---|
tFlash | {255, 255, 255} | radar blip flash color |
sTexture | "temp_radar_icon_helicopter" | radar blip texture |
nSize | 5 | radar blip size |
| LZ inner / outer radius | 6 / 19 | FindLZ (Ai.TestDropZone) |
| LZ inner / outer height tolerance | 1 / 2.5 | FindLZ |
| LZ max height | 20 | FindLZ |
| LZ search radius | 40 | FindLZ |
| Retry nudge toward player | +50 on Y | FoundPosition (Ai.Goal βMoveToβ) |
| Retry limit / delay | 3 attempts, 3s apart | FoundPosition / FindLZ |
The LZ geometry is built as a local oData table inside FindLZ and passed to Ai.TestDropZone β adjust it there to change how picky the copter is about where it lands.
Functions
OnActivate(uGuid, uRuntimeOwner, iArg)
Called when the object instance is activated. It sets up an event to call Start once the object leaves hibernation.
Start(uGuid, uRuntimeOwner, iArg)
Creates a new per-instance table for the object using the moduleβs prototype and attempts to find a landing zone for the pursuit copter.
FoundPosition(bFound, x, y, z)
A callback function that handles the result of finding a landing zone. If a valid LZ is found, it sets up a landing goal; otherwise, it retries or sends the copter home if too many attempts fail.
Exact retry behavior, read directly from source: 3 attempts, tracked per-uGuid in tRetries. Each failed attempt also nudges the pilot 50 units toward the player (Ai.Goal({Goal = "MoveTo", ...})) before trying again 3 seconds later. On both βno LZ found at allβ and β3 retries exhausted,β it calls MrxSupport.GoHome(self, uGuid) β the same fallback used elsewhere in the support-delivery system for βcouldnβt complete the delivery, send the vehicle awayβ (see Support & Airstrikes).
AllOut(self, uGuid, nState)
Handles the outcome of the landing goal. If successful, it deploys passengers; if not, it sends the copter home.
FindLZ(uGuid)
Attempts to find a suitable landing zone for the pursuit copter using AI functions and sets up a callback to handle the result.
Events
Event.ObjectHibernation(inOnActivate) β firesStartonce the object leaves hibernation.Event.TimerRelative(inFindLZ, on retry) β schedules anotherFindLZattempt 3 seconds later whenAi.TestDropZonefails to find a valid landing zone.FoundPositionandAllOutare notEvent.*registrations themselves β theyβre passed as bareCallbackfields toAi.TestDropZoneandAi.Goal/Ai.Deployrespectively, which are native AI functions, not theEvent.Createmechanism.
Notes for modders
- There is no local
OnDeactivatein this file β lifecycle teardown falls through to the inheritedVehicleBlippablechain.OnActivateis the only engine lifecycle callback defined here. - Customize the landing-zone pickiness by editing the
oDatageometry inFindLZ(inner/outer radius, height tolerances, search radius β table above), or the retry limit by changing the> 3check inFoundPosition. - Because the module keys almost everything off the shared
self/tCopters[1]head rather than per-uGuidstate, two pursuit copters searching for an LZ at the same time can interfere β worth knowing before you spawn several at once.