MrxTaskMission
Module: mrxtaskmission.lua
Overview
MrxTaskMission extends MrxTask with mission-specific behavior: voice-over cue tracking, PDA objective-display refreshing, and mission identity (which mission this is, its faction, its start locations). MrxTaskContract and MrxTaskJob both build directly on this.
Not the Inheritable/per-uGuid pattern — inherits MrxTask’s class-factory/lineage-based identity, not a world-object GUID.
Inheritance
- Inherits from:
MrxTask - Imports:
MrxSubtitle,MrxVoSequence,WifMissionData,WifMissionFlow,MrxTaskObjective,MrxFactionManager,MrxRewardData
Instance pattern
Class-style object (inherited from MrxTask), not per-uGuid. Per-instance field: _tVo — a list of {vSpeaker, sCueHandle} pairs for every voice-over cue played via _PlayVo, cancelled on cleanup.
_knContract = 0 / _knJob = 1 are module-level constants, not per-instance fields — they don’t appear to be referenced anywhere else in this file’s visible logic; likely used by other mission-flow code to classify a mission by type rather than something a mod would set directly.
Functions
Activated(self)
Calls MrxTask.Activated(self), then Graphics.InitTinyGeometry() and initializes self._tVo = {}.
Cleanup(self)
Removes this mission from its starter (tConfig.oStarter:RemoveMission(self), if set), cancels every pending voice-over cue in _tVo (VO.Cancel), clears pending subtitles (MrxSubtitle.ClearPending()), then defers to MrxTask.Cleanup(self) for the rest (event/timer/child cleanup).
_PlayVo(self, vSpeaker, sCueHandle, fCallback, tCallbackArgs)
Plays a voice-over cue (VO.Cue) and tracks it in _tVo so Cleanup can cancel it if the mission ends before the cue finishes.
RefreshPdaDisplay(self)
Walks the entire task subtree looking for children that look like objectives (have GetDisplayDescription/GetDescription/RefreshPdaDisplay and aren’t completed/cancelled), collects their description + inline icon, and pushes the list to WifMissionFlow.AddPdaMissionDetails. Recurses into every descendant, not just direct children.
IsContract() / IsJob()
Override points, not fixed answers. This base implementation returns false for both (mission types are neither by default) — MrxTaskContract overrides IsContract() and MrxTaskJob overrides IsJob(), confirmed directly in both files. Neither function declares a self parameter here, so calling them as self:IsContract() silently discards the passed self (Lua doesn’t error on unused extra arguments) — harmless in this base implementation since it ignores its arguments anyway and just returns a constant, but worth knowing if you’re tracing why self never appears used in these two specific functions while it’s used everywhere else in this file.
GetNumCompletions(self)
WifMissionFlow.GetKeyValue(self:GetMissionId()) or 0 — how many times this mission has been completed.
GetMissionId(self)
Returns self:GetParent():GetName() — a mission’s own ID is its parent task’s name, not something stored on the mission itself.
GetFactionId(self) / GetStartLocations(self)
Read sFactionId from config, and delegate to WifMissionFlow.GetMissionStartLocations respectively.
Events
No direct engine event subscriptions in this file — lifecycle is driven through the inherited MrxTask.Activate/Complete/Cancel calls and config-driven callbacks (see MrxTask).
Notes for modders
IsContract/IsJobare meant to be overridden, not read as fixed facts about “mission-ness” — see above. If you’re checking a task’s type, prefer calling these methods (which correctly resolve to the actual subclass’s override) over assuming everyMrxTaskMissionbehaves like this base implementation._PlayVoself-tracks for cleanup — prefer it over callingVO.Cuedirectly if you want the voice line properly cancelled should the mission end mid-cue.RefreshPdaDisplayrecurses the entire subtree, not just immediate children — a deeply nested objective structure is all still reflected on the PDA in one call.