From 1d3a290f9f38d610dcc7bb1bef95f78df335a0d8 Mon Sep 17 00:00:00 2001 From: James Rakich Date: Thu, 31 Aug 2017 17:48:30 +1000 Subject: [PATCH] Remove X2Effect_MindControl code for #194, as per LW1.5. Is now handled by XComGameState_Unit as per issue #286 --- .../XComGame/Classes/X2Effect_MindControl.uc | 66 ------------------- 1 file changed, 66 deletions(-) diff --git a/X2CommunityHighlander/Src/XComGame/Classes/X2Effect_MindControl.uc b/X2CommunityHighlander/Src/XComGame/Classes/X2Effect_MindControl.uc index d19026b..d66a337 100644 --- a/X2CommunityHighlander/Src/XComGame/Classes/X2Effect_MindControl.uc +++ b/X2CommunityHighlander/Src/XComGame/Classes/X2Effect_MindControl.uc @@ -1,8 +1,6 @@ class X2Effect_MindControl extends X2Effect_Persistent native(Core); // This is only native to expose it for IsMindControlled on the unit state -// Issue #194 : Modified to fix bug where ticking effects on mind-controlled units when reverted would tick on wrong playerstate - var int iNumTurnsForAI; simulated protected function OnEffectAdded(const out EffectAppliedData ApplyEffectParameters, XComGameState_BaseObject kNewTargetState, XComGameState NewGameState, XComGameState_Effect NewEffectState) @@ -81,7 +79,6 @@ simulated function OnEffectRemoved(const out EffectAppliedData ApplyEffectParame local XComGameState_Effect OriginalEffectState; local XComGameState_Unit UnitState; local StateObjectReference OriginalControllingPlayer; - local StateObjectReference MindControllingPlayer; // Issue #194 : Added for ticking effect listener updates local int i; super.OnEffectRemoved(ApplyEffectParameters, NewGameState, bCleansed, RemovedEffectState); @@ -95,7 +92,6 @@ simulated function OnEffectRemoved(const out EffectAppliedData ApplyEffectParame // now put them back on that team UnitState = XComGameState_Unit(NewGameState.CreateStateObject(class'XComGameState_Unit', ApplyEffectParameters.TargetStateObjectRef.ObjectID)); - MindControllingPlayer = UnitState.ControllingPlayer; // Issue #194 : save off the mind controlling player for ticking effect updates UnitState.SetControllingPlayer(OriginalControllingPlayer); // and update other stuff that needs to be reset when they stop being mind controlled @@ -120,69 +116,7 @@ simulated function OnEffectRemoved(const out EffectAppliedData ApplyEffectParame } NewGameState.AddStateObject(UnitState); UpdateAIData(NewGameState, UnitState); - - // For Issue #194 - UpdateTickingEffectListeners(UnitState, MindControllingPlayer, OriginalControllingPlayer); -} - -// Start Issue #194 -//PI : New helper function to re-register listeners for ticking effects -simulated function UpdateTickingEffectListeners(XComGameState_Unit UnitState, StateObjectReference StartPlayerRef, StateObjectReference EndPlayerRef ) -{ - local XComGameStateHistory History; - local X2EventManager EventMgr; - local XComGameState_Player StartPlayer, EndPlayer; - local XComGameState_Effect EffectState; - local X2Effect_Persistent EffectTemplate; - local Object ThisObj; - - History = `XCOMHISTORY; - EventMgr = `XEVENTMGR; - - StartPlayer = XComGameState_Player(History.GetGameStateForObjectID(StartPlayerRef.ObjectID)); - // if there's no listeners on this event for the mind-controlling player, opt out early - if (!EventMgr.AnyListenersForEvent('PlayerTurnBegin', StartPlayer) && !EventMgr.AnyListenersForEvent('PlayerTurnEnded', StartPlayer)) - { - return; - } - EndPlayer = XComGameState_Player(History.GetGameStateForObjectID(EndPlayerRef.ObjectID)); - foreach History.IterateByClassType(class'XComGameState_Effect', EffectState) - { - // skip if the effect target isn't the mind-controlled unit - if (EffectState.ApplyEffectParameters.TargetStateObjectRef.ObjectID != UnitState.ObjectID) - { - continue; - } - EffectTemplate = EffectState.GetX2Effect(); - // skip if effect isn't persistent or if it is the mind control effect - if (EffectTemplate == none || EffectTemplate == self) - { - continue; - } - // skip if effect is infinite or ticks every player turn start - if (EffectTemplate.bInfiniteDuration || EffectTemplate.bIgnorePlayerCheckOnTick) - { - continue; - } - // skip if it ticks every action -- basically this is for rulers - if (EffectTemplate.IsTickEveryAction(UnitState)) - { - continue; - } - ThisObj = EffectState; - if ( EffectTemplate.WatchRule == eGameRule_PlayerTurnBegin ) - { - EventMgr.UnRegisterFromEvent(ThisObj, 'PlayerTurnBegun'); - EventMgr.RegisterForEvent( ThisObj, 'PlayerTurnBegun', EffectState.OnPlayerTurnTicked, ELD_OnStateSubmitted,, EndPlayer ); - } - else if( EffectTemplate.WatchRule == eGameRule_PlayerTurnEnd ) - { - EventMgr.UnRegisterFromEvent(ThisObj, 'PlayerTurnEnded'); - EventMgr.RegisterForEvent( ThisObj, 'PlayerTurnEnded', EffectState.OnPlayerTurnTicked, ELD_OnStateSubmitted,, EndPlayer ); - } - } } -// End Issue #194 simulated function AddX2ActionsForVisualization(XComGameState VisualizeGameState, out VisualizationTrack BuildTrack, name EffectApplyResult) {