OverrideCanEquipImplant

Tracking Issue: #1094

Tags: events

In the original CanEquipImplant function, an implant (PCS) can only be equipped if:

  • The unit has no PCS equipped OR
  • The type of the first stat on the new PCS is different from the one on the equipped PCS OR
  • The value of the first stat on the new PCS is higher than on the equipped PCS
  • Additionally, if the type of the first stat on the new PCS is Psi, the unit must be a Psi Operative

The OverrideCanEquipImplant event allows mods to override above behaviour with arbitrary logic.

OverrideCanEquipImplant event

Param Value
EventID OverrideCanEquipImplant
EventData XComLWTuple
EventSource XComGameState_Unit
NewGameState none

Tuple contents

Index Name Type Direction
0 CanEquipImplant bool inout
1 Implant XComGameState_Item in

Listener template

static function EventListenerReturn OnOverrideCanEquipImplant(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    local XComGameState_Unit UnitState;
    local XComLWTuple Tuple;
    local bool CanEquipImplant;
    local XComGameState_Item Implant;

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

    CanEquipImplant = Tuple.Data[0].b;
    Implant = XComGameState_Item(Tuple.Data[1].o);

    // Your code here

    Tuple.Data[0].b = CanEquipImplant;

    return ELR_NoInterrupt;
}

Source code references