class ThrowStuff extends ActionBool
{

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

}

class StillageController extends ScriptableDeviceComponent
{

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

}

class StillageControllerPS extends ScriptableDeviceComponentPS
{
	private var m_isCleared : Bool;
	default m_isCleared = false;

	public override function GetActions( out actions : array< DeviceAction >, context : GetActionsContext ) : Bool
	{
		if( !( super.GetActions( actions, context ) ) )
		{
			return false;
		}
		if( m_isCleared )
		{
			return false;
		}
		if( context.requestType == gamedeviceRequestType.Direct )
		{
			actions.PushBack( ActionThrowStuff() );
		}
		return true;
	}

	public override function GetQuestActionByName( actionName : CName ) : DeviceAction
	{
		var action : DeviceAction;
		action = super.GetQuestActionByName( actionName );
		if( action == NULL )
		{
			switch( actionName )
			{
				case 'QuestResetDeviceToInitialState':
					action = ActionQuestResetDeviceToInitialState();
				break;
			}
		}
		return action;
	}

	public override function GetQuestActions( out actions : array< DeviceAction >, const context : ref< GetActionsContext > )
	{
		super.GetQuestActions( actions, context );
		actions.PushBack( ActionQuestResetDeviceToInitialState() );
	}

	protected const function ActionThrowStuff() : ThrowStuff
	{
		var action : ThrowStuff;
		action = new ThrowStuff;
		action.clearanceLevel = DefaultActionsParametersHolder.GetInteractiveClearance();
		action.SetUp( this );
		action.SetProperties();
		action.AddDeviceName( m_deviceName );
		action.CreateInteraction();
		action.SetIllegal( true );
		return action;
	}

	protected function OnThrowStuff( evt : ThrowStuff ) : EntityNotificationType
	{
		m_isCleared = true;
		UseNotifier( evt );
		return EntityNotificationType.SendThisEventToEntity;
	}

	protected override function OnQuestResetDeviceToInitialState( evt : QuestResetDeviceToInitialState ) : EntityNotificationType
	{
		m_isCleared = false;
		UseNotifier( evt );
		return EntityNotificationType.SendThisEventToEntity;
	}

}

