MrxTaskObjectiveAccept
Module: mrxtaskobjectiveaccept.lua
Overview
MrxTaskObjectiveAccept is a thin subclass of MrxTaskObjectiveAction that inserts a Yes/No confirmation dialog between the player pressing the interact button and the objective actually completing. Its whole reason to exist is those two overrides: _TargetActioned (pop the dialog first) and _PrintObjectiveMessage (silenced). Everything else β the context-action setup, the target/death events, the icons β is inherited unchanged from MrxTaskObjectiveAction.
Inheritance
- Inherits from:
MrxTaskObjectiveAction - Imports:
MrxGui,MrxPlayer
Instance pattern
Not per-uGuid β inherits MrxTaskObjectiveActionβs class-factory pattern (itself inherited from MrxTaskObjective/MrxTask; see that page for the general mechanism), identified by name/lineage rather than a world-object GUID. Key fields:
_bConfPromptDisplayed: A boolean indicating whether the confirmation prompt has been displayed.
Functions
_TargetActioned(self, uActionerGuid, uActioneeGuid) (override)
Overrides MrxTaskObjectiveActionβs version. Instead of immediately completing the part, it shows a Yes/No dialog via MrxGui.DisplayDialogBox (guarded by _bConfPromptDisplayed so it canβt stack) with buttons "[Generic.Yes]" / "[Generic.No]" and text from config sDialogText, defaulting to "[Generic.Accept]?". The playerβs answer is delivered to _ConfPromptDismissed.
_ConfPromptDismissed(self, uActionerGuid, uActioneeGuid, nSelectedIndex)
Dialog callback (a plain overridable function, not an event handler). Clears _bConfPromptDisplayed; if the player picked index 1 (βYesβ), it calls the base MrxTaskObjectiveAction._TargetActioned to actually complete the part. Picking βNoβ leaves the objective open so the player can be re-prompted.
_PrintObjectiveMessage(self, sMsgType) (override)
Overrides the base to an empty no-op, suppressing this objectiveβs HUD add/update/complete messages β the dialog is the whole interaction, so the standard objective banners would be noise.
Events
This subclass subscribes to no events of its own β it inherits MrxTaskObjectiveActionβs Event.ContextAction / Event.ObjectDeath subscriptions. The confirmation flow runs through a MrxGui.DisplayDialogBox callback, not an Event.* subscription.
Notes for modders
- Change the prompt text with config
sDialogText(default"[Generic.Accept]?"). Buttons are hardcoded to"[Generic.Yes]"/"[Generic.No]". - Use this instead of plain
MrxTaskObjectiveActionwhenever accepting should be a deliberate confirm rather than a single button press (e.g. picking up a job). - Depends on
MrxGuifor the dialog andMrxPlayerfor resolving the actioner to a player character; the dialog is shown toPlayer.GetCharacter(uActionerGuid).