class RefreshFloorDataEvent extends Event
{
	var passToEntity : Bool;
}

class RefreshFloorAuthorizationDataEvent extends Event
{
	var passToEntity : Bool;
}

class RefreshPlayerAuthorizationEvent extends Event
{
}

class LiftStatus extends BaseDeviceStatus
{
	var m_libraryName : CName;

	public function CreateActionWidgetPackage( libraryName : CName, const authorizationTextOverride : ref< String > )
	{
		m_libraryName = libraryName;
		super.CreateActionWidgetPackage();
		if( authorizationTextOverride != "" )
		{
			m_actionWidgetPackage.displayName = authorizationTextOverride;
		}
		else
		{
			m_actionWidgetPackage.displayName = "LocKey#210";
		}
	}

	public override function GetInkWidgetTweakDBID() : TweakDBID
	{
		if( m_libraryName == 'authorization' )
		{
			return T"DevicesUIDefinitions.AuthorizationBlockedActionWidget";
		}
		else
		{
			return T"DevicesUIDefinitions.LiftDisabledActionWidget";
		}
	}

}

class GoToFloor extends ActionBool
{

	public function SetProperties( floor : Int32 )
	{
		actionName = 'GoToFloor';
		prop = DeviceActionPropertyFunctions.SetUpProperty_ElevatorInt( 'floorNumber', floor, floor );
	}

	public const override function GetCurrentDisplayString() : String
	{
		return GetProperDisplayFloorNumber( ( ( Int32 )prop.second ) );
	}

	private const function GetProperDisplayFloorNumber( floor : Int32 ) : String
	{
		var displayFloor : String;
		if( floor < 10 )
		{
			displayFloor = "0" + ( ( String )( floor ) );
		}
		else
		{
			displayFloor = ( ( String )( floor ) );
		}
		return displayFloor;
	}

	public static function IsDefaultConditionMet( device : ScriptableDeviceComponentPS, const context : ref< GetActionsContext > ) : Bool
	{
		if( ( IsAvailable( device ) && IsClearanceValid( context.clearance ) ) && IsContextValid( context ) )
		{
			return true;
		}
		return false;
	}

	public static function IsAvailable( device : ScriptableDeviceComponentPS ) : Bool
	{
		if( device.IsDisabled() )
		{
			return false;
		}
		if( device.IsUnpowered() )
		{
			return false;
		}
		if( device.IsDeviceSecured() )
		{
			return false;
		}
		if( !( device.IsON() ) )
		{
			return false;
		}
		return true;
	}

	public static function IsClearanceValid( clearance : Clearance ) : Bool
	{
		if( Clearance.IsInRange( clearance, DefaultActionsParametersHolder.GetInteractiveClearance() ) )
		{
			return true;
		}
		return false;
	}

	public static function IsContextValid( const context : ref< GetActionsContext > ) : Bool
	{
		if( context.requestType == gamedeviceRequestType.Internal )
		{
			return true;
		}
		return false;
	}

	public override function GetTweakDBChoiceRecord() : String
	{
		return "go_to_floor";
	}

	public override function GetInkWidgetLibraryPath() : ResRef
	{
		return R"";
	}

	public constexpr function GetInkWidgetLibraryID( numberOfFloors : Int32 ) : CName
	{
		return '';
	}

	public function GetInkWidgetTweakDBID( numberOfFloors : Int32, currentFloor : Int32 ) : TweakDBID
	{
		if( currentFloor == ( ( Int32 )prop.second ) )
		{
			return T"DevicesUIDefinitions.GoToFloorCurrentActionWidget";
		}
		else
		{
			return T"DevicesUIDefinitions.GoToFloorActionWidget";
		}
	}

	public function CreateActionWidgetPackage( numberOfFloors : Int32, currentFloor : Int32, displayFloor : String, IsAuthorized : Bool, optional actions : array< DeviceAction > )
	{
		super.CreateActionWidgetPackage( actions );
		if( !( IsStringValid( displayFloor ) ) )
		{
			displayFloor = GetCurrentDisplayString();
		}
		m_actionWidgetPackage.libraryID = GetInkWidgetLibraryID( numberOfFloors );
		m_actionWidgetPackage.widgetName = ( ( String )( GetActionName() ) ) + displayFloor;
		m_actionWidgetPackage.displayName = displayFloor;
		m_actionWidgetPackage.widgetTweakDBID = GetInkWidgetTweakDBID( numberOfFloors, currentFloor );
		if( !( IsAuthorized ) )
		{
			m_actionWidgetPackage.isWidgetInactive = true;
			m_actionWidgetPackage.widgetTweakDBID = T"DevicesUIDefinitions.GoToFloorActionWidget";
			m_actionWidgetPackage.displayName = "LocKey#1312";
		}
		ResolveActionWidgetTweakDBData();
	}

}

class QuestGoToFloor extends ActionInt
{

	public function SetProperties( floor : Int32 )
	{
		actionName = 'GoToFloor';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Int( 'floorNumber', floor );
	}

}

class QuestForceGoToFloor extends ActionInt
{

	public function SetProperties( floor : Int32 )
	{
		actionName = 'ForceGoToFloor';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Int( 'floorNumber', floor );
	}

}

class QuestForceTeleportToFloor extends ActionInt
{

	public function SetProperties( floor : Int32 )
	{
		actionName = 'ForceTeleportToFloor';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Int( 'Floor', floor );
	}

}

class QuestStopElevator extends ActionBool
{

	public function SetProperties()
	{
		actionName = 'QuestStopElevator';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Bool( 'QuestStopElevator', true, 'QuestStopElevator', 'QuestStopElevator' );
	}

}

class QuestResumeElevator extends ActionBool
{

	public function SetProperties()
	{
		actionName = 'QuestResumeElevator';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Bool( 'QuestResumeElevator', true, 'QuestResumeElevator', 'QuestResumeElevator' );
	}

}

class QuestShowFloor extends ActionInt
{

	public function SetProperties( floor : Int32 )
	{
		actionName = 'ShowFloor';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Int( 'floorNumber', floor );
	}

}

class QuestHideFloor extends ActionInt
{

	public function SetProperties( floor : Int32 )
	{
		actionName = 'HideFloor';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Int( 'floorNumber', floor );
	}

}

class QuestSetFloorActive extends ActionInt
{

	public function SetProperties( floor : Int32 )
	{
		actionName = 'SetFloorActive';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Int( 'floorNumber', floor );
	}

}

class QuestSetFloorInactive extends ActionInt
{

	public function SetProperties( floor : Int32 )
	{
		actionName = 'SetFloorInactive';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Int( 'floorNumber', floor );
	}

}

class QuestSetLiftSpeed extends ActionFloat
{

	public function SetProperties( speed : Float )
	{
		actionName = 'SetLiftSpeed';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Float( 'LiftSpeed', speed );
	}

}

class QuestSetLiftTravelTimeOverride extends ActionFloat
{

	public function SetProperties( speed : Float )
	{
		actionName = 'QuestSetLiftTravelTimeOverride';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Float( 'LiftTravelTimeOverride', speed );
	}

}

class QuestEnableLiftTravelTimeOverride extends ActionBool
{

	public function SetProperties( toggle : Bool )
	{
		actionName = 'QuestEnableLiftTravelTimeOverride';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Bool( 'QuestEnableLiftTravelTimeOverride', toggle, 'QuestEnableLiftTravelTimeOverride', 'QuestEnableLiftTravelTimeOverride' );
	}

}

class QuestDisableLiftTravelTimeOverride extends ActionBool
{

	public function SetProperties( toggle : Bool )
	{
		actionName = 'QuestDisableLiftTravelTimeOverride';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Bool( 'QuestDisableLiftTravelTimeOverride', toggle, 'QuestDisableLiftTravelTimeOverride', 'QuestDisableLiftTravelTimeOverride' );
	}

}

struct EffectFiringData
{
	instanceeditable var m_FXTime : Float;
	instanceeditable var m_VFX : CName;
	[ customEditor = "AudioEvent" ]
	instanceeditable var m_SFX : CName;
}

struct LiftSetup
{
	instanceeditable persistent var m_startingFloorTerminal : Int32;
	default m_startingFloorTerminal = 0;
	instanceeditable var m_liftSpeed : Float;
	default m_liftSpeed = 2.5f;
	editable var m_liftStartingDelay : Float;
	default m_liftStartingDelay = 1.f;
	instanceeditable var m_liftTravelTimeOverride : Float;
	default m_liftTravelTimeOverride = 4.f;
	instanceeditable var m_isLiftTravelTimeOverride : Bool;
	default m_isLiftTravelTimeOverride = false;
	instanceeditable var m_emptyLiftSpeedMultiplier : Float;
	default m_emptyLiftSpeedMultiplier = 2.f;
	instanceeditable persistent var m_radioStationNumer : Int32;
	default m_radioStationNumer = -1;
	instanceeditable var m_speakerDestroyedQuestFact : CName;
	instanceeditable var m_speakerDestroyedVFX : CName;
	instanceeditable var m_authorizationTextOverride : String;
	instanceeditable var m_movingCurve : CName;
	default m_movingCurve = 'cosine';
	instanceeditable var m_extraFX : EffectFiringData;
	instanceeditable var m_useExtraVerification : Bool;
	default m_useExtraVerification = false;
	instanceeditable var m_errorMargin : Float;
	default m_errorMargin = 7.0f;
}

class LiftController extends MasterController
{

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

}

class LiftControllerPS extends MasterControllerPS
{
	default m_deviceName = "LocKey#101";
	default m_tweakDBRecord = T"Devices.LiftDevice";
	default m_tweakDBDescriptionRecord = T"device_descriptions.LiftDevice";
	default m_disableQuickHacks = true;
	protected instanceeditable persistent var m_liftSetup : LiftSetup;
	private persistent var m_activeFloor : Int32;
	private var m_targetFloor : Int32;
	default m_targetFloor = -1;
	private persistent var m_movementState : gamePlatformMovementState;
	private persistent var m_floors : array< ElevatorFloorSetup >;
	private persistent var m_floorIDs : array< EntityID >;
	private persistent var m_floorPSIDs : array< PersistentID >;
	private persistent var m_floorsAuthorization : array< Bool >;
	private persistent var m_timeOnPause : Float;
	private var m_isPlayerInsideLift : Bool;
	private var m_isPlayerInsideLift_RealOne : Bool;
	private persistent var m_isSpeakerDestroyed : Bool;
	private var m_hasSpeaker : Bool;
	private persistent var m_cachedGoToFloorAction : Int32;
	default m_cachedGoToFloorAction = -1;
	private persistent var m_isAllDoorsClosed : Bool;
	private persistent var m_isAdsDisabled : Bool;

	protected event OnInstantiated()
	{
		super.OnInstantiated();
		if( !( IsStringValid( m_deviceName ) ) )
		{
			m_deviceName = "LocKey#101";
		}
	}

	protected override function Initialize()
	{
		super.Initialize();
		m_activeFloor = m_liftSetup.m_startingFloorTerminal;
	}

	protected override function GameAttached()
	{
		InitializeFloorsData();
	}

	public const override function IsPlayerAuthorized() : Bool
	{
		if( PreventionSystem.IsChasingPlayer( GetGameInstance() ) )
		{
			return false;
		}
		return super.IsPlayerAuthorized();
	}

	protected override function GetInkWidgetTweakDBID( const context : ref< GetActionsContext > ) : TweakDBID
	{
		return T"DevicesUIDefinitions.ElevatorFloorDeviceWidget";
	}

	public const function GetStartingFloor() : Int32
	{
		return m_liftSetup.m_startingFloorTerminal;
	}

	public function SetStartingFloor( terminalNumber : Int32 )
	{
		m_liftSetup.m_startingFloorTerminal = terminalNumber;
	}

	public const function GetLiftSpeed() : Float
	{
		if( IsPlayerInsideLift() )
		{
			return m_liftSetup.m_liftSpeed;
		}
		else
		{
			return m_liftSetup.m_emptyLiftSpeedMultiplier * m_liftSetup.m_liftSpeed;
		}
	}

	public const function GetLiftTravelTimeOverride() : Float
	{
		return m_liftSetup.m_liftTravelTimeOverride;
	}

	public const function ShouldUseExtraVerification() : Bool
	{
		return m_liftSetup.m_useExtraVerification;
	}

	public const function GetExtraVerificationErrorMargin() : Float
	{
		return m_liftSetup.m_errorMargin;
	}

	public const function HasSpeaker() : Bool
	{
		return m_hasSpeaker;
	}

	public const function IsAdsDisabled() : Bool
	{
		return m_isAdsDisabled;
	}

	public const function IsAdsEnabled() : Bool
	{
		return !( m_isAdsDisabled );
	}

	public function SetHasSpeaker( value : Bool )
	{
		m_hasSpeaker = value;
	}

	public const function GetCachedGoToFloorAction() : Int32
	{
		return m_cachedGoToFloorAction;
	}

	public function SetCachedGoToFloorAction( value : Int32 )
	{
		m_cachedGoToFloorAction = value;
	}

	public function GetSpeakerDestroyedQuestFact() : CName
	{
		return m_liftSetup.m_speakerDestroyedQuestFact;
	}

	public function GetSpeakerDestroyedVFX() : CName
	{
		return m_liftSetup.m_speakerDestroyedVFX;
	}

	public function GetMovingCurve() : CName
	{
		return m_liftSetup.m_movingCurve;
	}

	public function GetExtraFX() : EffectFiringData
	{
		return m_liftSetup.m_extraFX;
	}

	public function IsAllDoorsClosed() : Bool
	{
		return m_isAllDoorsClosed;
	}

	public function IsSpeakerDestroyed() : Bool
	{
		return m_isSpeakerDestroyed;
	}

	public function SetSpeakerDestroyed( value : Bool )
	{
		m_isSpeakerDestroyed = value;
	}

	public const function GetActiveRadioStationNumber() : Int32
	{
		return m_liftSetup.m_radioStationNumer;
	}

	public quest const function IsLiftTravelTimeOverride() : Bool
	{
		return m_liftSetup.m_isLiftTravelTimeOverride;
	}

	public const function GetLiftStartingDelay() : Float
	{
		return m_liftSetup.m_liftStartingDelay;
	}

	public const function GetFloorID( number : Int32 ) : EntityID
	{
		return m_floorIDs[ number ];
	}

	public const function GetFloorPSID( number : Int32 ) : PersistentID
	{
		return m_floorPSIDs[ number ];
	}

	public const function GetFloors() : array< ElevatorFloorSetup >
	{
		return m_floors;
	}

	public const function GetFloorMarker( floorNumber : Int32 ) : NodeRef
	{
		return m_floors[ floorNumber ].m_floorMarker;
	}

	public const function GetTargetFloor() : Int32
	{
		return m_targetFloor;
	}

	public function SetIsPlayerInsideLift( state : Bool )
	{
		m_isPlayerInsideLift_RealOne = state;
	}

	public quest const function IsPlayerInsideLift() : Bool
	{
		return m_isPlayerInsideLift_RealOne;
	}

	public function ChangeActiveFloor( newFloor : Int32 )
	{
		m_activeFloor = newFloor;
		m_targetFloor = -1;
		ForcePersistentStateChanged();
	}

	public function ActionGoToFloor( numberOfFloors : Int32, currentFloor : Int32, floor : Int32, const displayFloor : ref< String >, IsAuthorized : Bool ) : GoToFloor
	{
		var action : GoToFloor;
		action = new GoToFloor;
		action.clearanceLevel = DefaultActionsParametersHolder.GetInteractiveClearance();
		action.SetUp( this );
		action.SetProperties( floor );
		action.AddDeviceName( m_deviceName );
		action.CreateActionWidgetPackage( numberOfFloors, currentFloor, displayFloor, IsAuthorized );
		return action;
	}

	private function ActionCallElevator( isElevatorAtThisFloor : Bool, destination : Int32 ) : CallElevator
	{
		var action : CallElevator;
		action = new CallElevator;
		action.clearanceLevel = DefaultActionsParametersHolder.GetInteractiveClearance();
		action.SetUp( this );
		action.SetProperties( destination );
		action.AddDeviceName( m_deviceName );
		action.CreateActionWidgetPackage( isElevatorAtThisFloor );
		return action;
	}

	public function ActionQuickHackAuthorization() : QuickHackAuthorization
	{
		var action : QuickHackAuthorization;
		action = new QuickHackAuthorization;
		action.clearanceLevel = DefaultActionsParametersHolder.GetInteractiveClearance();
		action.SetUp( this );
		action.AddDeviceName( m_deviceName );
		action.CreateInteraction();
		return action;
	}

	public function ActionQuestShowFloor() : QuestShowFloor
	{
		var action : QuestShowFloor;
		action = new QuestShowFloor;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties( -9999 );
		action.AddDeviceName( m_deviceName );
		return action;
	}

	public function ActionQuestHideFloor() : QuestHideFloor
	{
		var action : QuestHideFloor;
		action = new QuestHideFloor;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties( -9999 );
		action.AddDeviceName( m_deviceName );
		return action;
	}

	public function ActionQuestSetFloorActive() : QuestSetFloorActive
	{
		var action : QuestSetFloorActive;
		action = new QuestSetFloorActive;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties( -9999 );
		action.AddDeviceName( m_deviceName );
		return action;
	}

	public function ActionQuestSetFloorInactive() : QuestSetFloorInactive
	{
		var action : QuestSetFloorInactive;
		action = new QuestSetFloorInactive;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties( -9999 );
		action.AddDeviceName( m_deviceName );
		return action;
	}

	public function ActionQuestSetRadioStation() : QuestSetRadioStation
	{
		var action : QuestSetRadioStation;
		action = new QuestSetRadioStation;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties( -9999 );
		action.AddDeviceName( m_deviceName );
		return action;
	}

	public function ActionQuestDisableRadio() : QuestDisableRadio
	{
		var action : QuestDisableRadio;
		action = new QuestDisableRadio;
		action.SetUp( this );
		action.AddDeviceName( m_deviceName );
		action.SetProperties( true );
		return action;
	}

	public function ActionQuestCloseAllDoors( value : Bool ) : QuestCloseAllDoors
	{
		var action : QuestCloseAllDoors;
		action = new QuestCloseAllDoors;
		action.SetUp( this );
		action.AddDeviceName( m_deviceName );
		action.SetProperties( value );
		return action;
	}

	public function ActionQuestToggleAds( value : Bool ) : QuestToggleAds
	{
		var action : QuestToggleAds;
		action = new QuestToggleAds;
		action.SetUp( this );
		action.AddDeviceName( m_deviceName );
		action.SetProperties( value );
		return action;
	}

	public function ActionQuestGoToFloor() : QuestGoToFloor
	{
		var action : QuestGoToFloor;
		action = new QuestGoToFloor;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties( -9999 );
		action.AddDeviceName( m_deviceName );
		return action;
	}

	public function ActionQuestForceGoToFloor() : QuestForceGoToFloor
	{
		var action : QuestForceGoToFloor;
		action = new QuestForceGoToFloor;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties( -9999 );
		action.AddDeviceName( m_deviceName );
		return action;
	}

	public function ActionQuestForceTeleportToFloor() : QuestForceTeleportToFloor
	{
		var action : QuestForceTeleportToFloor;
		action = new QuestForceTeleportToFloor;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties( -9999 );
		action.AddDeviceName( m_deviceName );
		return action;
	}

	public function ActionQuestStopElevator() : QuestStopElevator
	{
		var action : QuestStopElevator;
		action = new QuestStopElevator;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties();
		action.AddDeviceName( m_deviceName );
		return action;
	}

	public function ActionQuestResumeElevator() : QuestResumeElevator
	{
		var action : QuestResumeElevator;
		action = new QuestResumeElevator;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties();
		action.AddDeviceName( m_deviceName );
		return action;
	}

	public function ActionQuestSetLiftSpeed() : QuestSetLiftSpeed
	{
		var action : QuestSetLiftSpeed;
		action = new QuestSetLiftSpeed;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties( -9999.0 );
		action.AddDeviceName( m_deviceName );
		return action;
	}

	public function ActionQuestSetLiftTravelTimeOverride() : QuestSetLiftTravelTimeOverride
	{
		var action : QuestSetLiftTravelTimeOverride;
		action = new QuestSetLiftTravelTimeOverride;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties( -9999.0 );
		action.AddDeviceName( m_deviceName );
		return action;
	}

	public function ActionQuestEnableLiftTravelTimeOverride() : QuestEnableLiftTravelTimeOverride
	{
		var action : QuestEnableLiftTravelTimeOverride;
		action = new QuestEnableLiftTravelTimeOverride;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties( -9999 );
		action.AddDeviceName( m_deviceName );
		return action;
	}

	public function ActionQuestDisableLiftTravelTimeOverride() : QuestDisableLiftTravelTimeOverride
	{
		var action : QuestDisableLiftTravelTimeOverride;
		action = new QuestDisableLiftTravelTimeOverride;
		action.clearanceLevel = DefaultActionsParametersHolder.GetQuestClearance();
		action.SetUp( this );
		action.SetProperties( -9999 );
		action.AddDeviceName( m_deviceName );
		return action;
	}

	protected function ActionLiftStatus( optional libraryName : CName ) : LiftStatus
	{
		var action : LiftStatus;
		action = new LiftStatus;
		action.clearanceLevel = DefaultActionsParametersHolder.GetStatusClearance();
		action.SetUp( this );
		action.SetProperties( this );
		action.AddDeviceName( m_deviceName );
		action.CreateActionWidgetPackage( libraryName, m_liftSetup.m_authorizationTextOverride );
		return action;
	}

	protected override function ActionAuthorizeUser( optional isForced : Bool ) : AuthorizeUser
	{
		var action : AuthorizeUser;
		action = new AuthorizeUser;
		action.clearanceLevel = DefaultActionsParametersHolder.GetAuthorizeUserClearance();
		action.SetUp( this );
		action.SetProperties( GetPasswords(), isForced );
		action.AddDeviceName( GetDeviceName() );
		if( PreventionSystem.IsChasingPlayer( GetGameInstance() ) )
		{
			action.CreateActionWidgetPackage( 'elevator', "LocKey#45384" );
		}
		else
		{
			action.CreateActionWidgetPackage( 'elevator', m_liftSetup.m_authorizationTextOverride );
		}
		return action;
	}

	public override function GetActions( out actions : array< DeviceAction >, context : GetActionsContext ) : Bool
	{
		var i : Int32;
		var floorName : String;
		var scriptableAction : ScriptableDeviceAction;
		if( ( m_deviceState == EDeviceStatus.OFF || m_deviceState == EDeviceStatus.UNPOWERED ) || m_deviceState == EDeviceStatus.DISABLED )
		{
			actions.PushBack( ActionSetExposeQuickHacks() );
			actions.PushBack( ActionLiftStatus() );
			actions.PushBack( ActionSetDevicePowered() );
			return false;
		}
		if( !( IsPlayerAuthorized() ) && !( context.ignoresAuthorization ) )
		{
			if( context.requestType == gamedeviceRequestType.Internal )
			{
				actions.PushBack( ActionAuthorizeUser( ShouldForceAuthorizeUser( context ) ) );
			}
			else if( context.requestType == gamedeviceRequestType.External )
			{
				scriptableAction = ActionLiftStatus( 'authorization' );
				scriptableAction.SetDurationValue( 0.69999999 );
				actions.PushBack( scriptableAction );
			}
			return false;
		}
		super.GetActions( actions, context );
		for( i = actions.Size() - 1; i >= 0; i -= 1 )
		{
			if( actions[ i ].actionName == 'TogglePower' || actions[ i ].actionName == 'AuthorizeUser' )
			{
				actions.EraseFast( i );
			}
		}
		if( m_movementState != gamePlatformMovementState.Stopped )
		{
			return false;
		}
		if( context.requestType == gamedeviceRequestType.Internal )
		{
			for( i = m_floors.Size() - 1; i >= 0; i -= 1 )
			{
				if( !( m_floors[ i ].m_isHidden ) )
				{
					floorName = ElevatorFloorSetup.GetFloorName( m_floors[ i ] );
					if( m_floors[ i ].m_isInactive )
					{
						scriptableAction = ActionGoToFloor( m_floors.Size(), GetActiveFloor(), i, floorName, m_floorsAuthorization[ i ] );
						scriptableAction.SetInactiveWithReason( false, "LocKey#42213" );
						actions.PushBack( scriptableAction );
					}
					else
					{
						actions.PushBack( ActionGoToFloor( m_floors.Size(), GetActiveFloor(), i, floorName, m_floorsAuthorization[ i ] ) );
					}
				}
			}
		}
		else if( context.requestType == gamedeviceRequestType.External )
		{
			for( i = m_floors.Size() - 1; i >= 0; i -= 1 )
			{
				if( context.requestorID == m_floorIDs[ i ] )
				{
					if( GetActiveFloor() == i )
					{
						actions.PushBack( ActionCallElevator( true, i ) );
					}
					else
					{
						actions.PushBack( ActionCallElevator( false, i ) );
					}
				}
			}
		}
		SetActionIllegality( actions, m_illegalActions.regularActions );
		return true;
	}

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

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

	public override function GetQuestActionByName( actionName : CName ) : DeviceAction
	{
		var action : DeviceAction;
		action = super.GetQuestActionByName( actionName );
		if( action == NULL )
		{
			switch( actionName )
			{
				case 'GoToFloor':
					action = ActionQuestGoToFloor();
				break;
				case 'ForceGoToFloor':
					action = ActionQuestForceGoToFloor();
				break;
				case 'ForceTeleportToFloor':
					action = ActionQuestForceTeleportToFloor();
				break;
				case 'QuestStopElevator':
					action = ActionQuestStopElevator();
				break;
				case 'QuestResumeElevator':
					action = ActionQuestResumeElevator();
				break;
				case 'ShowFloor':
					action = ActionQuestShowFloor();
				break;
				case 'HideFloor':
					action = ActionQuestHideFloor();
				break;
				case 'SetFloorActive':
					action = ActionQuestSetFloorActive();
				break;
				case 'SetFloorInactive':
					action = ActionQuestSetFloorInactive();
				break;
				case 'SetLiftSpeed':
					action = ActionQuestSetLiftSpeed();
				break;
				case 'QuestSetLiftTravelTimeOverride':
					action = ActionQuestSetLiftTravelTimeOverride();
				break;
				case 'QuestEnableLiftTravelTimeOverride':
					action = ActionQuestEnableLiftTravelTimeOverride();
				break;
				case 'QuestDisableLiftTravelTimeOverride':
					action = ActionQuestDisableLiftTravelTimeOverride();
				break;
				case 'QuestSetRadioStation':
					action = ActionQuestSetRadioStation();
				break;
				case 'QuestDisableRadio':
					action = ActionQuestDisableRadio();
				break;
				case 'QuestForceCloseAllDoors':
					action = ActionQuestCloseAllDoors( true );
				break;
				case 'QuestForceOpenAllDoors':
					action = ActionQuestCloseAllDoors( false );
				break;
				case 'QuestTurnAdsOn':
					action = ActionQuestToggleAds( true );
				break;
				case 'QuestForceAdsOff':
					action = ActionQuestToggleAds( false );
				break;
			}
		}
		return action;
	}

	public override function GetQuestActions( out outActions : array< DeviceAction >, const context : ref< GetActionsContext > )
	{
		super.GetQuestActions( outActions, context );
		if( Clearance.IsInRange( context.clearance, DefaultActionsParametersHolder.GetQuestClearance() ) )
		{
			outActions.PushBack( ActionQuestGoToFloor() );
			outActions.PushBack( ActionQuestForceGoToFloor() );
			outActions.PushBack( ActionQuestForceTeleportToFloor() );
			outActions.PushBack( ActionQuestStopElevator() );
			outActions.PushBack( ActionQuestResumeElevator() );
			outActions.PushBack( ActionQuestShowFloor() );
			outActions.PushBack( ActionQuestHideFloor() );
			outActions.PushBack( ActionQuestSetFloorActive() );
			outActions.PushBack( ActionQuestSetFloorInactive() );
			outActions.PushBack( ActionQuestSetLiftSpeed() );
			outActions.PushBack( ActionQuestSetLiftTravelTimeOverride() );
			outActions.PushBack( ActionQuestEnableLiftTravelTimeOverride() );
			outActions.PushBack( ActionQuestDisableLiftTravelTimeOverride() );
			outActions.PushBack( ActionQuestSetRadioStation() );
			outActions.PushBack( ActionQuestDisableRadio() );
			outActions.PushBack( ActionQuestCloseAllDoors( true ) );
			outActions.PushBack( ActionQuestCloseAllDoors( false ) );
			outActions.PushBack( ActionQuestToggleAds( true ) );
			outActions.PushBack( ActionQuestToggleAds( false ) );
		}
	}

	public export function OnGoToFloor( evt : GoToFloor ) : EntityNotificationType
	{
		var notifier : ActionNotifier;
		notifier = new ActionNotifier;
		notifier.SetNone();
		if( ( IsUnpowered() || IsDisabled() ) || !( IsON() ) )
		{
			return SendActionFailedEvent( evt, evt.GetRequesterID(), "Unpowered, Disabled or Off" );
		}
		GetFloorAuthorizationFromSlaves();
		if( !( m_floorsAuthorization[ ( ( Int32 )evt.prop.first ) ] ) )
		{
			return SendActionFailedEvent( evt, evt.GetRequesterID(), "Not Authorized" );
		}
		if( m_activeFloor == ( ( Int32 )evt.prop.first ) )
		{
			return SendActionFailedEvent( evt, evt.GetRequesterID(), "OnGoToFloor: Lift is on given floor" );
		}
		m_targetFloor = ( ( Int32 )evt.prop.first );
		if( !( IsFinal() ) )
		{
		}
		Notify( notifier, evt );
		return EntityNotificationType.SendThisEventToEntity;
	}

	public export function OnCallElevator( evt : CallElevator ) : EntityNotificationType
	{
		var notifier : ActionNotifier;
		notifier = new ActionNotifier;
		notifier.SetNone();
		if( ( IsUnpowered() || IsDisabled() ) || !( IsON() ) )
		{
			return SendActionFailedEvent( evt, evt.GetRequesterID(), "Unpowered, Disabled or Off" );
		}
		m_targetFloor = ( ( Int32 )evt.prop.first );
		if( !( IsFinal() ) )
		{
		}
		Notify( notifier, evt );
		return EntityNotificationType.SendThisEventToEntity;
	}

	public override function OnQuickHackAuthorization( evt : QuickHackAuthorization ) : EntityNotificationType
	{
		var notifier : ActionNotifier;
		notifier = new ActionNotifier;
		notifier.SetNone();
		TurnAuthorizationModuleOFF();
		m_wasQuickHacked = true;
		SendSetAuthorizationModuleOFFToSlaves();
		if( !( IsFinal() ) )
		{
		}
		Notify( notifier, evt );
		return EntityNotificationType.SendThisEventToEntity;
	}

	protected function SendSetAuthorizationModuleOFFToSlaves()
	{
		var devices : array< DeviceComponentPS >;
		var i : Int32;
		var evt : SetAuthorizationModuleOFF;
		evt = new SetAuthorizationModuleOFF;
		devices = GetImmediateSlaves();
		for( i = 0; i < devices.Size(); i += 1 )
		{
			if( ( ( ElevatorFloorTerminalControllerPS )( devices[ i ] ) ) )
			{
				GetPersistencySystem().QueuePSEvent( devices[ i ].GetID(), devices[ i ].GetClassName(), evt );
			}
		}
	}

	public export function OnQuestGoToFloor( evt : QuestGoToFloor ) : EntityNotificationType
	{
		m_targetFloor = ( ( Int32 )evt.prop.first );
		if( !( IsFinal() ) )
		{
		}
		ProcessUnstreamedLiftMovement( ( ( Int32 )evt.prop.first ) );
		return EntityNotificationType.SendThisEventToEntity;
	}

	public export function OnQuestShowFloor( evt : QuestShowFloor ) : EntityNotificationType
	{
		m_floors[ ( ( Int32 )evt.prop.first ) ].m_isHidden = false;
		SyncDataWithFloorTerminal( ( ( Int32 )evt.prop.first ) );
		if( !( IsFinal() ) )
		{
		}
		return EntityNotificationType.SendPSChangedEventToEntity;
	}

	public function OnQuestSetRadioStation( evt : QuestSetRadioStation ) : EntityNotificationType
	{
		var notifier : ActionNotifier;
		notifier = new ActionNotifier;
		notifier.SetNone();
		Notify( notifier, evt );
		m_liftSetup.m_radioStationNumer = ( ( Int32 )evt.prop.first );
		return EntityNotificationType.SendThisEventToEntity;
	}

	public function OnQuestDisableRadio( evt : QuestDisableRadio ) : EntityNotificationType
	{
		var notifier : ActionNotifier;
		notifier = new ActionNotifier;
		notifier.SetNone();
		Notify( notifier, evt );
		m_liftSetup.m_radioStationNumer = -1;
		return EntityNotificationType.SendThisEventToEntity;
	}

	public export function OnQuestCloseAllDoors( evt : QuestCloseAllDoors ) : EntityNotificationType
	{
		var notifier : ActionNotifier;
		notifier = new ActionNotifier;
		notifier.SetNone();
		Notify( notifier, evt );
		m_isAllDoorsClosed = ( ( Bool )evt.prop.first );
		return EntityNotificationType.SendThisEventToEntity;
	}

	public function OnQuestToggleAds( evt : QuestToggleAds ) : EntityNotificationType
	{
		var notifier : ActionNotifier;
		notifier = new ActionNotifier;
		notifier.SetNone();
		Notify( notifier, evt );
		m_isAdsDisabled = !( ( ( Bool )evt.prop.first ) );
		return EntityNotificationType.SendThisEventToEntity;
	}

	public function OnQuestHideFloor( evt : QuestHideFloor ) : EntityNotificationType
	{
		m_floors[ ( ( Int32 )evt.prop.first ) ].m_isHidden = true;
		SyncDataWithFloorTerminal( ( ( Int32 )evt.prop.first ) );
		if( !( IsFinal() ) )
		{
		}
		return EntityNotificationType.SendPSChangedEventToEntity;
	}

	public function OnQuestSetFloorActive( evt : QuestSetFloorActive ) : EntityNotificationType
	{
		m_floors[ ( ( Int32 )evt.prop.first ) ].m_isInactive = false;
		SyncDataWithFloorTerminal( ( ( Int32 )evt.prop.first ) );
		if( !( IsFinal() ) )
		{
		}
		return EntityNotificationType.SendPSChangedEventToEntity;
	}

	public export function OnQuestSetFloorInactive( evt : QuestSetFloorInactive ) : EntityNotificationType
	{
		var ndx : Int32;
		ndx = -1;
		if( evt.prop && evt.prop.first.IsValid() )
		{
			ndx = ( ( Int32 )evt.prop.first );
		}
		if( ( ndx >= 0 ) && ( ndx < m_floors.Size() ) )
		{
			m_floors[ ndx ].m_isInactive = true;
			SyncDataWithFloorTerminal( ndx );
		}
		if( !( IsFinal() ) )
		{
		}
		return EntityNotificationType.SendPSChangedEventToEntity;
	}

	public export function OnQuestForceGoToFloor( evt : QuestForceGoToFloor ) : EntityNotificationType
	{
		m_targetFloor = ( ( Int32 )evt.prop.first );
		ProcessUnstreamedLiftMovement( ( ( Int32 )evt.prop.first ) );
		return EntityNotificationType.SendThisEventToEntity;
	}

	public export function OnQuestForceTeleportToFloor( evt : QuestForceTeleportToFloor ) : EntityNotificationType
	{
		if( !( IsFinal() ) )
		{
		}
		ProcessUnstreamedLiftMovement( ( ( Int32 )evt.prop.first ) );
		return EntityNotificationType.SendThisEventToEntity;
	}

	protected function ProcessUnstreamedLiftMovement( floor : Int32 )
	{
		if( !( GetOwnerEntityWeak() ) )
		{
			SendLiftDepartedEvent( m_activeFloor );
			SetStartingFloor( floor );
			ChangeActiveFloor( floor );
		}
	}

	public export function OnQuestStopElevator( evt : QuestStopElevator ) : EntityNotificationType
	{
		if( !( IsFinal() ) )
		{
		}
		return EntityNotificationType.SendThisEventToEntity;
	}

	public function OnQuestResumeElevator( evt : QuestResumeElevator ) : EntityNotificationType
	{
		if( !( IsFinal() ) )
		{
		}
		return EntityNotificationType.SendThisEventToEntity;
	}

	public export function OnQuestSetLiftSpeed( evt : QuestSetLiftSpeed ) : EntityNotificationType
	{
		var newSpeed : Float;
		if( !( IsFinal() ) )
		{
		}
		newSpeed = ( ( Float )evt.prop.first );
		m_liftSetup.m_liftSpeed = newSpeed;
		return EntityNotificationType.SendThisEventToEntity;
	}

	public function OnQuestSetLiftTravelTimeOverride( evt : QuestSetLiftTravelTimeOverride ) : EntityNotificationType
	{
		if( !( IsFinal() ) )
		{
		}
		m_liftSetup.m_liftTravelTimeOverride = ( ( Float )evt.prop.first );
		return EntityNotificationType.SendThisEventToEntity;
	}

	public function OnQuestEnableLiftTravelTimeOverride( evt : QuestEnableLiftTravelTimeOverride ) : EntityNotificationType
	{
		if( !( IsFinal() ) )
		{
		}
		m_liftSetup.m_isLiftTravelTimeOverride = true;
		return EntityNotificationType.DoNotNotifyEntity;
	}

	public function OnQuestDisableLiftTravelTimeOverride( evt : QuestDisableLiftTravelTimeOverride ) : EntityNotificationType
	{
		if( !( IsFinal() ) )
		{
		}
		m_liftSetup.m_isLiftTravelTimeOverride = false;
		return EntityNotificationType.DoNotNotifyEntity;
	}

	public function OnLiftStatus( evt : LiftStatus ) : EntityNotificationType
	{
		if( evt.IsStarted() )
		{
			ExecutePSActionWithDelay( evt, this, evt.GetDurationValue() );
			return EntityNotificationType.DoNotNotifyEntity;
		}
		else
		{
			UseNotifier( evt );
			if( IsPlayerAuthorized() )
			{
				return EntityNotificationType.SendPSChangedEventToEntity;
			}
			else
			{
				return EntityNotificationType.DoNotNotifyEntity;
			}
		}
	}

	protected function SyncDataWithFloorTerminal( terminalNumber : Int32 )
	{
		var syncEvent : LiftFloorSyncDataEvent;
		if( ( terminalNumber >= 0 ) && ( terminalNumber < m_floors.Size() ) )
		{
			syncEvent = new LiftFloorSyncDataEvent;
			syncEvent.isHidden = m_floors[ terminalNumber ].m_isHidden;
			syncEvent.isInactive = m_floors[ terminalNumber ].m_isInactive;
			GetPersistencySystem().QueuePSEvent( m_floorPSIDs[ terminalNumber ], 'ElevatorFloorTerminalControllerPS', syncEvent );
		}
	}

	public const function GetActiveFloor() : Int32
	{
		return m_activeFloor;
	}

	public const function GetActiveFloorDisplayName() : String
	{
		return ElevatorFloorSetup.GetFloorName( m_floors[ m_activeFloor ] );
	}

	public export quest const function IsAtFloor( floorNumber : Int32 ) : Bool
	{
		return m_activeFloor == floorNumber;
	}

	public export quest const function IsMoving() : Bool
	{
		if( m_movementState == gamePlatformMovementState.Stopped || m_movementState == gamePlatformMovementState.Paused )
		{
			return false;
		}
		else
		{
			return true;
		}
	}

	public quest const function IsFloorSelected( floor : Int32 ) : Bool
	{
		return m_targetFloor == floor;
	}

	public override function GetDeviceIconPath() : String
	{
		return "";
	}

	public const override function GetBlackboardDef() : ElevatorDeviceBlackboardDef
	{
		return GetAllBlackboardDefs().ElevatorDeviceBlackboard;
	}

	public const function GetMovementState() : gamePlatformMovementState
	{
		return m_movementState;
	}

	public function SetTimeWhenPaused( time : Float )
	{
		m_timeOnPause = time;
	}

	public function GetTimeWhenPaused() : Float
	{
		return m_timeOnPause;
	}

	public function GetFloorDataFromSlaves()
	{
		var i : Int32;
		var devices : array< DeviceComponentPS >;
		var floorName : String;
		var floorSetup : ElevatorFloorSetup;
		var floors : array< ElevatorFloorSetup >;
		devices = GetImmediateSlaves();
		m_floorIDs.Clear();
		m_floorPSIDs.Clear();
		for( i = 0; i < devices.Size(); i += 1 )
		{
			floorSetup = ( ( ElevatorFloorTerminalControllerPS )( devices[ i ] ) ).GetElevatorFloorSetup();
			floorName = ElevatorFloorSetup.GetFloorName( floorSetup );
			if( !( IsStringValid( floorName ) ) )
			{
				if( i < 10 )
				{
					floorName = "0" + ( ( String )( i ) );
				}
				else
				{
					floorName = ( ( String )( i ) );
				}
				floorSetup.m_floorDisplayName = StringToName( floorName );
				if( !( IsStringValid( floorSetup.m_floorName ) ) )
				{
					floorSetup.m_floorName = floorName;
				}
			}
			floors.PushBack( floorSetup );
			m_floorIDs.PushBack( PersistentID.ExtractEntityID( ( ( ElevatorFloorTerminalControllerPS )( devices[ i ] ) ).GetID() ) );
			m_floorPSIDs.PushBack( ( ( ElevatorFloorTerminalControllerPS )( devices[ i ] ) ).GetID() );
		}
		m_floors = floors;
	}

	public function GetFloorAuthorizationFromSlaves()
	{
		var i : Int32;
		var devices : array< DeviceComponentPS >;
		var termimnal : ElevatorFloorTerminalControllerPS;
		devices = GetImmediateSlaves();
		m_floorsAuthorization.Clear();
		for( i = 0; i < devices.Size(); i += 1 )
		{
			if( ( ( ElevatorFloorTerminalControllerPS )( devices[ i ] ) ) )
			{
				termimnal = ( ( ElevatorFloorTerminalControllerPS )( devices[ i ] ) );
				if( termimnal == NULL )
				{
					continue;
				}
				if( WasQuickHacked() )
				{
					m_floorsAuthorization.PushBack( true );
				}
				else
				{
					m_floorsAuthorization.PushBack( termimnal.IsPlayerAuthorized() );
				}
			}
		}
	}

	private function InitializeFloorsData()
	{
		RefreshFloorsData_Event( true );
	}

	private function EvaluateFloors()
	{
		RefreshFloorsData_Event( false );
	}

	private function RefreshFloorsData_Event( passToEntity : Bool )
	{
		var evt : RefreshFloorDataEvent;
		evt = new RefreshFloorDataEvent;
		evt.passToEntity = passToEntity;
		GetPersistencySystem().QueuePSEvent( GetID(), GetClassName(), evt );
	}

	private function RefreshFloorsAuthorizationData_Event( passToEntity : Bool )
	{
		var evt : RefreshFloorAuthorizationDataEvent;
		evt = new RefreshFloorAuthorizationDataEvent;
		evt.passToEntity = passToEntity;
		GetPersistencySystem().QueuePSEvent( GetID(), GetClassName(), evt );
	}

	public function SetMovementState( state : gamePlatformMovementState )
	{
		m_movementState = state;
	}

	protected export function OnLiftSetMovementStateEvent( evt : LiftSetMovementStateEvent ) : EntityNotificationType
	{
		m_movementState = evt.movementState;
		RefreshUI( GetBlackboard() );
		return EntityNotificationType.SendThisEventToEntity;
	}

	protected export function OnSetIsPlayerInsideLiftEvent( evt : SetIsPlayerInsideLiftEvent ) : EntityNotificationType
	{
		m_isPlayerInsideLift_RealOne = evt.value;
		return EntityNotificationType.DoNotNotifyEntity;
	}

	public export function OnRefreshFloorsData( evt : RefreshFloorDataEvent ) : EntityNotificationType
	{
		GetFloorDataFromSlaves();
		GetFloorAuthorizationFromSlaves();
		RefreshUI( GetBlackboard() );
		if( evt.passToEntity )
		{
			return EntityNotificationType.SendThisEventToEntity;
		}
		else
		{
			return EntityNotificationType.DoNotNotifyEntity;
		}
	}

	public export function OnRefreshFloorsAuthorizationData( evt : RefreshFloorAuthorizationDataEvent ) : EntityNotificationType
	{
		GetFloorAuthorizationFromSlaves();
		RefreshUI( GetBlackboard() );
		if( evt.passToEntity )
		{
			return EntityNotificationType.SendThisEventToEntity;
		}
		else
		{
			return EntityNotificationType.DoNotNotifyEntity;
		}
	}

	public function OnRefreshPlayerAuthorizationEvent( evt : RefreshPlayerAuthorizationEvent ) : EntityNotificationType
	{
		UseNotifier( ActionAuthorizeUser() );
		return EntityNotificationType.DoNotNotifyEntity;
	}

	public override function GetDeviceWidget( const context : ref< GetActionsContext > ) : SDeviceWidgetPackage
	{
		var widgetData : SDeviceWidgetPackage;
		var customData : LiftWidgetCustomData;
		widgetData = super.GetDeviceWidget( context );
		widgetData.displayName = GetActiveFloorDisplayName();
		customData = new LiftWidgetCustomData;
		customData.SetMovementState( GetMovementState() );
		widgetData.customData = customData;
		return widgetData;
	}

	private function SendLiftDepartedEvent( activeFloor : Int32 )
	{
		var floorID : PersistentID;
		var evt : LiftDepartedEvent;
		floorID = GetFloorPSID( activeFloor );
		evt = new LiftDepartedEvent;
		evt.floor = GetActiveFloorDisplayName();
		GameInstance.GetPersistencySystem( GetGameInstance() ).QueuePSEvent( floorID, 'ElevatorFloorTerminalControllerPS', evt );
	}

}

class QuestSetRadioStation extends ActionInt
{

	public function SetProperties( station : Int32 )
	{
		actionName = 'QuestSetRadioStation';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Int( 'RadioStation', station );
	}

}

class QuestDisableRadio extends ActionBool
{

	public function SetProperties( toggle : Bool )
	{
		actionName = 'QuestDisableRadio';
		prop = DeviceActionPropertyFunctions.SetUpProperty_Bool( 'QuestDisableRadio', toggle, 'QuestDisableRadio', 'QuestDisableRadio' );
	}

}

class QuestCloseAllDoors extends ActionBool
{

	public function SetProperties( toggle : Bool )
	{
		if( toggle )
		{
			actionName = 'QuestForceCloseAllDoors';
		}
		else
		{
			actionName = 'QuestForceOpenAllDoors';
		}
		prop = DeviceActionPropertyFunctions.SetUpProperty_Bool( 'QuestCloseAllDoors', toggle, 'QuestCloseAllDoors', 'QuestCloseAllDoors' );
	}

}

class QuestToggleAds extends ActionBool
{

	public function SetProperties( toggle : Bool )
	{
		if( toggle )
		{
			actionName = 'QuestTurnAdsOn';
		}
		else
		{
			actionName = 'QuestForceAdsOff';
		}
		prop = DeviceActionPropertyFunctions.SetUpProperty_Bool( 'QuestToggleAds', toggle, 'QuestToggleAds', 'QuestToggleAds' );
	}

}

