class DisassemblableEntitySimple extends InteractiveDevice
{
	default m_controllerTypeName = 'GenericDeviceController';
	private var m_mesh : MeshComponent;
	private var m_collider : IComponent;

	protected event OnRequestComponents( ri : EntityRequestComponentsInterface )
	{
		EntityRequestComponentsInterface.RequestComponent( ri, 'mesh', 'MeshComponent', true );
		EntityRequestComponentsInterface.RequestComponent( ri, 'collider', 'IComponent', true );
		EntityRequestComponentsInterface.RequestComponent( ri, 'disassemblableComponent', 'DisassemblableComponent', true );
		super.OnRequestComponents( ri );
	}

	protected event OnTakeControl( ri : EntityResolveComponentsInterface )
	{
		m_mesh = ( ( MeshComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'mesh' ) ) );
		m_collider = ( ( IComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'collider' ) ) );
		m_disassemblableComponent = ( ( DisassemblableComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'disassemblableComponent' ) ) );
		super.OnTakeControl( ri );
		m_controller = ( ( GenericDeviceController )( EntityResolveComponentsInterface.GetComponent( ri, 'controller' ) ) );
	}

	public const override function GetDevicePS() : GenericDeviceControllerPS
	{
		return GetController().GetPS();
	}

	private const override function GetController() : GenericDeviceController
	{
		return ( ( GenericDeviceController )( m_controller ) );
	}

	protected event OnDisassembleDevice( evt : DisassembleDevice )
	{
		var player : PlayerPuppet;
		player = ( ( PlayerPuppet )( GameInstance.GetPlayerSystem( GetGame() ).GetLocalPlayerControlledGameObject() ) );
		EnterWorkspot( player, true, 'disassembleWorkspot' );
	}

	protected event OnWorkspotFinished( componentName : CName )
	{
		super.OnWorkspotFinished( componentName );
		if( componentName == 'disassembleWorkspot' )
		{
			m_collider.Toggle( false );
			m_mesh.Toggle( false );
			m_disassemblableComponent.ObtainParts();
		}
	}

}

