OverrideHasHeavyWeapon

Tracking Issue: #172

Tags: loadoutslots, events

The OverrideHasHeavyWeapon event allows mods to override the base game logic that determines whether a Unit has a Heavy Weapon Slot or not. Keep in mind the GetNumHeavyWeaponSlotsOverride() X2DLCInfo method may override this later.

OverrideHasHeavyWeapon event

Param Value
EventID OverrideHasHeavyWeapon
EventData XComLWTuple
EventSource XComGameState_Unit
NewGameState maybe

Tuple contents

Index Name Type Direction
0 bOverrideHasHeavyWeapon bool inout
1 bHasHeavyWeapon bool inout

Listener template

static function EventListenerReturn OnOverrideHasHeavyWeapon(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    local XComGameState_Unit UnitState;
    local XComLWTuple Tuple;
    local bool bOverrideHasHeavyWeapon;
    local bool bHasHeavyWeapon;

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

    bOverrideHasHeavyWeapon = Tuple.Data[0].b;
    bHasHeavyWeapon = Tuple.Data[1].b;

    // Your code here

    Tuple.Data[0].b = bOverrideHasHeavyWeapon;
    Tuple.Data[1].b = bHasHeavyWeapon;

    return ELR_NoInterrupt;
}

Source code references