class RetractableAdController extends BaseAnimatedDeviceController
{

	public const override function GetPS() : RetractableAdControllerPS
	{
		return ( ( RetractableAdControllerPS )( GetBasePS() ) );
	}

}

class RetractableAdControllerPS extends BaseAnimatedDeviceControllerPS
{
	default m_deviceName = "LocKey#196";
	default m_tweakDBRecord = T"Devices.RoadBlock";
	default m_tweakDBDescriptionRecord = T"device_descriptions.RoadBlock";
	protected var m_isControlled : Bool;

	public quest const function IsConnected() : Bool
	{
		return m_isControlled;
	}

	public quest const function IsNotConnected() : Bool
	{
		return !( m_isControlled );
	}

	protected override function GameAttached()
	{
		super.GameAttached();
		ControlledByMaster();
	}

	protected override function GetQuickHackActions( out actions : array< DeviceAction >, const context : ref< GetActionsContext > )
	{
		var currentAction : ScriptableDeviceAction;
		currentAction = ActionQuickHackToggleActivate();
		currentAction.SetObjectActionID( T"DeviceAction.ToggleStateClassHack" );
		currentAction.SetDurationValue( GetDistractionDuration( currentAction ) );
		currentAction.SetInactiveWithReason( !( IsDistracting() ), "LocKey#7004" );
		actions.PushBack( currentAction );
		currentAction = ActionQuickHackDistraction();
		currentAction.SetDurationValue( GetDistractionDuration( currentAction ) );
		currentAction.SetInactiveWithReason( !( IsDistracting() ), "LocKey#7004" );
		currentAction.SetInactiveWithReason( IsActive(), "LocKey#53172" );
		actions.PushBack( currentAction );
		FinalizeGetQuickHackActions( actions, context );
	}

	protected const override function CanCreateAnyQuickHackActions() : Bool
	{
		return true;
	}

	protected function ControlledByMaster()
	{
		var parents : array< DeviceComponentPS >;
		var i : Int32;
		GetParents( parents );
		for( i = 0; i < parents.Size(); i += 1 )
		{
			if( ( ( RoadBlockTrapControllerPS )( parents[ i ] ) ) )
			{
				m_isControlled = true;
			}
		}
	}

	public function GetTrapController() : RoadBlockTrapControllerPS
	{
		var parents : array< DeviceComponentPS >;
		var i : Int32;
		var trap : RoadBlockTrapControllerPS;
		GetParents( parents );
		for( i = 0; i < parents.Size(); i += 1 )
		{
			if( ( ( RoadBlockTrapControllerPS )( parents[ i ] ) ) )
			{
				trap = ( ( RoadBlockTrapControllerPS )( parents[ i ] ) );
			}
		}
		return trap;
	}

	protected override function GetDeviceIconTweakDBID() : TweakDBID
	{
		return T"DeviceIcons.ScreenDeviceIcon";
	}

	protected override function GetBackgroundTextureTweakDBID() : TweakDBID
	{
		return T"DeviceIcons.ScreenDeviceBackground";
	}

}

