class LootContainerAccessPointController extends AccessPointController
{

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

}

class LootContainerAccessPointControllerPS extends AccessPointControllerPS
{
	protected instanceeditable var m_objRef : NodeRef;

	public override function FinalizeNetrunnerDive( state : HackingMinigameState )
	{
		super.FinalizeNetrunnerDive( state );
		if( state == HackingMinigameState.Succeeded )
		{
			SendActionToEntity();
			SendActionToOtherAPDevices();
		}
	}

	private function SendActionToOtherAPDevices()
	{
		var action : ScriptableDeviceAction;
		var parents : array< DeviceComponentPS >;
		var i : Int32;
		action = ActionSetDeviceUnpowered();
		SendActionToAllSlaves( action );
		GameInstance.GetDeviceSystem( GetGameInstance() ).GetParents( GetMyEntityID(), parents );
		for( i = 0; i < parents.Size(); i += 1 )
		{
			ExecutePSAction( action, parents[ i ] );
		}
	}

	private function SendActionToEntity()
	{
		var entityId : EntityID;
		var evt : ToggleContainerLockEvent;
		entityId = ( ( EntityID )( ResolveNodeRefWithEntityID( m_objRef, GetMyEntityID() ) ) );
		if( EntityID.IsDefined( entityId ) )
		{
			evt = new ToggleContainerLockEvent;
			evt.isLocked = false;
			GameInstance.GetPersistencySystem( GetGameInstance() ).QueueEntityEvent( entityId, evt );
		}
	}

}

