MrxSupportDesignatorSatellite
Module: mrxsupportdesignatorsatellite.lua
Overview
MrxSupportDesignatorSatellite is the most elaborate designator subtype: instead of throwing an item, the player enters a top-down PDA/satellite view and targets through a mini-game (rotating dial into success sectors). It manages zoom, radius, cost, the satellite-view enter/exit sounds, and the end/cancel/gate callback flow. Used by MrxSatelliteGuidedBomb, MrxSurgicalStrike, and MrxRocketArtillery.
Inheritance
- Inherits from:
MrxSupportDesignator - Imports:
MrxSupport,MrxGuiManager,MrxSupportManager,MrxPmc,MrxGuiSatellite,MrxSound
Instance pattern
Same class-factory pattern as MrxSupportDesignator, not per-uGuid β Create(self, oNewDesignator) builds a new table via setmetatable/__index, exactly like its parent. No OnActivate/Awake, no tInstance registry. It tracks the following key fields:
nStartZoom: Initial zoom level for the satellite view.nMinZoom: Minimum zoom level allowed.nMaxZoom: Maximum zoom level allowed.nRadius: Radius of the designated area.tSectors: Data for the mini-game sectors (if used).nCost: Cost associated with using the satellite designator.
Functions
SetZoomLimits(self, nMinZoom, nMaxZoom, nStartZoom)
Sets or updates the zoom limits and start zoom level for the satellite view. If any parameter is omitted, it defaults to the current value.
SetRadius(self, nRadius)
Sets or updates the radius of the designated area.
SetMinigameSectors(self, tSectorData)
Sets the sector data for the mini-game used in the satellite designator.
SetCost(self, nCost)
Sets or updates the cost associated with using the satellite designator.
ShouldSuppressIconAnimationOnDirectUse(self)
Returns true to suppress icon animation when the satellite designator is used directly.
Create(self, oNewDesignator)
Stamps the satellite fields (sDesignationType = "Satellite Designator") plus the zoom/radius/cost/sector values, carrying the module-level defaults through unless the prototype overrides them.
CreatesetsoNewDesignator.sAATestLevel = bilβbilis an undefined global, so this evaluates tonil. The likely intent wasnilanyway (satellite strikes leave AA-gating to the parent support /PostEndStep), so the effect is harmless, butbilis a decompile typo, not a real variable. Donβt referencebil.
Commence(self, bFireImmediately)
Begins the process of using the satellite designator. It equips the designator to the player and sets up the PDAMap mode with appropriate parameters.
GetType(self)
Returns the type of the support designator, which is "satellite".
BeginSatelliteDesignation(self)
Enters the satellite view and sets up the mini-game or direct targeting based on whether a minigame is used. It also handles callbacks for successful targeting, cancellation, and post-end steps.
SatelliteTargettingEnd(oDesignator, uGuid, x, y, z)
Handles the end of the satellite targetting process. Updates the designated location, exits the satellite view, and schedules a post-end step.
SatelliteTargettingCancel(oDesignator)
Handles the cancellation of the satellite targetting process. Exits the satellite view and resets callbacks.
PostEndStep(oDesignator)
Performs checks for AA level, fuel availability, and recruit cooldown before completing the designation.
_DelayDesignationComplete(oDesignator)
Delays the completion of the designation if the recruit is available.
DoNothing()
A trivial function that does nothing. Used as a placeholder callback.
Events
No Event.Create subscriptions. The flow is callback-driven: Commence β Airstrike.EquipDesignator(..., BeginSatelliteDesignation, ...); targeting end/cancel are registered via Player.SetPDAMapModeCallback / SetPDAMapModeCancelCallback and MrxGuiManager.SetSatelliteSuccessCallback. The only timer is a single Event.TimerRelative of 0.2s in SatelliteTargettingEnd before PostEndStep runs.
Module constants & tunables
Module-level globals (top of file) β these are real defaults you can read/override:
nStartZoom = 170,nMinZoom = 170,nMaxZoom = 170β all equal by default, i.e. zoom is locked unless a support callsSetZoomLimits.nRadius = 100β designated-area radius.tSectors = falseβ no mini-game sectors by default (direct targeting); a support sets them viaSetMinigameSectors.nCost = 5000β default satellite cost (overridden per-support: e.g.MrxSatelliteGuidedBombuses 1000,MrxSurgicalStrikeuses 0).- Satellite view audio:
MrxSound.EnterSatelliteView()/ExitSatelliteView()bracket the PDA session.
Notes for modders
- The three default zoom values are identical, so zoom does nothing until a support widens them with
SetZoomLimits(nMin, nMax, nStart)β a common βwhy wonβt it zoomβ gotcha. tSectors = falsemeans the mini-game is off unless a support supplies sectors; the number and width of sectors is the difficulty knob (compare the wide sectors inMrxSurgicalStrikevs. the narrow ones inMrxRocketArtillery).- The affordability/AA/recruit gate lives in
PostEndStep(runs 0.2s after targeting ends): it routes denials throughMrxSupport.DenialMessageand only callsCompleteDesignationif the recruit is available. _DelayDesignationCompleteandDoNothingare helpers (DoNothingis a placeholder callback handed toSetPDAMapModeCallbackafter targeting, to avoid re-entry).