class WireRepairable extends GameObject
{
	var isBroken : Bool;
	private const instanceeditable var m_dependableEntities : array< NodeRef >;
	private var m_interaction : InteractionComponent;
	private var m_brokenmesh : IVisualComponent;
	private var m_fixedmesh : IVisualComponent;

	protected event OnRequestComponents( ri : EntityRequestComponentsInterface )
	{
		EntityRequestComponentsInterface.RequestComponent( ri, 'MeshCompBroken', 'entMeshComponent', false );
		EntityRequestComponentsInterface.RequestComponent( ri, 'MeshCompFixed', 'entMeshComponent', false );
		EntityRequestComponentsInterface.RequestComponent( ri, 'InteractionComp', 'gameinteractionsComponent', false );
	}

	protected event OnTakeControl( ri : EntityResolveComponentsInterface )
	{
		m_brokenmesh = ( ( IVisualComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'MeshCompBroken' ) ) );
		m_fixedmesh = ( ( IVisualComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'MeshCompFixed' ) ) );
		m_interaction = ( ( InteractionComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'InteractionComp' ) ) );
	}

	protected event OnGameAttached()
	{
		m_fixedmesh.TemporaryHide( true );
		ChangeWiringBrokenOnConnectedPanels( true );
	}

	protected event OnInteractionActivated( evt : InteractionActivationEvent ) {}

	protected event OnBasicInteraction( choiceEvent : InteractionChoiceEvent )
	{
		ChangeState( !( isBroken ) );
		ChangeWiringBrokenOnConnectedPanels( false );
	}

	protected event OnVisionModeVisual( evt : gameVisionModeVisualEvent )
	{
		if( !( isBroken ) )
		{
		}
	}

	private function ChangeState( newstate : Bool ) : Bool
	{
		if( isBroken == newstate )
		{
			return false;
		}
		else
		{
			isBroken = newstate;
			m_brokenmesh.TemporaryHide( newstate );
			m_fixedmesh.TemporaryHide( !( newstate ) );
			return true;
		}
	}

	private function ChangeWiringBrokenOnConnectedPanels( newWiringBroken : Bool ) {}
}

