using System;
using System.Collections.Generic;
using Content.Shared.Chemistry;
using Robust.Shared.GameObjects;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.Serialization;
namespace Content.Shared.GameObjects.Components.Chemistry
{
///
/// Shared class for ReagentDispenserComponent. Provides a way for entities to dispense and remove reagents from other entities with SolutionComponents via a user interface.
/// This is useful for machines such as the chemical dispensers, booze dispensers, or soda dispensers.
/// The chemicals which may be dispensed are defined by specifying a reagent pack. See for more information on that.
///
public class SharedReagentDispenserComponent : Component
{
public override string Name => "ReagentDispenser";
///
/// A list of reagents which this may dispense. Defined in yaml prototype, see .
///
protected readonly List Inventory = new List();
[Serializable, NetSerializable]
public class ReagentDispenserBoundUserInterfaceState : BoundUserInterfaceState
{
public readonly bool HasBeaker;
public readonly ReagentUnit BeakerCurrentVolume;
public readonly ReagentUnit BeakerMaxVolume;
public readonly string ContainerName;
///
/// A list of the reagents which this dispenser can dispense.
///
public readonly List Inventory;
///
/// A list of the reagents and their amounts within the beaker/reagent container, if applicable.
///
public readonly List ContainerReagents;
public readonly string DispenserName;
public readonly ReagentUnit SelectedDispenseAmount;
public ReagentDispenserBoundUserInterfaceState(bool hasBeaker, ReagentUnit beakerCurrentVolume, ReagentUnit beakerMaxVolume, string containerName,
List inventory, string dispenserName, List containerReagents, ReagentUnit selectedDispenseAmount)
{
HasBeaker = hasBeaker;
BeakerCurrentVolume = beakerCurrentVolume;
BeakerMaxVolume = beakerMaxVolume;
ContainerName = containerName;
Inventory = inventory;
DispenserName = dispenserName;
ContainerReagents = containerReagents;
SelectedDispenseAmount = selectedDispenseAmount;
}
}
///
/// Message data sent from client to server when a dispenser ui button is pressed.
///
[Serializable, NetSerializable]
public class UiButtonPressedMessage : BoundUserInterfaceMessage
{
public readonly UiButton Button;
public readonly int DispenseIndex; //Index of dispense button / reagent being pressed. Only used when a dispense button is pressed.
public UiButtonPressedMessage(UiButton button, int dispenseIndex)
{
Button = button;
DispenseIndex = dispenseIndex;
}
}
[Serializable, NetSerializable]
public enum ReagentDispenserUiKey
{
Key
}
///
/// Used in to specify which button was pressed.
///
public enum UiButton
{
Eject,
Clear,
SetDispenseAmount1,
SetDispenseAmount5,
SetDispenseAmount10,
SetDispenseAmount25,
SetDispenseAmount50,
SetDispenseAmount100,
///
/// Used when any dispense button is pressed. Such as "Carbon", or "Oxygen" buttons on the chem dispenser.
/// The index of the reagent attached to that dispense button is sent as .
///
Dispense
}
///
/// Information about a reagent which the dispenser can dispense.
///
[Serializable, NetSerializable]
public struct ReagentDispenserInventoryEntry
{
public readonly string ID;
public ReagentDispenserInventoryEntry(string id)
{
ID = id;
}
}
}
}