class WeaponVendingMachine extends VendingMachine
{
	default m_controllerTypeName = 'WeaponVendingMachineController';
	protected var m_bigAdScreen : weak< IWorldWidgetComponent >;

	protected event OnRequestComponents( ri : EntityRequestComponentsInterface )
	{
		super.OnRequestComponents( ri );
		EntityRequestComponentsInterface.RequestComponent( ri, 'bigAdvertScreen', 'worlduiWidgetComponent', false );
	}

	protected event OnTakeControl( ri : EntityResolveComponentsInterface )
	{
		super.OnTakeControl( ri );
		m_bigAdScreen = ( ( worlduiWidgetComponent )( EntityResolveComponentsInterface.GetComponent( ri, 'bigAdvertScreen' ) ) );
		m_controller = ( ( WeaponVendingMachineController )( EntityResolveComponentsInterface.GetComponent( ri, 'controller' ) ) );
	}

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

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

	protected override function GetJunkItem() : ItemID
	{
		return ItemID.FromTDBID( GetDevicePS().GetJunkItemID() );
	}

	protected override function GetProcessingSFX() : CName
	{
		return GetDevicePS().GetProcessingSFX();
	}

	protected override function CreateDispenseRequest( shouldPay : Bool, item : ItemID ) : DispenseRequest
	{
		var dispenseRequest : DispenseRequest;
		dispenseRequest = new DispenseRequest;
		dispenseRequest.owner = this;
		dispenseRequest.position = RandomizePosition();
		dispenseRequest.shouldPay = shouldPay;
		if( ItemID.IsValid( item ) )
		{
			dispenseRequest.itemID = ItemID.CreateQuery( ItemID.GetTDBID( item ) );
		}
		return dispenseRequest;
	}

	protected override function TurnOffDevice()
	{
		super.TurnOffDevice();
		if( m_bigAdScreen )
		{
			m_bigAdScreen.Toggle( false );
		}
	}

	protected override function TurnOnDevice()
	{
		super.TurnOnDevice();
		if( m_bigAdScreen )
		{
			m_bigAdScreen.Toggle( true );
		}
	}

	protected const override function GetController() : WeaponVendingMachineController
	{
		return ( ( WeaponVendingMachineController )( m_controller ) );
	}

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

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

}

