class ReflectorController extends BlindingLightController
{

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

}

class ReflectorControllerPS extends BlindingLightControllerPS
{

	public override function GetActions( out outActions : array< DeviceAction >, context : GetActionsContext ) : Bool
	{
		super.GetActions( outActions, context );
		if( IsPowered() )
		{
			if( context.requestType != gamedeviceRequestType.Remote && !( m_distractExecuted ) )
			{
				outActions.PushBack( ActionToggleON() );
			}
			if( context.requestType == gamedeviceRequestType.Direct && !( m_distractExecuted ) )
			{
				outActions.PushBack( ActionDistraction() );
			}
		}
		SetActionIllegality( outActions, m_illegalActions.regularActions );
		return true;
	}

	public override function ActionToggleON() : ToggleON
	{
		var action : ToggleON;
		action = super.ActionToggleON();
		action.SetDurationValue( 9.39999962 );
		return action;
	}

	protected function ActionDistraction() : Distraction
	{
		var action : Distraction;
		action = new Distraction;
		action.SetUp( this );
		action.SetProperties();
		action.AddDeviceName( m_deviceName );
		action.SetDurationValue( GetDistractionDuration( action ) );
		action.CreateInteraction();
		return action;
	}

	public function OnDistraction( evt : Distraction ) : EntityNotificationType
	{
		if( evt.IsStarted() )
		{
			m_distractExecuted = true;
			evt.SetCanTriggerStim( true );
			ExecutePSActionWithDelay( evt, this, evt.GetDurationValue() );
		}
		else
		{
			m_distractExecuted = false;
			evt.SetCanTriggerStim( false );
		}
		UseNotifier( evt );
		if( !( IsFinal() ) )
		{
		}
		return EntityNotificationType.SendThisEventToEntity;
	}

	protected override function OnActivateDevice( evt : ActivateDevice ) : EntityNotificationType
	{
		if( m_activationState != EActivationState.ACTIVATED && IsOFF() )
		{
			super.OnActivateDevice( evt );
			ExecutePSAction( ActionToggleON() );
		}
		return EntityNotificationType.DoNotNotifyEntity;
	}

	protected override function OnDeactivateDevice( evt : DeactivateDevice ) : EntityNotificationType
	{
		if( m_activationState != EActivationState.DEACTIVATED && IsON() )
		{
			super.OnDeactivateDevice( evt );
			ExecutePSAction( ActionToggleON() );
		}
		return EntityNotificationType.DoNotNotifyEntity;
	}

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

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

}

