Untitled
class X2EventListener_GlassListener extends X2EventListener; static function array<X2DataTemplate> CreateTemplates() { local array<X2DataTemplate> Templates; Templates.AddItem(CreateMissionListener()); Templates.AddItem(CreateStratListener()); return Templates; } static final function CHEventListenerTemplate CreateMissionListener() { local CHEventListenerTemplate Template; `CREATE_X2TEMPLATE(class'CHEventListenerTemplate', Template, 'Glass_MissionListener'); Template.AddCHEvent('OverrideEncounterZoneAnchorPoint', DisableAutoAdjustingPatrolZones, ELD_Immediate); Template.AddCHEvent('OnTacticalBeginPlay', DisableInterceptAIBehavior, ELD_Immediate); Template.RegisterInTactical = true; return Template; } static final function CHEventListenerTemplate CreateStratListener() { local CHEventListenerTemplate Template; `CREATE_X2TEMPLATE(class'CHEventListenerTemplate', Template, 'Glass_StratListener'); Template.AddCHEvent('OverrideAllowStartingRegionLink', AllowOutOfContinentStartingRegionLinks, ELD_Immediate, 50); Template.RegisterInStrategy = true; return Template; } //code borrowed from LWOTC, I promise I'll bring it back later. static function EventListenerReturn DisableAutoAdjustingPatrolZones( Object EventData, Object EventSource, XComGameState NewGameState, Name InEventID, Object CallbackData) { local XComGameState_BattleData BattleData; local XComLWTuple Tuple; local Vector AnchorPoint; Tuple = XComLWTuple(EventData); if (Tuple == none) return ELR_NoInterrupt; // Sanity check. This should not happen. if (Tuple.Id != 'OverrideEncounterZoneAnchorPoint') { `REDSCREEN("Received unexpected event ID in DisableAutoAdjustingPatrolZones() event handler"); return ELR_NoInterrupt; } BattleData = XComGameState_BattleData(`XCOMHISTORY.GetSingleGameStateObjectForClass(class'XComGameState_BattleData')); AnchorPoint = BattleData.MapData.SoldierSpawnLocation; Tuple.Data[0].f = AnchorPoint.X; Tuple.Data[1].f = AnchorPoint.Y; Tuple.Data[2].f = AnchorPoint.Z; return ELR_NoInterrupt; } static function EventListenerReturn AllowOutOfContinentStartingRegionLinks( Object EventData, Object EventSource, XComGameState GameState, Name EventID, Object CallbackData) { local XComLWTuple Tuple; Tuple = XComLWTuple(EventData); if (Tuple == none) return ELR_NoInterrupt; // A starting region can be linked to any other neighbouring region. // No restrictions. Tuple.Data[1].b = true; return ELR_NoInterrupt; } static function EventListenerReturn DisableInterceptAIBehavior(Object EventData, Object EventSource, XComGameState NewGameState, Name InEventID, Object CallbackData) { local XComGameStateHistory History; local XComGameState_BattleData BattleData; local bool SubmitGameState; SubmitGameState = false; History = `XCOMHISTORY; if (NewGameState == none) { NewGameState = class'XComGameStateContext_ChangeContainer'.static.CreateChangeState("Force Disable Intercept Movement"); SubmitGameState = true; } BattleData = XComGameState_BattleData(History.GetSingleGameStateObjectForClass(class'XComGameState_BattleData')); BattleData = XComGameState_BattleData(NewGameState.ModifyStateObject(class'XComGameState_BattleData', BattleData.ObjectID)); BattleData.bKismetDisabledInterceptMovement = true; if (SubmitGameState) { `TACTICALRULES.SubmitGameState(NewGameState); } return ELR_NoInterrupt; }
Leave a Comment