class IceMachine extends VendingMachine
{
	default m_controllerTypeName = 'IceMachineController';

	protected event OnRequestComponents( ri : EntityRequestComponentsInterface )
	{
		super.OnRequestComponents( ri );
	}

	protected event OnTakeControl( ri : EntityResolveComponentsInterface )
	{
		super.OnTakeControl( ri );
		m_controller = ( ( IceMachineController )( EntityResolveComponentsInterface.GetComponent( ri, 'controller' ) ) );
	}

	public override function GetVendorID() : TweakDBID
	{
		return GetDevicePS().GetVendorTweakID();
	}

	protected override function StopGlitching()
	{
		super.StopGlitching();
	}

	protected event OnDispenceItemFromVendor( evt : DispenceItemFromVendor )
	{
		var i : Int32;
		var time : Float;
		if( evt.IsStarted() )
		{
			PlaySoundEvent( this, GetDevicePS().GetProcessingSFX() );
		}
		else
		{
			for( i = 0; i < 5; i += 1 )
			{
				time += ( ( ( Float )( i ) ) / 5.0 );
				DelayVendingMachineEvent( time, true, true, evt.GetItemID() );
			}
			RefreshUI();
		}
	}

	protected event OnVendingMachineFinishedEvent( evt : VendingMachineFinishedEvent )
	{
		if( evt.isReady )
		{
			GetDevicePS().SetIsReady( true );
		}
		DispenseItems( CreateDispenseRequest( !( evt.isFree ), evt.itemID ) );
		PlayItemFall();
		RefreshUI();
		GetDevicePS().GetDeviceOperationsContainer().Execute( 'ice_effect', this );
	}

	protected override function HackedEffect()
	{
		var i : Int32;
		for( i = 0; i < GetDevicePS().GetHackedItemCount(); i += 1 )
		{
			DelayVendingMachineEvent( ( ( Float )( i ) ) / 5.0, true, false );
		}
	}

	protected override function PlayItemFall()
	{
		PlaySoundEvent( this, GetDevicePS().GetIceFallSFX() );
	}

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

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

	public const override function DeterminGameplayRole() : EGameplayRole
	{
		return EGameplayRole.Distract;
	}

}

class DelaySpawning extends Event
{
}

