Can turrets really be hacked permanently

xcom-2

According to the extra ability info you get for Haywire Protocol (by clicking the little yellow question mark in the corner of the ability square in the soldier ability list),

Hacked turrets will remain under your control for the duration of the
mission, while other robotic enemies can only be controlled for a
short while.

enter image description here

However, while I was on a recent mission, I actually lost control of a hacked turret unexpectedly, which resulted in one of my soldiers taking a pretty bad hit from it.

So is the description in the screenshot actually incorrect? Or is this a bug? Or a 3rd possibility: the soldier who had hacked the turret became disoriented from a stun lancer…would that cause a soldier to lose control of a hacked turret?

Best Answer

Short version: the game is lying to you, sadly. Hacking a turret only gives you control for 3 turns, and it can be interrupted if you get disoriented.

I've experienced this myself, but to see whether it's a bug or not I pieced this together from a few places. The first is the code which sets up the mind control effect triggered when you hack the turret (X2Effect_MindControl.uc, line 37):

//Typically, mind-control should get removed when the source is impaired, like a sustained effect.
//Because mind-control impairs a unit momentarily when being added or removed,
//this means we don't have to propagate team changes if we have a mind-control train.
//(For extra fun, consider an acyclic graph of Sectoids mind-controlling each other and raising Psi Zombies.)
//-btopp 2015-10-16
if (!bInfiniteDuration)
    `XEVENTMGR.RegisterForEvent(EffectObj, 'ImpairingEffect', NewEffectState.OnSourceBecameImpaired, ELD_OnStateSubmitted, , ControllerState);

This code basically says "if the mind control effect isn't infinite in duration, remove it when the source of the effect is impaired". In your case, being impaired comes from being disoriented.

So now the question is whether hacking a turret is an infinite-duration mind control. The answer lies in X2Ability_HackRewards.uc, line 247:

bInfiniteDuration = default.CONTROL_TURRET_DURATION <= 0;
ControlEffect = class'X2StatusEffects'.static.CreateMindControlStatusEffect(default.CONTROL_TURRET_DURATION, true, bInfiniteDuration);

So the duration is infinite only if the configured value CONTROL_TURRET_DURATION is non-positive. And that value, from XComGameData_SoldierSkills.ini, is:

CONTROL_TURRET_DURATION=3

So the answer is no, hacking a turret only lasts a limited time, and because of that, it can be interrupted if the hacker is disoriented.

As to whether it's a bug? That we can't really say without a developer's input. It's clearly not the behavior documented by the ability, though.