ShouldCivilianRun

Tracking Issue: #666

Tags: events

Triggers a 'ShouldCivilianRun' event that allows listeners to determine whether neutrals should run in reaction to another unit moving by them. Returns true if the given neutral unit should run, false otherwise.

ShouldCivilianRun event

Param Value
EventID ShouldCivilianRun
EventData XComLWTuple
EventSource XComGameState_Unit
NewGameState none

Tuple contents

Index Name Type Direction
0 MovedUnit XComGameState_Unit in
1 AIAttacksCivilians bool in
2 ShouldRun bool inout

Listener template

static function EventListenerReturn OnShouldCivilianRun(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    local XComGameState_Unit Civilian;
    local XComLWTuple Tuple;
    local XComGameState_Unit MovedUnit;
    local bool AIAttacksCivilians;
    local bool ShouldRun;

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

    MovedUnit = XComGameState_Unit(Tuple.Data[0].o);
    AIAttacksCivilians = Tuple.Data[1].b;
    ShouldRun = Tuple.Data[2].b;

    // Your code here

    Tuple.Data[2].b = ShouldRun;

    return ELR_NoInterrupt;
}

Source code references