Generic Mission Data App
HUD element for displaying categorized mission data (timers, messages, scores) during gameplay.
HUD element for displaying categorized mission data (timers, messages, scores) during gameplay.
Overview
ui_apps_genericMissionData provides a simple interface for gameplay systems to display ordered data elements on the HUD. Elements are categorized, ordered, and sent to the UI via guihooks.trigger('SetGenericMissionData').
Extension path: lua/ge/extensions/ui/apps/genericMissionData.lua
Unload mode: Manual
Exports (M)
| Function | Signature | Description |
|---|---|---|
setData | (args) | Add/update/clear a mission data element by category. |
clearData | () | Clear all mission data and reset the UI. |
sendAllData | () | Re-send all current elements to the UI (e.g., after reconnect). |
onInit | () | Hook - sets extension unload mode to manual. |
onUpdate | () | Per-frame update hook. |
Internals
Data Structure
Mission data is stored in two tables:
missionData.elements- Keyed by category string, each holding{title, txt, order, style, minutes, seconds, milliseconds}missionData.displayOrder- Sorted array of{category, element}for ordered rendering
setData Args
ui_apps_genericMissionData.setData({
category = "timer", -- Lua pattern or exact name (default: "default")
title = "Time Left", -- Header text
txt = "01:30", -- Body text
order = -1, -- Sort priority (lower = first, default: auto-decrement)
style = "warning", -- Optional CSS class
minutes = 1, -- Optional structured time fields
seconds = 30,
milliseconds = 0,
clear = false, -- If true, removes this category
})Category Pattern Matching
The category field is matched as a Lua pattern against existing categories, allowing batch updates:
-- Clears all categories starting with "lap"
ui_apps_genericMissionData.setData({ category = "^lap", clear = true })UI Communication
On data change, elements are sent individually with their display index:
guihooks.trigger('SetGenericMissionData', {
element = item.element,
index = i
})Full reset sends SetGenericMissionDataResetAll.
Optimized Updates
If element order hasn't changed, only modified categories are re-sent to the UI. Full re-send only occurs when the sorted order changes.
How It Works
- Gameplay system calls
setData()with category, text, and ordering info - Element is stored/updated in
missionData.elements - Display order is recalculated and sorted by
orderfield - Changed elements are sent to UI via
SetGenericMissionDataguihook - UI renders elements in order with optional styling and timer fields
Additional Exports
The following exports are available but not yet documented in detail:
M.clearDataM.onInitM.onUpdateM.sendAllDataM.setData