OverrideAllowStartingRegionLink

Tracking Issue: #774

Tags: events

This event allows mods to override the default behavior for whether a region can be linked to a potential starting region. The default behavior is that the two regions must be in the same continent if they are to be linked.

To override that behavior, add a listener that has RegisterInCampaignStart set to true and within the listener function simply change the value of the AllowLink field in the given tuple data. For example, you could always set it to true to remove the constraints completely, so that a starting region can be linked to any neighboring region.

This event is triggered during a start state, which you can access via XComGameStateHistory:GetStartState().

Param Value
EventID OverrideAllowStartingRegionLink
EventData XComLWTuple
EventSource XComGameState_WorldRegion
NewGameState none

Tuple contents

Index Name Type Direction
0 LinkedRegion XComGameState_WorldRegion in
1 AllowLink bool inout

Listener template

static function EventListenerReturn OnOverrideAllowStartingRegionLink(Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackObject)
{
    local XComGameState_WorldRegion PotentialStartRegion;
    local XComLWTuple Tuple;
    local XComGameState_WorldRegion LinkedRegion;
    local bool AllowLink;

    PotentialStartRegion = XComGameState_WorldRegion(EventSource);
    Tuple = XComLWTuple(EventData);

    LinkedRegion = XComGameState_WorldRegion(Tuple.Data[0].o);
    AllowLink = Tuple.Data[1].b;

    // Your code here

    Tuple.Data[1].b = AllowLink;

    return ELR_NoInterrupt;
}

Source code references