class RevokeQuickHackAccess extends Event
{
}

class SetRevealedInNetwork extends Event
{
	var wasRevealed : Bool;
}

importonly class DeviceComponent extends GameComponent
{
}

class ScriptableDeviceComponent extends DeviceComponent
{

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

	public const function GetPSID() : PersistentID
	{
		return GetPS().GetID();
	}

	public const function GetPSName() : CName
	{
		return GetPS().GetClassName();
	}

}

class SharedGameplayPS extends DeviceComponentPS
{
	protected instanceeditable persistent var m_deviceState : EDeviceStatus;
	protected instanceeditable persistent var m_authorizationProperties : AuthorizationData;
	protected persistent var m_wasStateCached : Bool;
	protected persistent var m_wasStateSet : Bool;
	protected persistent var m_cachedDeviceState : EDeviceStatus;
	[ category = "Devices Grid" ]
	protected instanceeditable var m_revealDevicesGrid : Bool;
	[ category = "Devices Grid" ]
	protected instanceeditable var m_revealDevicesGridWhenUnpowered : Bool;
	protected persistent var m_wasRevealedInNetworkPing : Bool;
	[ category = "Backdoor Properties" ]
	protected instanceeditable var m_hasNetworkBackdoor : Bool;

	public const function GetDeviceState() : EDeviceStatus
	{
		return m_deviceState;
	}

	protected function CacheDeviceState( state : EDeviceStatus )
	{
		m_cachedDeviceState = state;
		m_wasStateCached = true;
	}

	protected virtual function SetDeviceState( state : EDeviceStatus )
	{
		m_deviceState = state;
		m_wasStateSet = true;
	}

	public virtual function EvaluateDeviceState()
	{
		var i : Int32;
		var parents : array< DeviceComponentPS >;
		var expectedState : EDeviceStatus;
		var parent : MasterControllerPS;
		if( m_deviceState == EDeviceStatus.DISABLED )
		{
			return;
		}
		parents = GetImmediateParents();
		for( i = 0; i < parents.Size(); i += 1 )
		{
			parent = ( ( MasterControllerPS )( parents[ i ] ) );
			if( parent )
			{
				expectedState = parent.GetExpectedSlaveState();
				if( expectedState != EDeviceStatus.INVALID )
				{
					SetDeviceState( expectedState );
					return;
				}
			}
		}
	}

	protected const final function QueuePSEvent( targetPS : weak< PersistentState >, evt : Event )
	{
		if( !( targetPS ) )
		{
			return;
		}
		GameInstance.GetPersistencySystem( GetGameInstance() ).QueuePSEvent( targetPS.GetID(), targetPS.GetClassName(), evt );
	}

	protected const final function QueuePSEvent( targetID : PersistentID, psClassName : CName, evt : Event )
	{
		if( ( ( BaseScriptableAction )( evt ) ) )
		{
			if( !( EntityID.IsDefined( ( ( BaseScriptableAction )( evt ) ).GetRequesterID() ) ) )
			{
				( ( BaseScriptableAction )( evt ) ).RegisterAsRequester( GetMyEntityID() );
			}
		}
		GameInstance.GetPersistencySystem( GetGameInstance() ).QueuePSEvent( targetID, psClassName, evt );
	}

	protected const final function QueuePSEventWithDelay( targetPS : weak< PersistentState >, evt : Event, delay : Float )
	{
		if( !( targetPS ) )
		{
			return;
		}
		GameInstance.GetDelaySystem( GetGameInstance() ).DelayPSEvent( targetPS.GetID(), targetPS.GetClassName(), evt, delay );
	}

	protected const final function QueuePSEventWithDelay( targetID : PersistentID, psClassName : CName, evt : Event, delay : Float )
	{
		GameInstance.GetDelaySystem( GetGameInstance() ).DelayPSEvent( targetID, psClassName, evt, delay );
	}

	protected const final function QueueEntityEvent( entityID : EntityID, evt : Event )
	{
		GameInstance.GetPersistencySystem( GetGameInstance() ).QueueEntityEvent( entityID, evt );
	}

	public const virtual function IsPartOfSystem( systemType : ESystems ) : Bool
	{
		switch( systemType )
		{
			case ESystems.SecuritySystem:
				return IsConnectedToSecuritySystem();
			case ESystems.AccessPoints:
				return IsConnectedToBackdoorDevice();
			default:
				return false;
		}
	}

	public const function IsConnectedToSecuritySystem() : Bool
	{
		var securitySystem : SecuritySystemControllerPS;
		securitySystem = GetSecuritySystem();
		return securitySystem;
	}

	public const virtual function IsConnectedToSecuritySystem( out level : ESecurityAccessLevel ) : Bool
	{
		level = GetSecurityAccessLevel();
		return IsConnectedToSecuritySystem();
	}

	public const virtual function GetSecurityAccessLevel() : ESecurityAccessLevel
	{
		return FindHighestSecurityAccessLevel( GetSecurityAreas() );
	}

	protected const function FindHighestSecurityAccessLevel( const securityAreas : ref< array< SecurityAreaControllerPS > > ) : ESecurityAccessLevel
	{
		var i : Int32;
		var highestLevel : ESecurityAccessLevel;
		highestLevel = ESecurityAccessLevel.ESL_NONE;
		for( i = 0; i < securityAreas.Size(); i += 1 )
		{
			if( ( ( Int64 )( securityAreas[ i ].GetSecurityAccessLevel() ) ) > ( ( Int64 )( highestLevel ) ) )
			{
				highestLevel = securityAreas[ i ].GetSecurityAccessLevel();
			}
		}
		if( highestLevel == ESecurityAccessLevel.ESL_NONE )
		{
			highestLevel = m_authorizationProperties.m_authorizationDataEntry.m_level;
		}
		return highestLevel;
	}

	public const virtual function IsBreached() : Bool
	{
		var aps : array< AccessPointControllerPS >;
		var i : Int32;
		aps = GetAccessPoints();
		for( i = 0; i < aps.Size(); i += 1 )
		{
			if( aps[ i ].IsNetworkBreached() )
			{
				return true;
			}
		}
		if( !( IsFinal() ) )
		{
		}
		return false;
	}

	public const virtual function HasNetworkBackdoor() : Bool
	{
		var ap : AccessPointControllerPS;
		if( m_hasNetworkBackdoor && ( ( ( Int32 )( GetDeviceState() ) ) > ( ( Int32 )( EDeviceStatus.UNPOWERED ) ) ) )
		{
			ap = GetBackdoorAccessPoint();
			if( ap )
			{
				return true;
			}
		}
		return false;
	}

	public const virtual function IsConnectedToBackdoorDevice() : Bool
	{
		var parents : array< DeviceComponentPS >;
		var i : Int32;
		GetParents( parents );
		for( i = 0; i < parents.Size(); i += 1 )
		{
			if( ( ( ScriptableDeviceComponentPS )( parents[ i ] ) ).HasNetworkBackdoor() )
			{
				return true;
			}
		}
		return false;
	}

	public const virtual function GetBackdoorAccessPoint() : AccessPointControllerPS
	{
		var aps : array< AccessPointControllerPS >;
		var backdoorAP : AccessPointControllerPS;
		if( !( m_hasNetworkBackdoor ) )
		{
			if( !( IsFinal() ) )
			{
			}
			return NULL;
		}
		aps = GetAccessPoints();
		if( aps.Size() > 0 )
		{
			backdoorAP = aps[ 0 ];
			return backdoorAP;
		}
		if( !( IsFinal() ) )
		{
		}
		return NULL;
	}

	public const function GetAccessPoints() : array< AccessPointControllerPS >
	{
		var ap : AccessPointControllerPS;
		var aps : array< AccessPointControllerPS >;
		var parents : array< DeviceComponentPS >;
		var i : Int32;
		GetParents( parents );
		for( i = 0; i < parents.Size(); i += 1 )
		{
			if( ( ( AccessPointControllerPS )( parents[ i ] ) ) )
			{
				ap = ( ( AccessPointControllerPS )( parents[ i ] ) );
				aps.PushBack( ap );
			}
		}
		return aps;
	}

	public const virtual function GetNetworkName() : String
	{
		var aps : array< AccessPointControllerPS >;
		var networkName : String;
		aps = GetAccessPoints();
		if( aps.Size() > 0 )
		{
			networkName = aps[ 0 ].GetNetworkName();
			if( IsStringValid( networkName ) )
			{
				return networkName;
			}
			else
			{
				return "LOCAL NETWORK";
			}
		}
		if( !( IsFinal() ) )
		{
		}
		return "";
	}

	public const function CheckMasterConnectedClassTypes() : ConnectedClassTypes
	{
		var data, processedData, emptyData : ConnectedClassTypes;
		var aps : array< AccessPointControllerPS >;
		var i : Int32;
		aps = GetAccessPoints();
		for( i = 0; i < aps.Size(); i += 1 )
		{
			processedData = emptyData;
			processedData = aps[ i ].CheckConnectedClassTypes();
			if( processedData.surveillanceCamera == true )
			{
				data.surveillanceCamera = true;
			}
			if( processedData.securityTurret == true )
			{
				data.securityTurret = true;
			}
			if( processedData.puppet == true )
			{
				data.puppet = true;
			}
		}
		return data;
	}

	public const virtual function WasRevealedInNetworkPing() : Bool
	{
		return m_wasRevealedInNetworkPing;
	}

	public const virtual function SetRevealedInNetworkPing( wasRevealed : Bool )
	{
		var evt : SetRevealedInNetwork;
		if( m_wasRevealedInNetworkPing == wasRevealed )
		{
			return;
		}
		evt = new SetRevealedInNetwork;
		evt.wasRevealed = wasRevealed;
		QueuePSEvent( GetID(), GetClassName(), evt );
	}

	private function OnSetRevealedInNetwork( evt : SetRevealedInNetwork ) : EntityNotificationType
	{
		var notifyNetworkSystem : MarkBackdoorAsRevealedRequest;
		if( m_wasRevealedInNetworkPing == evt.wasRevealed )
		{
			return EntityNotificationType.DoNotNotifyEntity;
		}
		m_wasRevealedInNetworkPing = evt.wasRevealed;
		if( HasNetworkBackdoor() )
		{
			notifyNetworkSystem = new MarkBackdoorAsRevealedRequest;
			notifyNetworkSystem.device = this;
			GetNetworkSystem().QueueRequest( notifyNetworkSystem );
		}
		return EntityNotificationType.SendThisEventToEntity;
	}

	public const virtual function IsPuppet() : Bool
	{
		return false;
	}

}

class ProcessDevicesEvent extends Event
{
	var devices : array< DeviceComponentPS >;
}

class ExtractDevicesEvent extends Event
{
	var lazyDevices : array< LazyDevice >;
	var devices : array< DeviceComponentPS >;
	var eventToSendOnCompleted : ProcessDevicesEvent;
	var lastExtractedIndex : Int32;
}

import class DeviceComponentPS extends GameComponentPS
{
	[ category = "Quest" ]
	protected instanceeditable persistent var m_markAsQuest : Bool;
	[ category = "Quest" ]
	protected instanceeditable persistent var m_autoToggleQuestMark : Bool;
	default m_autoToggleQuestMark = true;
	[ category = "Quest" ]
	protected instanceeditable persistent var m_factToDisableQuestMark : CName;
	[ category = "Quest" ]
	protected var m_callbackToDisableQuestMarkID : Uint32;
	[ category = "Quest" ]
	protected instanceeditable inlined persistent var m_backdoorObjectiveData : BackDoorObjectiveData;
	[ category = "Quest" ]
	protected instanceeditable inlined persistent var m_controlPanelObjectiveData : ControlPanelObjectiveData;
	[ category = "UI Zoom / Fullscreen" ]
	protected instanceeditable var m_deviceUIStyle : gamedataComputerUIStyle;
	default m_deviceUIStyle = gamedataComputerUIStyle.LightBlue;
	protected var m_blackboard : weak< IBlackboard >;
	protected persistent var m_isScanned : Bool;
	default m_isScanned = false;
	private var m_isBeingScanned : Bool;
	default m_isBeingScanned = false;
	protected persistent var m_exposeQuickHacks : Bool;
	default m_exposeQuickHacks = false;
	protected var m_isAttachedToGame : Bool;
	protected var m_isLogicReady : Bool;
	protected var m_maxDevicesToExtractInOneFrame : Int32;
	default m_maxDevicesToExtractInOneFrame = 10;

	protected function ProcessDevicesLazy( const lazyDevices : ref< array< LazyDevice > >, optional eventToSendOnCompleted : ProcessDevicesEvent )
	{
		var evt : ExtractDevicesEvent;
		evt = new ExtractDevicesEvent;
		evt.lazyDevices = lazyDevices;
		evt.eventToSendOnCompleted = eventToSendOnCompleted;
		ResolveExtractDevicesEvent( evt );
	}

	protected export virtual function OnExtractDevicesEvent( evt : ExtractDevicesEvent ) : EntityNotificationType
	{
		ResolveExtractDevicesEvent( evt );
		return EntityNotificationType.DoNotNotifyEntity;
	}

	private function ResolveExtractDevicesEvent( evt : ExtractDevicesEvent )
	{
		var extractedDevicesCount : Int32;
		var i : Int32;
		var currentIdex : Int32;
		var devicePS : DeviceComponentPS;
		if( evt == NULL )
		{
			return;
		}
		if( evt.lastExtractedIndex > 0 )
		{
			currentIdex = evt.lastExtractedIndex + 1;
		}
		else
		{
			currentIdex = 0;
		}
		for( i = currentIdex; i < evt.lazyDevices.Size(); i += 1 )
		{
			extractedDevicesCount += 1;
			devicePS = evt.lazyDevices[ i ].ExtractDevice( GetGameInstance() );
			if( devicePS )
			{
				evt.devices.PushBack( devicePS );
			}
			if( i == ( evt.lazyDevices.Size() - 1 ) )
			{
				if( evt.eventToSendOnCompleted )
				{
					evt.eventToSendOnCompleted.devices = evt.devices;
					GetPersistencySystem().QueuePSEvent( GetID(), GetClassName(), evt.eventToSendOnCompleted );
				}
				break;
			}
			if( extractedDevicesCount >= m_maxDevicesToExtractInOneFrame )
			{
				evt.lastExtractedIndex = i;
				GameInstance.GetDelaySystem( GetGameInstance() ).DelayPSEventNextFrame( GetID(), GetClassName(), evt );
				break;
			}
		}
	}

	public const function GetPS( deviceLink : DeviceLink ) : DeviceComponentPS
	{
		return ( ( DeviceComponentPS )( GetPersistencySystem().GetConstAccessToPSObject( DeviceLink.GetLinkID( deviceLink ), DeviceLink.GetLinkClassName( deviceLink ) ) ) );
	}

	public const virtual function IsStatic() : Bool
	{
		return false;
	}

	public const function IsAttachedToGame() : Bool
	{
		return m_isAttachedToGame;
	}

	public const function IsLogicReady() : Bool
	{
		return m_isLogicReady;
	}

	public import const virtual function GetClearance() : Clearance;
	public import function GetNativeActions( out outActions : array< DeviceAction >, context : GetActionsContext );

	public virtual function GetActions( out outActions : array< DeviceAction >, context : GetActionsContext ) : Bool
	{
		GetNativeActions( outActions, context );
		return true;
	}

	public virtual function GetQuestActions( out outActions : array< DeviceAction >, const context : ref< GetActionsContext > ) {}

	public virtual function GetQuestActionByName( actionName : CName ) : DeviceAction
	{
		return NULL;
	}

	public function GetActionsToNative( context : GetActionsContext ) : array< DeviceAction >
	{
		var actions : array< DeviceAction >;
		GetActions( actions, context );
		return actions;
	}

	public export function GetQuestActionsToNative( context : GetActionsContext ) : array< DeviceAction >
	{
		var actions : array< DeviceAction >;
		GetQuestActions( actions, context );
		return actions;
	}

	public export virtual function GetQuestActionByNameToNative( actionName : CName ) : DeviceAction
	{
		return GetQuestActionByName( actionName );
	}

	public virtual function OnMaraudersMapDeviceDebug( sink : MaraudersMapDevicesSink )
	{
		sink.PushString( "I'm a", "Computer" );
		sink.PushString( "I'm a", "Computery guy" );
		sink.PushString( "Everything made out", "" );
		sink.PushString( "of buttons", "and wires" );
	}

	public const virtual function GetFirstAttachedSlave() : DeviceComponentPS
	{
		return NULL;
	}

	public const virtual function GetAttachedSlaveForPing( optional context : MasterControllerPS ) : DeviceComponentPS
	{
		return NULL;
	}

	public const function GetBackdoorObjectiveData() : BackDoorObjectiveData
	{
		return m_backdoorObjectiveData;
	}

	public const function GetControlPanelObjectiveData() : ControlPanelObjectiveData
	{
		return m_controlPanelObjectiveData;
	}

	public function InitializeGameplayObjectives()
	{
		if( m_backdoorObjectiveData )
		{
			m_backdoorObjectiveData.SetOwnerID( PersistentID.ExtractEntityID( GetID() ) );
		}
		if( m_controlPanelObjectiveData )
		{
			m_controlPanelObjectiveData.SetOwnerID( PersistentID.ExtractEntityID( GetID() ) );
		}
	}

	public function InitializeQuestDBCallbacksForQuestmark()
	{
		var factName : CName;
		factName = GetFactToDisableQuestMarkName();
		if( IsNameValid( factName ) )
		{
			m_callbackToDisableQuestMarkID = GameInstance.GetQuestsSystem( GetGameInstance() ).RegisterEntity( factName, PersistentID.ExtractEntityID( GetID() ) );
		}
	}

	public function UnInitializeQuestDBCallbacksForQuestmark()
	{
		var factName : CName;
		factName = GetFactToDisableQuestMarkName();
		if( IsNameValid( factName ) && ( m_callbackToDisableQuestMarkID > ( ( Uint32 )( 0 ) ) ) )
		{
			GameInstance.GetQuestsSystem( GetGameInstance() ).UnregisterEntity( factName, m_callbackToDisableQuestMarkID );
		}
	}

	public const function GetOwnerEntityWeak() : weak< Entity >
	{
		return GameInstance.FindEntityByID( GetGameInstance(), GetMyEntityID() );
	}

	protected const function GetNetworkSystem() : NetworkSystem
	{
		return ( ( NetworkSystem )( GameInstance.GetScriptableSystemsContainer( GetGameInstance() ).Get( 'NetworkSystem' ) ) );
	}

	protected function ExposeQuickHacks( shouldExpose : Bool )
	{
		if( shouldExpose )
		{
			ExposeQuickHacks();
		}
		else
		{
			m_exposeQuickHacks = false;
		}
	}

	private function ExposeQuickHacks()
	{
		m_exposeQuickHacks = true;
		m_isScanned = true;
	}

	public const function IsQuickHacksExposed() : Bool
	{
		if( GetNetworkSystem().QuickHacksExposedByDefault() )
		{
			return true;
		}
		else
		{
			return m_exposeQuickHacks;
		}
	}

	public function IsScanned() : Bool
	{
		return m_isScanned;
	}

	public const virtual function GetSecurityAreas( optional includeInactive : Bool, optional returnOnlyDirectlyConnected : Bool ) : array< SecurityAreaControllerPS >
	{
		var parents : array< DeviceComponentPS >;
		var areas : array< SecurityAreaControllerPS >;
		var systemFound : Bool;
		var i : Int32;
		GetParents( parents );
		for( i = 0; i < parents.Size(); i += 1 )
		{
			if( ( ( SecurityAreaControllerPS )( parents[ i ] ) ) )
			{
				if( ( ( SecurityAreaControllerPS )( parents[ i ] ) ).IsActive() )
				{
					areas.PushBack( ( ( SecurityAreaControllerPS )( parents[ i ] ) ) );
				}
				else if( includeInactive )
				{
					areas.PushBack( ( ( SecurityAreaControllerPS )( parents[ i ] ) ) );
				}
			}
			if( ( ( SecuritySystemControllerPS )( parents[ i ] ) ) )
			{
				systemFound = true;
			}
		}
		if( returnOnlyDirectlyConnected )
		{
			return areas;
		}
		if( areas.Size() > 0 )
		{
			return areas;
		}
		if( systemFound )
		{
			areas = GetSecuritySystem().GetSecurityAreas( includeInactive );
		}
		return areas;
	}

	public const virtual function GetSecuritySystem() : SecuritySystemControllerPS
	{
		var ancestors : array< DeviceComponentPS >;
		var secSys : SecuritySystemControllerPS;
		var i : Int32;
		GetAncestors( ancestors );
		for( i = 0; i < ancestors.Size(); i += 1 )
		{
			if( ( ( SecuritySystemControllerPS )( ancestors[ i ] ) ) )
			{
				secSys = ( ( SecuritySystemControllerPS )( ancestors[ i ] ) );
				if( secSys && !( secSys.IsDisabled() ) )
				{
					return secSys;
				}
			}
		}
		return NULL;
	}

	public virtual function GetPersistentStateName() : CName
	{
		return GetClassName();
	}

	public const virtual function GetChildren( out outDevices : array< DeviceComponentPS > )
	{
		GameInstance.GetDeviceSystem( GetGameInstance() ).GetChildren( GetMyEntityID(), outDevices );
	}

	public const virtual function GetLazyChildren( out outDevices : array< LazyDevice > )
	{
		GameInstance.GetDeviceSystem( GetGameInstance() ).GetLazyChildren( GetMyEntityID(), outDevices );
	}

	public const virtual function GetParents( out outDevices : array< DeviceComponentPS > )
	{
		GameInstance.GetDeviceSystem( GetGameInstance() ).GetParents( GetMyEntityID(), outDevices );
	}

	public const virtual function GetImmediateParents() : array< DeviceComponentPS >
	{
		var masters : array< DeviceComponentPS >;
		GameInstance.GetDeviceSystem( GetGameInstance() ).GetParents( GetMyEntityID(), masters );
		return masters;
	}

	public const virtual function GetLazyParents() : array< LazyDevice >
	{
		var masters : array< LazyDevice >;
		GameInstance.GetDeviceSystem( GetGameInstance() ).GetLazyParents( GetMyEntityID(), masters );
		return masters;
	}

	public const virtual function GetAncestors( out outDevices : array< DeviceComponentPS > )
	{
		GameInstance.GetDeviceSystem( GetGameInstance() ).GetAllAncestors( GetMyEntityID(), outDevices );
	}

	public const virtual function GetLazyAncestors() : array< LazyDevice >
	{
		var ancestors : array< LazyDevice >;
		GameInstance.GetDeviceSystem( GetGameInstance() ).GetLazyAllAncestors( GetMyEntityID(), ancestors );
		return ancestors;
	}

	public const virtual function HasAnySlave() : Bool
	{
		return false;
	}

	public const virtual function HasAnyDeviceConnection() : Bool
	{
		return HasAnySlave() || GameInstance.GetDeviceSystem( GetGameInstance() ).HasAnyAncestor( GetMyEntityID() );
	}

	public import const virtual function GetDeviceName() : String;
	public import const virtual function GetDeviceStatus() : String;

	public const virtual function IsMasterType() : Bool
	{
		return false;
	}

	public virtual function HackGetOwner() : Entity
	{
		var ent : Entity;
		ent = new Entity;
		return ent;
	}

	public const function IsBeingScanned() : Bool
	{
		return m_isBeingScanned;
	}

	public const function IsMarkedAsQuest() : Bool
	{
		return m_markAsQuest;
	}

	public const function IsAutoTogglingQuestMark() : Bool
	{
		return m_autoToggleQuestMark;
	}

	public const function GetFactToDisableQuestMarkName() : CName
	{
		return m_factToDisableQuestMark;
	}

	public const function IsAnyMasterFlaggedAsQuest() : Bool
	{
		var i : Int32;
		var outDevices : array< DeviceComponentPS >;
		GetAncestors( outDevices );
		for( i = 0; i < outDevices.Size(); i += 1 )
		{
			if( outDevices[ i ].IsMarkedAsQuest() )
			{
				return true;
			}
		}
		return false;
	}

	public import virtual function GetWidgetTypeName() : CName;
	public import virtual function GetDeviceIconPath() : String;

	public const virtual function GetVirtualSystemType() : EVirtualSystem
	{
		return EVirtualSystem.None;
	}

	public virtual function GetDeviceIconID() : CName
	{
		return '';
	}

	public virtual function GetDeviceWidget( const context : ref< GetActionsContext > ) : SDeviceWidgetPackage
	{
		var widgetData : SDeviceWidgetPackage;
		return widgetData;
	}

	public const virtual function GetBlackboardDef() : DeviceBaseBlackboardDef
	{
		return GetAllBlackboardDefs().DeviceBaseBlackboard;
	}

	public const virtual function GetBlackboard() : IBlackboard
	{
		return m_blackboard;
	}

	protected virtual function GetInkWidgetLibraryPath() : ResRef
	{
		return R"";
	}

	protected virtual function GetInkWidgetLibraryID( const context : ref< GetActionsContext > ) : CName
	{
		return '';
	}

	protected virtual function GetInkWidgetTweakDBID( const context : ref< GetActionsContext > ) : TweakDBID
	{
		switch( m_deviceUIStyle )
		{
			case gamedataComputerUIStyle.Orange:
				return T"DevicesUIDefinitions.GenericDeviceWidgetOA";
			default:
				return T"DevicesUIDefinitions.GenericDeviceWidget";
		}
	}

	protected virtual function GetBackgroundTextureTweakDBID() : TweakDBID
	{
		return T"DeviceIcons.GenenericDeviceBackground";
	}

	protected virtual function GetDeviceIconTweakDBID() : TweakDBID
	{
		return T"DeviceIcons.GenenericDeviceIcon";
	}

	public virtual function GetThumbnailWidget() : SThumbnailWidgetPackage
	{
		var widgetData : SThumbnailWidgetPackage;
		return widgetData;
	}

	protected virtual function GetActionWidgets( const context : ref< GetActionsContext > ) : array< SActionWidgetPackage >
	{
		var widgetsData : array< SActionWidgetPackage >;
		return widgetsData;
	}

	public virtual function GetThumbnailAction() : ThumbnailUI
	{
		return ActionThumbnailUI();
	}

	public function SetIsMarkedAsQuest( isQuest : Bool )
	{
		m_markAsQuest = isQuest;
	}

	public function SetIsBeingScannedFlag( isBeingScanned : Bool )
	{
		m_isBeingScanned = isBeingScanned;
	}

	public function SetIsScanComplete( isComplete : Bool )
	{
		m_isScanned = isComplete;
	}

	public virtual function DetermineInteractionState( interactionComponent : InteractionComponent, const context : ref< GetActionsContext > ) {}

	public function PassBlackboard( blackboard : IBlackboard )
	{
		m_blackboard = blackboard;
	}

	public const virtual function GetVirtualSystem( slave : DeviceComponentPS, out vs : VirtualSystemPS ) : Bool
	{
		return false;
	}

	public const virtual function GetVirtualSystem( id : PersistentID, out vs : VirtualSystemPS ) : Bool
	{
		return false;
	}

	public const virtual function GetVirtualSystem( out vs : VirtualSystemPS ) : Bool
	{
		return false;
	}

	public virtual function ResloveUIOnAction( action : ScriptableDeviceAction ) {}

	public virtual function RefreshUI( blackboard : IBlackboard ) {}

	public virtual function RequestBreadCrumbUpdate( blackboard : IBlackboard, data : SBreadCrumbUpdateData ) {}

	public virtual function RequestActionWidgetsUpdate( blackboard : IBlackboard ) {}

	protected virtual function ActionThumbnailUI() : ThumbnailUI
	{
		var action : ThumbnailUI;
		action = new ThumbnailUI;
		action.SetUp( this );
		action.SetProperties();
		action.SetWidgetStyle( m_deviceUIStyle );
		action.AddDeviceName( GetDeviceName() );
		action.CreateThumbnailWidgetPackage( "LocKey#42210" );
		return action;
	}

	protected const function GetMyEntityID() : EntityID
	{
		return PersistentID.ExtractEntityID( GetID() );
	}

}

function BasicAvailabilityTest( device : ScriptableDeviceComponentPS ) : Bool
{
	if( device.IsDisabled() )
	{
		return false;
	}
	if( device.IsUnpowered() )
	{
		return false;
	}
	if( device.IsOFF() )
	{
		return false;
	}
	return true;
}

