OverrideStackedClassIcon

Tracking Issue: #1134

Tags: ui, events

Function to return the current unit's stacked class icon.

Stacked class icons are generated for faction hero units by default. Mods may want to manipulate the way a soldier's stacked class icon is displayed in more dynamic ways, or even add a stacked icon to a non-hero class.

For example, when using custom hero classes such as the Skirmisher Heavy, it would be nice to see a custom class image in the soldier list, promotion screen, and in the tactical UI.

There is one event:

OverrideStackedClassIcon event

Param Value
EventID OverrideStackedClassIcon
EventData XComLWTuple
EventSource XComGameState_Unit
NewGameState none

Tuple contents

Index Name Type Direction
0 Images array<string> inout
1 bInvertImage bool inout

Listener template

static function EventListenerReturn OnOverrideStackedClassIcon(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    local XComGameState_Unit UnitState;
    local XComLWTuple Tuple;
    local array<string> Images;
    local bool bInvertImage;

    UnitState = XComGameState_Unit(EventSource);
    Tuple = XComLWTuple(EventData);

    Images = Tuple.Data[0].as;
    bInvertImage = Tuple.Data[1].b;

    // Your code here

    Tuple.Data[0].as = Images;
    Tuple.Data[1].b = bInvertImage;

    return ELR_NoInterrupt;
}

Due to the irregularities of how StackedUIIconData is consumed, strings applied to the Images array should not start with img:///.

Source code references