API ReferenceGE Extensionsui
Mission Info
Manages mission info dialogues and activity accept popups in the UI.
Manages mission info dialogues and activity accept popups in the UI.
Overview
ui_missionInfo handles opening/closing mission information dialogues and activity accept screens. It stores button callback tables, dispatches actions by name or index, and pushes/pops the MissionUIActionMap for input handling.
Extension path: lua/ge/extensions/ui/missionInfo.lua
Exports (M)
| Function | Signature | Description |
|---|---|---|
openDialogue | (content) | Opens a mission info dialogue with optional buttons. |
closeDialogue | () | Closes the dialogue, pops action map. |
performAction | (actionName) | Executes a button's cmd by matching action name. |
openActivityAcceptDialogue | (content) | Opens the activity accept UI with multiple elements. |
performActivityAction | (id) | Calls the button function at the given index. |
setActivityIndexVisible | (index) | Fires onActivityIndexVisible with element data. |
Internals
State
M.buttonsTable- Array of{action, cmd}for mission dialogues, or indexed callbacks for activities.M.openState- Tracks"opened"/"closed"foronMissionInfoChangedStatehook.
openDialogue Flow
- Optionally pushes
MissionUIActionMap(unlesscontent.actionMap == false). - Stores
content.buttonsinM.buttonsTable. - Triggers
MissionInfoUpdatewith content. - Plays
event:>UI>Missions>Info_Open.
openActivityAcceptDialogue Flow
- Fires
onActivityAcceptUpdateextension hook andActivityAcceptUpdateguihook. - Updates
M.openStateand firesonMissionInfoChangedState.
closeDialogue Flow
- Pops
MissionUIActionMap. - Clears
buttonsTable. - Triggers
MissionInfoUpdate(nil)andActivityAcceptClose(nil). - Updates
M.openStateto"closed".
How It Works
- A mission or activity calls
openDialogueoropenActivityAcceptDialoguewith content. - The UI renders the dialogue; user clicks a button.
- UI calls
performAction(actionName)which finds the matching button and runsloadstring(button.cmd)(). - When dismissed,
closeDialoguecleans up input maps and triggers close events.
Lua Examples
-- Open a simple mission info dialogue
extensions.ui_missionInfo.openDialogue({
title = "Delivery Mission",
text = "Deliver the package to the destination.",
buttons = {
{ action = "accept", cmd = "print('accepted')" },
{ action = "decline", cmd = "print('declined')" },
}
})
-- Close the dialogue
extensions.ui_missionInfo.closeDialogue()Hooks
| Hook | Payload | When |
|---|---|---|
MissionInfoUpdate (guihook) | content or nil | Dialogue opened/closed |
ActivityAcceptUpdate (guihook) | content array | Activity accept opened |
ActivityAcceptClose (guihook) | nil | Dialogue closed |
onActivityAcceptUpdate (ext) | content | Activity accept opened |
onMissionInfoChangedState (ext) | (oldState, newState, content?) | Open/close state changes |
onActivityIndexVisible (ext) | element data or nil | Activity index selection changes |
Additional Exports
The following exports are available but not yet documented in detail:
M.closeDialogueM.elemDataTableM.openActivityAcceptDialogueM.openDialogueM.performActionM.performActivityActionM.setActivityIndexVisible