struct ReflectorSFX extends VendingMachineSFX
{
	[ customEditor = "AudioEvent" ]
	instanceeditable var m_distraction : CName;
	default m_distraction = 'dev_reflector_distraction';
	[ customEditor = "AudioEvent" ]
	instanceeditable var m_turnOn : CName;
	default m_turnOn = 'dev_reflector_turn_on_loop';
	[ customEditor = "AudioEvent" ]
	instanceeditable var m_turnOff : CName;
	default m_turnOff = 'dev_reflector_turn_on_loop_stop';
}

class BlindingLightController extends BasicDistractionDeviceController
{

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

}

class BlindingLightControllerPS extends BasicDistractionDeviceControllerPS
{
	default m_deviceName = "LocKey#168";
	default m_tweakDBRecord = T"Devices.MetroLights";
	default m_tweakDBDescriptionRecord = T"device_descriptions.MetroLights";
	protected instanceeditable var reflectorSFX : ReflectorSFX;

	protected event OnInstantiated()
	{
		super.OnInstantiated();
		if( !( IsStringValid( m_deviceName ) ) )
		{
			m_deviceName = "Gameplay-Devices-DisplayNames-MetroLights";
		}
	}

	protected override function Initialize()
	{
		super.Initialize();
	}

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

	protected override function GetQuickHackActions( out actions : array< DeviceAction >, const context : ref< GetActionsContext > )
	{
		var currentAction : ScriptableDeviceAction;
		super.GetQuickHackActions( actions, context );
		currentAction = ActionOverloadDevice();
		currentAction.SetObjectActionID( T"DeviceAction.OverloadClassHack" );
		currentAction.SetInactiveWithReason( IsPowered(), "LocKey#7013" );
		currentAction.SetInactiveWithReason( !( IsDistracting() ), "LocKey#7004" );
		actions.PushBack( currentAction );
		FinalizeGetQuickHackActions( actions, context );
	}

	public function GetDistractionSound() : CName
	{
		return reflectorSFX.m_distraction;
	}

	public function GetTurnOnSound() : CName
	{
		return reflectorSFX.m_turnOn;
	}

	public function GetTurnOffSound() : CName
	{
		return reflectorSFX.m_turnOff;
	}

	protected override function ActionOverloadDevice() : OverloadDevice
	{
		var action : OverloadDevice;
		action = super.ActionOverloadDevice();
		action.SetDurationValue( 9.39999962 );
		return action;
	}

	protected override function OnOverloadDevice( evt : OverloadDevice ) : EntityNotificationType
	{
		if( evt.IsStarted() )
		{
			ExecutePSActionWithDelay( evt, this, evt.GetDurationValue() );
			m_distractExecuted = true;
		}
		else
		{
			ForceDisableDevice();
			m_distractExecuted = false;
		}
		UseNotifier( evt );
		return EntityNotificationType.SendThisEventToEntity;
	}

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

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

}

