[CPLUS plus ex] Extra Info UI - Redacted-Rice/ITB-RedactedRiceExts GitHub Wiki
Extra Info UI
Hangar UI that shows icons for virtual skills and optionally earned pilot skills. Positioned relative to the back_1 pilot portrait image.
Hidden in missions and when no strategy pawn / portrait is available. Updates when selection or screen size changes.
See also Events and Hooks (ExtraInfoSelectedChanged) and Skill State (getVirtualSkills, getPilotEarnedSkillIndexes).
Hangar panel
A fixed size framed panel below the selected pilot portrait. It holds a horizontal row of outlined, scaled icons with tooltips.
- Shown only in hangar/strategy UI. In mission is handled by traitReplace lib
- Anchored to
img/portraits/pilots/back_1.pngdraw position - Hidden when the selected pilot has no panel icons after rebuild
Content rebuild:
- Clears previous panel icons
- Collects virtual skill icons for the selected pilot
- Fires
ExtraInfoSelectedChangedso mods can callui:addIcon - Builds UI for all collected icons; hides the panel if none
Virtual skill icons
For the selected pilot, CPLUS+ automatically adds icons for each virtual skill that has registered icon data:
cplus_plus_ex:getVirtualSkills(pilot)cplus_plus_ex:getRegisteredSkillInfo(skillId)- If
skillInfo.iconis set,addIcon(icon, GetText(fullName), GetText(description))
Mods can append more icons in the same rebuild via onExtraInfoSelectedChanged.
Earned skill icons
When showPilotSkillIcons is enabled:
- Reads earned indexes from
cplus_plus_ex:getPilotEarnedSkillIndexes(pilot)for slots 1-2 - Resolves each skill id via
getRegisteredSkillInfo - Places icons next to hangar skill name rows (offsets adjust if the pilot has no innate skill string)
These are separate widgets from the bottom panel; they do not use addIcon.
Table of Contents
onExtraInfoSelectedChanged
Event: cplus_plus_ex.events.onExtraInfoSelectedChanged:subscribe(callback)
Hook: cplus_plus_ex:addExtraInfoSelectedChangedHook(callback)
Fired when the extra info panel is rebuilt for the selected hangar pawn (selection change or screen size change).
Arguments
| Argument name | Type | Description |
|---|---|---|
ui |
table | Extra info UI object; call ui:addIcon(...) to add icons |
pawn |
BoardPawn | Vanilla pawn of the selected strategy pawn |
pilot |
Pilot | memhack Pilot for that pawn |
Example
cplus_plus_ex.events.onExtraInfoSelectedChanged:subscribe(function(ui, pawn, pilot)
if not pilot then
return
end
ui:addIcon(
"img/combat/icons/icon_my_mod.png",
"My Extra Info",
"Shown in the hangar panel for this pilot."
)
end)
ui:addIcon
ui:addIcon(icon, title, description)
| Argument name | Type | Description |
|---|---|---|
icon |
string | Path to icon image |
title |
string | Tooltip title |
description |
string | Tooltip description |
Adds an icon to the virtual skills / extra info panel for the current rebuild. All three arguments are required; missing any skips the icon.
Tooltip text is title .. "\n\n" .. description.
Call only from an ExtraInfoSelectedChanged handler (or during the same rebuild path). Icons are cleared at the start of each rebuild.
Example:
cplus_plus_ex:addExtraInfoSelectedChangedHook(function(ui, pawn, pilot)
ui:addIcon("img/combat/icons/icon_Pilot_Health.png", "Bonus", "Custom hangar tip")
end)
showPilotSkillIcons
Mod Content generation option: "Show Pilot Skill Icons" (showPilotSkillIcons, default enabled).
Stored at runtime as:
cplus_plus_ex.config_options.showPilotSkillIcons -- boolean
When true, earned skill icons are drawn next to pilot skill names in the hangar. When false, earned icons are hidden. Does not affect the virtual skills / extra info panel.