class ToggleAOEEffect extends ActionBool
{

	public function SetProperties()
	{
		actionName = 'ToggleAOEEffect';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Bool( 'ToggleAOEEffect', true, 'LocKey#17809', 'LocKey#17809' );
	}

	public constexpr static function IsDefaultConditionMet( device : ScriptableDeviceComponentPS, const context : ref< GetActionsContext > ) : Bool
	{
		return true;
	}

}

class AOEEffectorController extends ScriptableDeviceComponent
{

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

}

class AOEEffectorControllerPS extends ActivatedDeviceControllerPS
{
	default m_tweakDBRecord = T"Devices.AOE_Effector";
	default m_tweakDBDescriptionRecord = T"device_descriptions.AOE_Effector";
	default m_revealDevicesGrid = true;
	default m_drawGridLink = false;
	default m_deviceState = EDeviceStatus.OFF;
	protected const instanceeditable persistent var m_effectsToPlay : array< CName >;

	private function ActionToggleAOEEffect() : ToggleAOEEffect
	{
		var action : ToggleAOEEffect;
		action = new ToggleAOEEffect;
		action.clearanceLevel = 1;
		action.SetUp( this );
		action.SetProperties();
		action.AddDeviceName( m_deviceName );
		action.CreateActionWidgetPackage();
		return action;
	}

	public function GetEffectsToPlay() : array< CName >
	{
		return m_effectsToPlay;
	}

	public override function GetActions( out actions : array< DeviceAction >, context : GetActionsContext ) : Bool
	{
		actions.PushBack( ActionToggleAOEEffect() );
		SetActionIllegality( actions, m_illegalActions.regularActions );
		return true;
	}

	public export function OnToggleAOEEffect( evt : ToggleAOEEffect ) : EntityNotificationType
	{
		var notifier : ActionNotifier;
		notifier = new ActionNotifier;
		notifier.SetNone();
		if( IsON() )
		{
			SetDeviceState( EDeviceStatus.OFF );
		}
		else
		{
			SetDeviceState( EDeviceStatus.ON );
		}
		Notify( notifier, evt );
		return EntityNotificationType.SendThisEventToEntity;
	}

}

