class InspectDummy extends GameObject
{
	var m_mesh : PhysicalMeshComponent;
	var m_choice : InteractionComponent;
	var m_inspectComp : InspectableObjectComponent;

	protected event OnRequestComponents( ri : EntityRequestComponentsInterface )
	{
		EntityRequestComponentsInterface.RequestComponent( ri, 'inspectComponent', 'InspectableObjectComponent', true );
		EntityRequestComponentsInterface.RequestComponent( ri, 'mesh', 'PhysicalMeshComponent', true );
		EntityRequestComponentsInterface.RequestComponent( ri, 'interaction', 'InteractionComponent', true );
		EntityRequestComponentsInterface.RequestComponent( ri, 'vision', 'gameVisionModeComponent', true );
	}

	protected event OnTakeControl( ri : EntityResolveComponentsInterface )
	{
		m_mesh = ( ( PhysicalMeshComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'mesh' ) ) );
		m_inspectComp = ( ( InspectableObjectComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'inspectComponent' ) ) );
		m_choice = ( ( InteractionComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'interaction' ) ) );
	}

	protected event OnInteractionChoice( choice : InteractionChoiceEvent )
	{
		var inspectEvt : InspectItemInspectionEvent;
		var lootEvt : LootItemInspectionEvent;
		switch( choice.choice.choiceMetaData.tweakDBName )
		{
			case "Inspect":
				inspectEvt = new InspectItemInspectionEvent;
			inspectEvt.owner = choice.activator;
			QueueEvent( inspectEvt );
			break;
			case "Loot":
				lootEvt = new LootItemInspectionEvent;
			lootEvt.owner = choice.activator;
			QueueEvent( lootEvt );
			break;
		}
	}

}

class InspectableItemObject extends ItemObject
{
	const editable var m_inspectableClues : array< SInspectableClue >;

	protected function DisplayScanButton( show : Bool ) {}

	protected event OnRequestComponents( ri : EntityRequestComponentsInterface ) {}

	protected event OnTakeControl( ri : EntityResolveComponentsInterface ) {}

	protected event OnGameAttached()
	{
		super.OnGameAttached();
	}

	public const function IsClueScanned( clueName : CName ) : Bool
	{
		return GetFact( GetGame(), clueName );
	}

	protected event OnInteractionActivated( evt : InteractionActivationEvent )
	{
		var newEvt : ScanEvent;
		var isScanned : Bool;
		isScanned = IsClueScanned( evt.layerData.tag );
		newEvt = new ScanEvent;
		if( evt.eventType == gameinteractionsEInteractionEventType.EIET_activate )
		{
			newEvt.isAvailable = true;
			newEvt.clue = NameToString( evt.layerData.tag );
			if( GetFact( GetGame(), evt.layerData.tag ) == 0 )
			{
				DisplayScanButton( true );
			}
			if( isScanned )
			{
			}
		}
		else
		{
			newEvt.isAvailable = false;
			newEvt.clue = "";
			DisplayScanButton( false );
		}
		QueueEventForEntityID( evt.activator.GetEntityID(), newEvt );
	}

}

struct SInspectableClue
{
	editable var clueName : CName;
	var isScanned : Bool;
}

class ScanEvent extends Event
{
	var clue : String;
	var isAvailable : Bool;
}

class TEMP_ScanningEvent extends Event
{
	var clue : CName;
	var showUI : Bool;
}

class ObjectInspectEvent extends Event
{
	var showItem : Bool;
}

class InspectionTriggerEvent extends Event
{
	var item : String;
	var offset : Float;
	var adsOffset : Float;
	var timeToScan : Float;
	var inspectedObjID : EntityID;
}

