Make grinder use item slots (& misc eject-button changes) (#7197)

This commit is contained in:
Leon Friedrich
2022-03-28 17:03:03 +13:00
committed by GitHub
parent 9cccc6da99
commit 80699543d9
31 changed files with 163 additions and 297 deletions

View File

@@ -1,7 +1,5 @@
using System.Collections.Generic; using Content.Shared.Containers.ItemSlots;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using static Content.Shared.Access.Components.SharedIdCardConsoleComponent; using static Content.Shared.Access.Components.SharedIdCardConsoleComponent;
@@ -23,6 +21,10 @@ namespace Content.Client.Access.UI
base.Open(); base.Open();
_window = new IdCardConsoleWindow(this, _prototypeManager) {Title = _entityManager.GetComponent<MetaDataComponent>(Owner.Owner).EntityName}; _window = new IdCardConsoleWindow(this, _prototypeManager) {Title = _entityManager.GetComponent<MetaDataComponent>(Owner.Owner).EntityName};
_window.PrivilegedIdButton.OnPressed += _ => SendMessage(new ItemSlotButtonPressedEvent(PrivilegedIdCardSlotId));
_window.TargetIdButton.OnPressed += _ => SendMessage(new ItemSlotButtonPressedEvent(TargetIdCardSlotId));
_window.OnClose += Close; _window.OnClose += Close;
_window.OpenCentered(); _window.OpenCentered();
} }
@@ -41,11 +43,6 @@ namespace Content.Client.Access.UI
_window?.UpdateState(castState); _window?.UpdateState(castState);
} }
public void ButtonPressed(UiButton button)
{
SendMessage(new IdButtonPressedMessage(button));
}
public void SubmitData(string newFullName, string newJobTitle, List<string> newAccessList) public void SubmitData(string newFullName, string newJobTitle, List<string> newAccessList)
{ {
if (newFullName.Length > MaxFullNameLength) if (newFullName.Length > MaxFullNameLength)

View File

@@ -1,13 +1,13 @@
<DefaultWindow xmlns="https://spacestation14.io" <DefaultWindow xmlns="https://spacestation14.io"
MinSize="650 290"> MinSize="650 290">
<BoxContainer Orientation="Vertical"> <BoxContainer Orientation="Vertical">
<GridContainer Columns="3"> <GridContainer Columns="3">
<Label Text="{Loc 'id-card-console-window-privileged-id'}" /> <Label Text="{Loc 'id-card-console-window-privileged-id'}" />
<Button Name="PrivilegedIdButton" /> <Button Name="PrivilegedIdButton" Access="Public"/>
<Label Name="PrivilegedIdLabel" /> <Label Name="PrivilegedIdLabel" />
<Label Text="{Loc 'id-card-console-window-target-id'}" /> <Label Text="{Loc 'id-card-console-window-target-id'}" />
<Button Name="TargetIdButton" /> <Button Name="TargetIdButton" Access="Public"/>
<Label Name="TargetIdLabel" /> <Label Name="TargetIdLabel" />
</GridContainer> </GridContainer>
<Control MinSize="0 8" /> <Control MinSize="0 8" />

View File

@@ -28,9 +28,6 @@ namespace Content.Client.Access.UI
_owner = owner; _owner = owner;
PrivilegedIdButton.OnPressed += _ => _owner.ButtonPressed(UiButton.PrivilegedId);
TargetIdButton.OnPressed += _ => _owner.ButtonPressed(UiButton.TargetId);
FullNameLineEdit.OnTextEntered += _ => SubmitData(); FullNameLineEdit.OnTextEntered += _ => SubmitData();
FullNameLineEdit.OnTextChanged += _ => FullNameLineEdit.OnTextChanged += _ =>
{ {

View File

@@ -1,8 +1,7 @@
using Content.Shared.Chemistry.Dispenser; using Content.Shared.Chemistry.Dispenser;
using Content.Shared.Containers.ItemSlots;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using static Content.Shared.Chemistry.Components.SharedChemMasterComponent; using static Content.Shared.Chemistry.Components.SharedChemMasterComponent;
namespace Content.Client.Chemistry.UI namespace Content.Client.Chemistry.UI
@@ -38,7 +37,7 @@ namespace Content.Client.Chemistry.UI
_window.OnClose += Close; _window.OnClose += Close;
//Setup static button actions. //Setup static button actions.
_window.EjectButton.OnPressed += _ => PrepareData(UiAction.Eject, null, null, null, null, null); _window.EjectButton.OnPressed += _ => SendMessage(new ItemSlotButtonPressedEvent(BeakerSlotId));
_window.BufferTransferButton.OnPressed += _ => PrepareData(UiAction.Transfer, null, null, null, null, null); _window.BufferTransferButton.OnPressed += _ => PrepareData(UiAction.Transfer, null, null, null, null, null);
_window.BufferDiscardButton.OnPressed += _ => PrepareData(UiAction.Discard, null, null, null, null, null); _window.BufferDiscardButton.OnPressed += _ => PrepareData(UiAction.Discard, null, null, null, null, null);
_window.CreatePillButton.OnPressed += _ => PrepareData(UiAction.CreatePills, null, _window.LabelLine, null, _window.PillAmount.Value, null); _window.CreatePillButton.OnPressed += _ => PrepareData(UiAction.CreatePills, null, _window.LabelLine, null, _window.PillAmount.Value, null);

View File

@@ -1,11 +1,9 @@
using System.Collections.Generic;
using System.Linq; using System.Linq;
using Content.Shared.Chemistry.Dispenser; using Content.Shared.Chemistry.Dispenser;
using Content.Shared.Containers.ItemSlots;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
using static Content.Shared.Chemistry.Dispenser.SharedReagentDispenserComponent; using static Content.Shared.Chemistry.Dispenser.SharedReagentDispenserComponent;
namespace Content.Client.Chemistry.UI namespace Content.Client.Chemistry.UI
@@ -39,7 +37,7 @@ namespace Content.Client.Chemistry.UI
_window.OnClose += Close; _window.OnClose += Close;
//Setup static button actions. //Setup static button actions.
_window.EjectButton.OnPressed += _ => ButtonPressed(UiButton.Eject); _window.EjectButton.OnPressed += _ => SendMessage(new ItemSlotButtonPressedEvent(BeakerSlotId));
_window.ClearButton.OnPressed += _ => ButtonPressed(UiButton.Clear); _window.ClearButton.OnPressed += _ => ButtonPressed(UiButton.Clear);
_window.DispenseButton1.OnPressed += _ => ButtonPressed(UiButton.SetDispenseAmount1); _window.DispenseButton1.OnPressed += _ => ButtonPressed(UiButton.SetDispenseAmount1);
_window.DispenseButton5.OnPressed += _ => ButtonPressed(UiButton.SetDispenseAmount5); _window.DispenseButton5.OnPressed += _ => ButtonPressed(UiButton.SetDispenseAmount5);

View File

@@ -1,3 +1,4 @@
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Kitchen.Components; using Content.Shared.Kitchen.Components;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls; using Robust.Client.UserInterface.Controls;
@@ -57,7 +58,7 @@ namespace Content.Client.Kitchen.UI
public void StartGrinding(BaseButton.ButtonEventArgs? args = null) => SendMessage(new SharedReagentGrinderComponent.ReagentGrinderGrindStartMessage()); public void StartGrinding(BaseButton.ButtonEventArgs? args = null) => SendMessage(new SharedReagentGrinderComponent.ReagentGrinderGrindStartMessage());
public void StartJuicing(BaseButton.ButtonEventArgs? args = null) => SendMessage(new SharedReagentGrinderComponent.ReagentGrinderJuiceStartMessage()); public void StartJuicing(BaseButton.ButtonEventArgs? args = null) => SendMessage(new SharedReagentGrinderComponent.ReagentGrinderJuiceStartMessage());
public void EjectAll(BaseButton.ButtonEventArgs? args = null) => SendMessage(new SharedReagentGrinderComponent.ReagentGrinderEjectChamberAllMessage()); public void EjectAll(BaseButton.ButtonEventArgs? args = null) => SendMessage(new SharedReagentGrinderComponent.ReagentGrinderEjectChamberAllMessage());
public void EjectBeaker(BaseButton.ButtonEventArgs? args = null) => SendMessage(new SharedReagentGrinderComponent.ReagentGrinderEjectBeakerMessage()); public void EjectBeaker(BaseButton.ButtonEventArgs? args = null) => SendMessage(new ItemSlotButtonPressedEvent(SharedReagentGrinderComponent.BeakerSlotId));
public void EjectChamberContent(EntityUid uid) => SendMessage(new SharedReagentGrinderComponent.ReagentGrinderEjectChamberContentMessage(uid)); public void EjectChamberContent(EntityUid uid) => SendMessage(new SharedReagentGrinderComponent.ReagentGrinderEjectChamberContentMessage(uid));
} }
} }

View File

@@ -1,9 +1,7 @@
using Content.Client.Traitor.Uplink; using Content.Shared.Containers.ItemSlots;
using Content.Shared.Nuke; using Content.Shared.Nuke;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.Localization;
namespace Content.Client.Nuke namespace Content.Client.Nuke
{ {
@@ -37,7 +35,7 @@ namespace Content.Client.Nuke
_menu.EjectButton.OnPressed += _ => _menu.EjectButton.OnPressed += _ =>
{ {
SendMessage(new NukeEjectMessage()); SendMessage(new ItemSlotButtonPressedEvent(SharedNukeComponent.NukeDiskSlotId));
}; };
_menu.AnchorButton.OnPressed += _ => _menu.AnchorButton.OnPressed += _ =>
{ {

View File

@@ -1,14 +1,8 @@
using Content.Client.Message; using Content.Client.Message;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.PDA; using Content.Shared.PDA;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Client.GameObjects; using Robust.Client.GameObjects;
using Robust.Client.UserInterface.Controls;
using Robust.Client.UserInterface.CustomControls;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Localization;
using Robust.Shared.Prototypes;
using static Robust.Client.UserInterface.Controls.BoxContainer;
namespace Content.Client.PDA namespace Content.Client.PDA
{ {
@@ -35,12 +29,12 @@ namespace Content.Client.PDA
_menu.EjectIdButton.OnPressed += _ => _menu.EjectIdButton.OnPressed += _ =>
{ {
SendMessage(new PDAEjectIDMessage()); SendMessage(new ItemSlotButtonPressedEvent(PDAComponent.PDAIdSlotId));
}; };
_menu.EjectPenButton.OnPressed += _ => _menu.EjectPenButton.OnPressed += _ =>
{ {
SendMessage(new PDAEjectPenMessage()); SendMessage(new ItemSlotButtonPressedEvent(PDAComponent.PDAPenSlotId));
}; };
_menu.ActivateUplinkButton.OnPressed += _ => _menu.ActivateUplinkButton.OnPressed += _ =>

View File

@@ -1,18 +1,11 @@
using System.Collections.Generic;
using System.Linq; using System.Linq;
using Content.Server.Access.Systems; using Content.Server.Access.Systems;
using Content.Server.Power.Components;
using Content.Server.UserInterface; using Content.Server.UserInterface;
using Content.Shared.Access; using Content.Shared.Access;
using Content.Shared.Access.Components; using Content.Shared.Access.Components;
using Content.Shared.Access.Systems; using Content.Shared.Access.Systems;
using Content.Shared.Containers.ItemSlots;
using Robust.Server.GameObjects; using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Robust.Shared.Log;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.ViewVariables;
namespace Content.Server.Access.Components namespace Content.Server.Access.Components
{ {
@@ -24,7 +17,6 @@ namespace Content.Server.Access.Components
[Dependency] private readonly IEntityManager _entities = default!; [Dependency] private readonly IEntityManager _entities = default!;
[ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(IdCardConsoleUiKey.Key); [ViewVariables] private BoundUserInterface? UserInterface => Owner.GetUIOrNull(IdCardConsoleUiKey.Key);
[ViewVariables] private bool Powered => !_entities.TryGetComponent(Owner, out ApcPowerReceiverComponent? receiver) || receiver.Powered;
protected override void Initialize() protected override void Initialize()
{ {
@@ -48,17 +40,6 @@ namespace Content.Server.Access.Components
switch (obj.Message) switch (obj.Message)
{ {
case IdButtonPressedMessage msg:
switch (msg.Button)
{
case UiButton.PrivilegedId:
HandleIdButton(player, PrivilegedIdSlot);
break;
case UiButton.TargetId:
HandleIdButton(player, TargetIdSlot);
break;
}
break;
case WriteToTargetIdMessage msg: case WriteToTargetIdMessage msg:
TryWriteToTargetId(msg.FullName, msg.JobTitle, msg.AccessList); TryWriteToTargetId(msg.FullName, msg.JobTitle, msg.AccessList);
UpdateUserInterface(); UpdateUserInterface();
@@ -104,17 +85,6 @@ namespace Content.Server.Access.Components
accessSystem.TrySetTags(targetIdEntity, newAccessList); accessSystem.TrySetTags(targetIdEntity, newAccessList);
} }
/// <summary>
/// Called when one of the insert/remove ID buttons gets pressed.
/// </summary>
private void HandleIdButton(EntityUid user, ItemSlot slot)
{
if (slot.HasItem)
EntitySystem.Get<ItemSlotsSystem>().TryEjectToHands(Owner, slot, user);
else
EntitySystem.Get<ItemSlotsSystem>().TryInsertFromHand(Owner, slot, user);
}
public void UpdateUserInterface() public void UpdateUserInterface()
{ {
if (!Initialized) if (!Initialized)

View File

@@ -97,21 +97,14 @@ namespace Content.Server.Chemistry.Components
if (obj.Session.AttachedEntity is not {Valid: true} player) if (obj.Session.AttachedEntity is not {Valid: true} player)
return; return;
var msg = (UiActionMessage) obj.Message; if (obj.Message is not UiActionMessage msg)
var needsPower = msg.Action switch return;
{
UiAction.Eject => false,
_ => true,
};
if (!PlayerCanUseChemMaster(player, needsPower)) if (!PlayerCanUseChemMaster(player, true))
return; return;
switch (msg.Action) switch (msg.Action)
{ {
case UiAction.Eject:
EntitySystem.Get<ItemSlotsSystem>().TryEjectToHands(Owner, BeakerSlot, player);
break;
case UiAction.ChemButton: case UiAction.ChemButton:
TransferReagent(msg.Id, msg.Amount, msg.IsBuffer); TransferReagent(msg.Id, msg.Amount, msg.IsBuffer);
break; break;

View File

@@ -4,7 +4,6 @@ using Content.Server.Power.Components;
using Content.Server.UserInterface; using Content.Server.UserInterface;
using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Components;
using Content.Shared.Chemistry.Dispenser; using Content.Shared.Chemistry.Dispenser;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Content.Shared.Sound; using Content.Shared.Sound;
using JetBrains.Annotations; using JetBrains.Annotations;
@@ -145,21 +144,14 @@ namespace Content.Server.Chemistry.Components
return; return;
} }
var msg = (UiButtonPressedMessage) obj.Message; if (obj.Message is not UiButtonPressedMessage msg )
var needsPower = msg.Button switch return;
{
UiButton.Eject => false,
_ => true,
};
if (!PlayerCanUseDispenser(obj.Session.AttachedEntity, needsPower)) if (!PlayerCanUseDispenser(obj.Session.AttachedEntity, true))
return; return;
switch (msg.Button) switch (msg.Button)
{ {
case UiButton.Eject:
EntitySystem.Get<ItemSlotsSystem>().TryEjectToHands(Owner, BeakerSlot, obj.Session.AttachedEntity);
break;
case UiButton.Clear: case UiButton.Clear:
TryClear(); TryClear();
break; break;

View File

@@ -1,10 +1,8 @@
using Content.Shared.Chemistry.Components; using Content.Shared.Chemistry.Components;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Kitchen.Components; using Content.Shared.Kitchen.Components;
using Content.Shared.Sound; using Content.Shared.Sound;
using Robust.Shared.Containers; using Robust.Shared.Containers;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.ViewVariables;
namespace Content.Server.Kitchen.Components namespace Content.Server.Kitchen.Components
{ {
@@ -17,12 +15,10 @@ namespace Content.Server.Kitchen.Components
[RegisterComponent] [RegisterComponent]
public sealed class ReagentGrinderComponent : SharedReagentGrinderComponent public sealed class ReagentGrinderComponent : SharedReagentGrinderComponent
{ {
[ViewVariables] public ContainerSlot BeakerContainer = default!;
/// <summary> /// <summary>
/// Can be null since we won't always have a beaker in the grinder. /// Can be null since we won't always have a beaker in the grinder.
/// </summary> /// </summary>
[ViewVariables] public Solution? HeldBeaker = default!; [ViewVariables] public Solution? BeakerSolution;
/// <summary> /// <summary>
/// Contains the things that are going to be ground or juiced. /// Contains the things that are going to be ground or juiced.
@@ -40,5 +36,8 @@ namespace Content.Server.Kitchen.Components
[DataField("clickSound")] public SoundSpecifier ClickSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg"); [DataField("clickSound")] public SoundSpecifier ClickSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/machine_switch.ogg");
[DataField("grindSound")] public SoundSpecifier GrindSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/blender.ogg"); [DataField("grindSound")] public SoundSpecifier GrindSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/blender.ogg");
[DataField("juiceSound")] public SoundSpecifier JuiceSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/juicer.ogg"); [DataField("juiceSound")] public SoundSpecifier JuiceSound { get; set; } = new SoundPathSpecifier("/Audio/Machines/juicer.ogg");
[DataField("beakerSlot")]
public ItemSlot BeakerSlot = new();
} }
} }

View File

@@ -7,6 +7,8 @@ using Content.Server.Kitchen.Events;
using Content.Server.Power.Components; using Content.Server.Power.Components;
using Content.Server.Stack; using Content.Server.Stack;
using Content.Server.UserInterface; using Content.Server.UserInterface;
using Content.Shared.Chemistry.Components;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Hands.EntitySystems; using Content.Shared.Hands.EntitySystems;
using Content.Shared.Interaction; using Content.Shared.Interaction;
using Content.Shared.Item; using Content.Shared.Item;
@@ -27,6 +29,7 @@ namespace Content.Server.Kitchen.EntitySystems
{ {
[Dependency] private readonly SolutionContainerSystem _solutionsSystem = default!; [Dependency] private readonly SolutionContainerSystem _solutionsSystem = default!;
[Dependency] private readonly SharedHandsSystem _handsSystem = default!; [Dependency] private readonly SharedHandsSystem _handsSystem = default!;
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
private Queue<ReagentGrinderComponent> _uiUpdateQueue = new(); private Queue<ReagentGrinderComponent> _uiUpdateQueue = new();
@@ -35,11 +38,36 @@ namespace Content.Server.Kitchen.EntitySystems
base.Initialize(); base.Initialize();
SubscribeLocalEvent<ReagentGrinderComponent, ComponentInit>(OnComponentInit); SubscribeLocalEvent<ReagentGrinderComponent, ComponentInit>(OnComponentInit);
SubscribeLocalEvent<ReagentGrinderComponent, PowerChangedEvent>((_, component, _) => SubscribeLocalEvent<ReagentGrinderComponent, ComponentRemove>(OnComponentRemove);
EnqueueUiUpdate(component));
SubscribeLocalEvent<ReagentGrinderComponent, InteractHandEvent>(OnInteractHand); SubscribeLocalEvent<ReagentGrinderComponent, PowerChangedEvent>((_, component, _) => EnqueueUiUpdate(component));
SubscribeLocalEvent<ReagentGrinderComponent, InteractUsingEvent>(OnInteractUsing); SubscribeLocalEvent<ReagentGrinderComponent, InteractUsingEvent>(OnInteractUsing);
SubscribeLocalEvent<StackComponent, ExtractableScalingEvent>(ExtractableScaling); SubscribeLocalEvent<StackComponent, ExtractableScalingEvent>(ExtractableScaling);
SubscribeLocalEvent<ReagentGrinderComponent, EntInsertedIntoContainerMessage>(OnContainerModified);
SubscribeLocalEvent<ReagentGrinderComponent, EntRemovedFromContainerMessage>(OnContainerModified);
SubscribeLocalEvent<ReagentGrinderComponent, ContainerIsRemovingAttemptEvent>(OnEntRemoveAttempt);
}
private void OnEntRemoveAttempt(EntityUid uid, ReagentGrinderComponent component, ContainerIsRemovingAttemptEvent args)
{
if (component.Busy)
args.Cancel();
}
private void OnContainerModified(EntityUid uid, ReagentGrinderComponent component, ContainerModifiedMessage args)
{
EnqueueUiUpdate(component);
if (args.Container.ID != SharedReagentGrinderComponent.BeakerSlotId)
return;
if (TryComp(component.Owner, out AppearanceComponent? appearance))
appearance.SetData(SharedReagentGrinderComponent.ReagentGrinderVisualState.BeakerAttached, component.BeakerSlot.HasItem);
component.BeakerSolution = null;
if (component.BeakerSlot.Item != null)
_solutionsSystem.TryGetFitsInDispenser(component.BeakerSlot.Item.Value, out component.BeakerSolution);
} }
private void ExtractableScaling(EntityUid uid, StackComponent component, ExtractableScalingEvent args) private void ExtractableScaling(EntityUid uid, StackComponent component, ExtractableScalingEvent args)
@@ -51,38 +79,10 @@ namespace Content.Server.Kitchen.EntitySystems
{ {
if (args.Handled) return; if (args.Handled) return;
if (!EntityManager.HasComponent<HandsComponent>(args.User))
{
component.Owner.PopupMessage(args.User,
Loc.GetString("reagent-grinder-component-interact-using-no-hands"));
args.Handled = true;
return;
}
var heldEnt = args.Used; var heldEnt = args.Used;
// First, check if user is trying to insert a beaker. //See if the user is trying to insert something they want to be ground/juiced.
// No promise it will be a beaker right now, but whatever. if (!HasComp<ExtractableComponent>(heldEnt))
// Maybe this should whitelist "beaker" in the prototype id of heldEnt?
if (_solutionsSystem.TryGetFitsInDispenser(heldEnt, out var beaker))
{
component.BeakerContainer.Insert(heldEnt);
component.HeldBeaker = beaker;
EnqueueUiUpdate(component);
//We are done, return. Insert the beaker and exit!
if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance))
{
appearance.SetData(SharedReagentGrinderComponent.ReagentGrinderVisualState.BeakerAttached,
component.BeakerContainer.ContainedEntity != null);
}
ClickSound(component);
args.Handled = true;
return;
}
//Next, see if the user is trying to insert something they want to be ground/juiced.
if (!EntityManager.TryGetComponent(heldEnt, out ExtractableComponent? juice))
{ {
//Entity did NOT pass the whitelist for grind/juice. //Entity did NOT pass the whitelist for grind/juice.
//Wouldn't want the clown grinding up the Captain's ID card now would you? //Wouldn't want the clown grinding up the Captain's ID card now would you?
@@ -93,31 +93,11 @@ namespace Content.Server.Kitchen.EntitySystems
//Cap the chamber. Don't want someone putting in 500 entities and ejecting them all at once. //Cap the chamber. Don't want someone putting in 500 entities and ejecting them all at once.
//Maybe I should have done that for the microwave too? //Maybe I should have done that for the microwave too?
if (component.Chamber.ContainedEntities.Count >= component.StorageCap) if (component.Chamber.ContainedEntities.Count >= component.StorageCap)
{
return; return;
}
if (!component.Chamber.Insert(heldEnt)) if (!component.Chamber.Insert(heldEnt, EntityManager))
{
return; return;
}
EnqueueUiUpdate(component);
args.Handled = true;
}
private void OnInteractHand(EntityUid uid, ReagentGrinderComponent component, InteractHandEvent args)
{
if (args.Handled) return;
if (!EntityManager.TryGetComponent(args.User, out ActorComponent? actor))
{
return;
}
EnqueueUiUpdate(component);
component.Owner.GetUIOrNull(SharedReagentGrinderComponent.ReagentGrinderUiKey.Key)
?.Toggle(actor.PlayerSession);
args.Handled = true; args.Handled = true;
} }
@@ -130,16 +110,14 @@ namespace Content.Server.Kitchen.EntitySystems
{ {
EnqueueUiUpdate(component); EnqueueUiUpdate(component);
//A slot for the beaker where the grounds/juices will go. _itemSlotsSystem.AddItemSlot(uid, SharedReagentGrinderComponent.BeakerSlotId, component.BeakerSlot);
component.BeakerContainer =
ContainerHelpers.EnsureContainer<ContainerSlot>(component.Owner,
$"{component.Name}-reagentContainerContainer");
//A container for the things that WILL be ground/juiced. Useful for ejecting them instead of deleting them from the hands of the user. //A container for the things that WILL be ground/juiced. Useful for ejecting them instead of deleting them from the hands of the user.
component.Chamber = component.Chamber =
ContainerHelpers.EnsureContainer<Container>(component.Owner, ContainerHelpers.EnsureContainer<Container>(component.Owner,
$"{component.Name}-entityContainerContainer"); $"{component.Name}-entityContainerContainer");
// TODO just directly subscribe to UI events.
var bui = component.Owner.GetUIOrNull(SharedReagentGrinderComponent.ReagentGrinderUiKey.Key); var bui = component.Owner.GetUIOrNull(SharedReagentGrinderComponent.ReagentGrinderUiKey.Key);
if (bui != null) if (bui != null)
{ {
@@ -147,6 +125,11 @@ namespace Content.Server.Kitchen.EntitySystems
} }
} }
private void OnComponentRemove(EntityUid uid, ReagentGrinderComponent component, ComponentRemove args)
{
_itemSlotsSystem.RemoveItemSlot(uid, component.BeakerSlot);
}
private void OnUIMessageReceived(EntityUid uid, ReagentGrinderComponent component, private void OnUIMessageReceived(EntityUid uid, ReagentGrinderComponent component,
ServerBoundUserInterfaceMessage message) ServerBoundUserInterfaceMessage message)
{ {
@@ -199,12 +182,6 @@ namespace Content.Server.Kitchen.EntitySystems
} }
break; break;
case SharedReagentGrinderComponent.ReagentGrinderEjectBeakerMessage msg:
ClickSound(component);
EjectBeaker(component, message.Session.AttachedEntity);
EnqueueUiUpdate(component);
break;
} }
} }
@@ -219,7 +196,7 @@ namespace Content.Server.Kitchen.EntitySystems
bool canJuice = false; bool canJuice = false;
bool canGrind = false; bool canGrind = false;
if (comp.BeakerContainer.ContainedEntity != null) if (comp.BeakerSlot.HasItem)
{ {
foreach (var entity in comp.Chamber.ContainedEntities) foreach (var entity in comp.Chamber.ContainedEntities)
{ {
@@ -235,47 +212,17 @@ namespace Content.Server.Kitchen.EntitySystems
new ReagentGrinderInterfaceState new ReagentGrinderInterfaceState
( (
comp.Busy, comp.Busy,
comp.BeakerContainer.ContainedEntity != null, comp.BeakerSlot.HasItem,
EntityManager.TryGetComponent(comp.Owner, out ApcPowerReceiverComponent? receiver) && receiver.Powered, EntityManager.TryGetComponent(comp.Owner, out ApcPowerReceiverComponent? receiver) && receiver.Powered,
canJuice, canJuice,
canGrind, canGrind,
comp.Chamber.ContainedEntities.Select(item => item).ToArray(), comp.Chamber.ContainedEntities.Select(item => item).ToArray(),
//Remember the beaker can be null! //Remember the beaker can be null!
comp.HeldBeaker?.Contents.ToArray() comp.BeakerSolution?.Contents.ToArray()
)); ));
} }
} }
/// <summary>
/// Tries to eject whatever is in the beaker slot. Puts the item in the user's hands or failing that on top
/// of the grinder.
/// </summary>
private void EjectBeaker(ReagentGrinderComponent component, EntityUid? user)
{
if (component.BeakerContainer.ContainedEntity == null || component.HeldBeaker == null || component.Busy)
return;
if (component.BeakerContainer.ContainedEntity is not {Valid: true} beaker)
return;
component.BeakerContainer.Remove(beaker);
if (user == null ||
!EntityManager.TryGetComponent<HandsComponent?>(user.Value, out var hands) ||
!EntityManager.TryGetComponent<SharedItemComponent?>(beaker, out var item))
return;
_handsSystem.PickupOrDrop(user.Value, beaker, handsComp: hands, item: item);
component.HeldBeaker = null;
EnqueueUiUpdate(component);
if (EntityManager.TryGetComponent(component.Owner, out AppearanceComponent? appearance))
{
appearance.SetData(SharedReagentGrinderComponent.ReagentGrinderVisualState.BeakerAttached,
component.BeakerContainer.ContainedEntity != null);
}
}
/// <summary> /// <summary>
/// The wzhzhzh of the grinder. Processes the contents of the grinder and puts the output in the beaker. /// The wzhzhzh of the grinder. Processes the contents of the grinder and puts the output in the beaker.
/// </summary> /// </summary>
@@ -286,7 +233,8 @@ namespace Content.Server.Kitchen.EntitySystems
//Have power, are we busy, chamber has anything to grind, a beaker for the grounds to go? //Have power, are we busy, chamber has anything to grind, a beaker for the grounds to go?
if (!EntityManager.TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver) || !receiver.Powered || if (!EntityManager.TryGetComponent(component.Owner, out ApcPowerReceiverComponent? receiver) || !receiver.Powered ||
component.Busy || component.Chamber.ContainedEntities.Count <= 0 || component.Busy || component.Chamber.ContainedEntities.Count <= 0 ||
component.BeakerContainer.ContainedEntity == null || component.HeldBeaker == null) component.BeakerSlot.Item is not EntityUid beakerEntity ||
component.BeakerSolution == null)
{ {
return; return;
} }
@@ -295,7 +243,6 @@ namespace Content.Server.Kitchen.EntitySystems
var bui = component.Owner.GetUIOrNull(SharedReagentGrinderComponent.ReagentGrinderUiKey.Key); var bui = component.Owner.GetUIOrNull(SharedReagentGrinderComponent.ReagentGrinderUiKey.Key);
bui?.SendMessage(new SharedReagentGrinderComponent.ReagentGrinderWorkStartedMessage(program)); bui?.SendMessage(new SharedReagentGrinderComponent.ReagentGrinderWorkStartedMessage(program));
var beakerEntity = component.BeakerContainer.ContainedEntity;
switch (program) switch (program)
{ {
case SharedReagentGrinderComponent.GrinderProgram.Grind: case SharedReagentGrinderComponent.GrinderProgram.Grind:
@@ -312,10 +259,10 @@ namespace Content.Server.Kitchen.EntitySystems
var juiceEvent = new ExtractableScalingEvent(); // default of scalar is always 1.0 var juiceEvent = new ExtractableScalingEvent(); // default of scalar is always 1.0
RaiseLocalEvent(item, juiceEvent, false); RaiseLocalEvent(item, juiceEvent, false);
if (component.HeldBeaker.CurrentVolume + solution.CurrentVolume * juiceEvent.Scalar > if (component.BeakerSolution.CurrentVolume + solution.CurrentVolume * juiceEvent.Scalar >
component.HeldBeaker.MaxVolume) continue; component.BeakerSolution.MaxVolume) continue;
solution.ScaleSolution(juiceEvent.Scalar); solution.ScaleSolution(juiceEvent.Scalar);
_solutionsSystem.TryAddSolution(beakerEntity.Value, component.HeldBeaker, solution); _solutionsSystem.TryAddSolution(beakerEntity, component.BeakerSolution, solution);
EntityManager.DeleteEntity(item); EntityManager.DeleteEntity(item);
} }
@@ -343,11 +290,10 @@ namespace Content.Server.Kitchen.EntitySystems
RaiseLocalEvent(item, juiceEvent); RaiseLocalEvent(item, juiceEvent);
} }
if (component.HeldBeaker.CurrentVolume + if (component.BeakerSolution.CurrentVolume + juiceMe.JuiceSolution.TotalVolume * juiceEvent.Scalar > component.BeakerSolution.MaxVolume)
juiceMe.JuiceSolution.TotalVolume * juiceEvent.Scalar > continue;
component.HeldBeaker.MaxVolume) continue;
juiceMe.JuiceSolution.ScaleSolution(juiceEvent.Scalar); juiceMe.JuiceSolution.ScaleSolution(juiceEvent.Scalar);
_solutionsSystem.TryAddSolution(beakerEntity.Value, component.HeldBeaker, juiceMe.JuiceSolution); _solutionsSystem.TryAddSolution(beakerEntity, component.BeakerSolution, juiceMe.JuiceSolution);
EntityManager.DeleteEntity(item); EntityManager.DeleteEntity(item);
} }

View File

@@ -12,7 +12,7 @@ namespace Content.Server.Nuke
/// </summary> /// </summary>
[RegisterComponent] [RegisterComponent]
[Friend(typeof(NukeSystem))] [Friend(typeof(NukeSystem))]
public sealed class NukeComponent : Component public sealed class NukeComponent : SharedNukeComponent
{ {
/// <summary> /// <summary>
/// Default bomb timer value in seconds. /// Default bomb timer value in seconds.

View File

@@ -36,7 +36,6 @@ namespace Content.Server.Nuke
SubscribeLocalEvent<NukeComponent, AnchorStateChangedEvent>(OnAnchorChanged); SubscribeLocalEvent<NukeComponent, AnchorStateChangedEvent>(OnAnchorChanged);
// ui events // ui events
SubscribeLocalEvent<NukeComponent, NukeEjectMessage>(OnEjectButtonPressed);
SubscribeLocalEvent<NukeComponent, NukeAnchorMessage>(OnAnchorButtonPressed); SubscribeLocalEvent<NukeComponent, NukeAnchorMessage>(OnAnchorButtonPressed);
SubscribeLocalEvent<NukeComponent, NukeArmedMessage>(OnArmButtonPressed); SubscribeLocalEvent<NukeComponent, NukeArmedMessage>(OnArmButtonPressed);
SubscribeLocalEvent<NukeComponent, NukeKeypadMessage>(OnKeypadButtonPressed); SubscribeLocalEvent<NukeComponent, NukeKeypadMessage>(OnKeypadButtonPressed);
@@ -47,7 +46,7 @@ namespace Content.Server.Nuke
private void OnInit(EntityUid uid, NukeComponent component, ComponentInit args) private void OnInit(EntityUid uid, NukeComponent component, ComponentInit args)
{ {
component.RemainingTime = component.Timer; component.RemainingTime = component.Timer;
_itemSlots.AddItemSlot(uid, component.Name, component.DiskSlot); _itemSlots.AddItemSlot(uid, SharedNukeComponent.NukeDiskSlotId, component.DiskSlot);
UpdateStatus(uid, component); UpdateStatus(uid, component);
UpdateUserInterface(uid, component); UpdateUserInterface(uid, component);
@@ -118,14 +117,6 @@ namespace Content.Server.Nuke
#endregion #endregion
#region UI Events #region UI Events
private void OnEjectButtonPressed(EntityUid uid, NukeComponent component, NukeEjectMessage args)
{
if (!component.DiskSlot.HasItem)
return;
_itemSlots.TryEjectToHands(uid, component.DiskSlot, args.Session.AttachedEntity);
}
private async void OnAnchorButtonPressed(EntityUid uid, NukeComponent component, NukeAnchorMessage args) private async void OnAnchorButtonPressed(EntityUid uid, NukeComponent component, NukeAnchorMessage args)
{ {
if (!component.DiskSlot.HasItem) if (!component.DiskSlot.HasItem)

View File

@@ -155,16 +155,6 @@ namespace Content.Server.PDA
break; break;
} }
case PDAEjectIDMessage _:
{
ItemSlotsSystem.TryEjectToHands(pda.Owner, pda.IdSlot, playerUid);
break;
}
case PDAEjectPenMessage _:
{
ItemSlotsSystem.TryEjectToHands(pda.Owner, pda.PenSlot, playerUid);
break;
}
case PDAShowUplinkMessage _: case PDAShowUplinkMessage _:
{ {
if (EntityManager.TryGetComponent(pda.Owner, out UplinkComponent? uplink)) if (EntityManager.TryGetComponent(pda.Owner, out UplinkComponent? uplink))

View File

@@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using Content.Shared.Containers.ItemSlots; using Content.Shared.Containers.ItemSlots;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Shared.Access.Components namespace Content.Shared.Access.Components
{ {
@@ -12,29 +8,15 @@ namespace Content.Shared.Access.Components
public const int MaxFullNameLength = 256; public const int MaxFullNameLength = 256;
public const int MaxJobTitleLength = 256; public const int MaxJobTitleLength = 256;
public static string PrivilegedIdCardSlotId = "IdCardConsole-privilegedId";
public static string TargetIdCardSlotId = "IdCardConsole-targetId";
[DataField("privilegedIdSlot")] [DataField("privilegedIdSlot")]
public ItemSlot PrivilegedIdSlot = new(); public ItemSlot PrivilegedIdSlot = new();
[DataField("targetIdSlot")] [DataField("targetIdSlot")]
public ItemSlot TargetIdSlot = new(); public ItemSlot TargetIdSlot = new();
public enum UiButton
{
PrivilegedId,
TargetId,
}
[Serializable, NetSerializable]
public sealed class IdButtonPressedMessage : BoundUserInterfaceMessage
{
public readonly UiButton Button;
public IdButtonPressedMessage(UiButton button)
{
Button = button;
}
}
[Serializable, NetSerializable] [Serializable, NetSerializable]
public sealed class WriteToTargetIdMessage : BoundUserInterfaceMessage public sealed class WriteToTargetIdMessage : BoundUserInterfaceMessage
{ {

View File

@@ -1,8 +1,6 @@
using Content.Shared.Access.Components; using Content.Shared.Access.Components;
using Content.Shared.Containers.ItemSlots; using Content.Shared.Containers.ItemSlots;
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Shared.Access.Systems namespace Content.Shared.Access.Systems
{ {
@@ -21,8 +19,8 @@ namespace Content.Shared.Access.Systems
private void OnComponentInit(EntityUid uid, SharedIdCardConsoleComponent component, ComponentInit args) private void OnComponentInit(EntityUid uid, SharedIdCardConsoleComponent component, ComponentInit args)
{ {
_itemSlotsSystem.AddItemSlot(uid, $"{component.Name}-privilegedId", component.PrivilegedIdSlot); _itemSlotsSystem.AddItemSlot(uid, SharedIdCardConsoleComponent.PrivilegedIdCardSlotId, component.PrivilegedIdSlot);
_itemSlotsSystem.AddItemSlot(uid, $"{component.Name}-targetId", component.TargetIdSlot); _itemSlotsSystem.AddItemSlot(uid, SharedIdCardConsoleComponent.TargetIdCardSlotId, component.TargetIdSlot);
} }
private void OnComponentRemove(EntityUid uid, SharedIdCardConsoleComponent component, ComponentRemove args) private void OnComponentRemove(EntityUid uid, SharedIdCardConsoleComponent component, ComponentRemove args)

View File

@@ -1,11 +1,7 @@
using System;
using System.Collections.Generic;
using Content.Shared.Cloning; using Content.Shared.Cloning;
using Content.Shared.Containers.ItemSlots; using Content.Shared.Containers.ItemSlots;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Shared.Chemistry.Components namespace Content.Shared.Chemistry.Components
{ {
@@ -16,6 +12,8 @@ namespace Content.Shared.Chemistry.Components
[Virtual] [Virtual]
public class SharedChemMasterComponent : Component public class SharedChemMasterComponent : Component
{ {
public static string BeakerSlotId = "ChemMaster-beaker";
[DataField("beakerSlot")] [DataField("beakerSlot")]
public ItemSlot BeakerSlot = new(); public ItemSlot BeakerSlot = new();
public const string SolutionName = "buffer"; public const string SolutionName = "buffer";
@@ -124,7 +122,6 @@ namespace Content.Shared.Chemistry.Components
/// </summary> /// </summary>
public enum UiAction public enum UiAction
{ {
Eject,
Transfer, Transfer,
Discard, Discard,
ChemButton, ChemButton,

View File

@@ -1,11 +1,6 @@
using System;
using System.Collections.Generic;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.Containers.ItemSlots; using Content.Shared.Containers.ItemSlots;
using Content.Shared.FixedPoint; using Content.Shared.FixedPoint;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
using Robust.Shared.Serialization.Manager.Attributes;
namespace Content.Shared.Chemistry.Dispenser namespace Content.Shared.Chemistry.Dispenser
{ {
@@ -18,6 +13,8 @@ namespace Content.Shared.Chemistry.Dispenser
[Virtual] [Virtual]
public class SharedReagentDispenserComponent : Component public class SharedReagentDispenserComponent : Component
{ {
public const string BeakerSlotId = "ReagentDispenser-beaker";
[DataField("beakerSlot")] [DataField("beakerSlot")]
public ItemSlot BeakerSlot = new(); public ItemSlot BeakerSlot = new();
@@ -87,7 +84,6 @@ namespace Content.Shared.Chemistry.Dispenser
/// </summary> /// </summary>
public enum UiButton public enum UiButton
{ {
Eject,
Clear, Clear,
SetDispenseAmount1, SetDispenseAmount1,
SetDispenseAmount5, SetDispenseAmount5,

View File

@@ -21,7 +21,7 @@ namespace Content.Shared.Chemistry.EntitySystems
private void OnComponentInit(EntityUid uid, SharedChemMasterComponent component, ComponentInit args) private void OnComponentInit(EntityUid uid, SharedChemMasterComponent component, ComponentInit args)
{ {
_itemSlotsSystem.AddItemSlot(uid, $"{component.Name}-beaker", component.BeakerSlot); _itemSlotsSystem.AddItemSlot(uid, SharedChemMasterComponent.BeakerSlotId, component.BeakerSlot);
} }
private void OnComponentRemove(EntityUid uid, SharedChemMasterComponent component, ComponentRemove args) private void OnComponentRemove(EntityUid uid, SharedChemMasterComponent component, ComponentRemove args)

View File

@@ -1,6 +1,4 @@
using JetBrains.Annotations; using JetBrains.Annotations;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
using Content.Shared.Containers.ItemSlots; using Content.Shared.Containers.ItemSlots;
using Content.Shared.Chemistry.Dispenser; using Content.Shared.Chemistry.Dispenser;
@@ -21,7 +19,7 @@ namespace Content.Shared.Chemistry.EntitySystems
private void OnComponentInit(EntityUid uid, SharedReagentDispenserComponent component, ComponentInit args) private void OnComponentInit(EntityUid uid, SharedReagentDispenserComponent component, ComponentInit args)
{ {
_itemSlotsSystem.AddItemSlot(uid, $"{component.Name}-beaker", component.BeakerSlot); _itemSlotsSystem.AddItemSlot(uid, SharedReagentDispenserComponent.BeakerSlotId, component.BeakerSlot);
} }
private void OnComponentRemove(EntityUid uid, SharedReagentDispenserComponent component, ComponentRemove args) private void OnComponentRemove(EntityUid uid, SharedReagentDispenserComponent component, ComponentRemove args)

View File

@@ -0,0 +1,32 @@
using Robust.Shared.Serialization;
namespace Content.Shared.Containers.ItemSlots;
/// <summary>
/// Used for various "eject this item" buttons.
/// </summary>
[Serializable, NetSerializable]
public sealed class ItemSlotButtonPressedEvent : BoundUserInterfaceMessage
{
/// <summary>
/// The name of the slot/container from which to insert or eject an item.
/// </summary>
public string SlotId;
/// <summary>
/// Whether to attempt to insert an item into the slot, if there is not already one inside.
/// </summary>
public bool TryInsert;
/// <summary>
/// Whether to attempt to eject the item from the slot, if it has one.
/// </summary>
public bool TryEject;
public ItemSlotButtonPressedEvent(string slotId, bool tryEject = true, bool tryInsert = true)
{
SlotId = slotId;
TryEject = tryEject;
TryInsert = tryInsert;
}
}

View File

@@ -45,6 +45,8 @@ namespace Content.Shared.Containers.ItemSlots
SubscribeLocalEvent<ItemSlotsComponent, ComponentGetState>(GetItemSlotsState); SubscribeLocalEvent<ItemSlotsComponent, ComponentGetState>(GetItemSlotsState);
SubscribeLocalEvent<ItemSlotsComponent, ComponentHandleState>(HandleItemSlotsState); SubscribeLocalEvent<ItemSlotsComponent, ComponentHandleState>(HandleItemSlotsState);
SubscribeLocalEvent<ItemSlotsComponent, ItemSlotButtonPressedEvent>(HandleButtonPressed);
} }
#region ComponentManagement #region ComponentManagement
@@ -291,7 +293,7 @@ namespace Content.Shared.Containers.ItemSlots
return false; return false;
// hands.Drop(item) checks CanDrop action blocker // hands.Drop(item) checks CanDrop action blocker
if (_handsSystem.TryDrop(user, hands.ActiveHand)) if (!_handsSystem.TryDrop(user, hands.ActiveHand))
return false; return false;
Insert(uid, slot, held, user); Insert(uid, slot, held, user);
@@ -490,6 +492,19 @@ namespace Content.Shared.Containers.ItemSlots
} }
#endregion #endregion
#region BUIs
private void HandleButtonPressed(EntityUid uid, ItemSlotsComponent component, ItemSlotButtonPressedEvent args)
{
if (!component.Slots.TryGetValue(args.SlotId, out var slot))
return;
if (args.TryEject && slot.HasItem)
TryEjectToHands(uid, slot, args.Session.AttachedEntity);
else if (args.TryInsert && !slot.HasItem && args.Session.AttachedEntity is EntityUid user)
TryInsertFromHand(uid, slot, user);
}
#endregion
/// <summary> /// <summary>
/// Eject items from (some) slots when the entity is destroyed. /// Eject items from (some) slots when the entity is destroyed.
/// </summary> /// </summary>

View File

@@ -5,8 +5,11 @@ using Robust.Shared.Serialization;
namespace Content.Shared.Kitchen.Components namespace Content.Shared.Kitchen.Components
{ {
public abstract class SharedReagentGrinderComponent : Component public abstract class SharedReagentGrinderComponent : Component
{ {
public static string BeakerSlotId = "ReagentGrinder-reagentContainerContainer";
[Serializable, NetSerializable] [Serializable, NetSerializable]
public sealed class ReagentGrinderGrindStartMessage : BoundUserInterfaceMessage public sealed class ReagentGrinderGrindStartMessage : BoundUserInterfaceMessage
{ {
@@ -31,14 +34,6 @@ namespace Content.Shared.Kitchen.Components
} }
} }
[Serializable, NetSerializable]
public sealed class ReagentGrinderEjectBeakerMessage : BoundUserInterfaceMessage
{
public ReagentGrinderEjectBeakerMessage()
{
}
}
[Serializable, NetSerializable] [Serializable, NetSerializable]
public sealed class ReagentGrinderEjectChamberContentMessage : BoundUserInterfaceMessage public sealed class ReagentGrinderEjectChamberContentMessage : BoundUserInterfaceMessage
{ {

View File

@@ -1,12 +1,10 @@
using System;
using Robust.Shared.GameObjects;
using Robust.Shared.Serialization; using Robust.Shared.Serialization;
namespace Content.Shared.Nuke namespace Content.Shared.Nuke
{ {
[Serializable, NetSerializable] public abstract class SharedNukeComponent : Component
public sealed class NukeEjectMessage : BoundUserInterfaceMessage
{ {
public const string NukeDiskSlotId = "Nuke";
} }
[Serializable, NetSerializable] [Serializable, NetSerializable]

View File

@@ -1,16 +1,16 @@
using Content.Shared.Access.Components; using Content.Shared.Access.Components;
using Content.Shared.Containers.ItemSlots; using Content.Shared.Containers.ItemSlots;
using Robust.Shared.GameObjects;
using Robust.Shared.Prototypes; using Robust.Shared.Prototypes;
using Robust.Shared.Serialization.Manager.Attributes;
using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype; using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype;
using Robust.Shared.ViewVariables;
namespace Content.Shared.PDA namespace Content.Shared.PDA
{ {
[RegisterComponent] [RegisterComponent]
public sealed class PDAComponent : Component public sealed class PDAComponent : Component
{ {
public const string PDAIdSlotId = "PDA-id";
public const string PDAPenSlotId = "PDA-pen";
[DataField("idSlot")] [DataField("idSlot")]
public ItemSlot IdSlot = new(); public ItemSlot IdSlot = new();

View File

@@ -13,23 +13,6 @@ namespace Content.Shared.PDA
} }
} }
[Serializable, NetSerializable]
public sealed class PDAEjectIDMessage : BoundUserInterfaceMessage
{
public PDAEjectIDMessage()
{
}
}
[Serializable, NetSerializable]
public sealed class PDAEjectPenMessage : BoundUserInterfaceMessage
{
public PDAEjectPenMessage()
{
}
}
[Serializable, NetSerializable] [Serializable, NetSerializable]
public sealed class PDAShowRingtoneMessage : BoundUserInterfaceMessage public sealed class PDAShowRingtoneMessage : BoundUserInterfaceMessage
{ {

View File

@@ -26,8 +26,8 @@ namespace Content.Shared.PDA
if (pda.IdCard != null) if (pda.IdCard != null)
pda.IdSlot.StartingItem = pda.IdCard; pda.IdSlot.StartingItem = pda.IdCard;
ItemSlotsSystem.AddItemSlot(uid, $"{pda.Name}-id", pda.IdSlot); ItemSlotsSystem.AddItemSlot(uid, PDAComponent.PDAIdSlotId, pda.IdSlot);
ItemSlotsSystem.AddItemSlot(uid, $"{pda.Name}-pen", pda.PenSlot); ItemSlotsSystem.AddItemSlot(uid, PDAComponent.PDAPenSlotId, pda.PenSlot);
UpdatePDAAppearance(pda); UpdatePDAAppearance(pda);
} }

View File

@@ -11,6 +11,3 @@ grinder-menu-chamber-content-box-button = Eject Contents
grinder-menu-beaker-content-box-label = Beaker grinder-menu-beaker-content-box-label = Beaker
grinder-menu-beaker-content-box-button = Eject Beaker grinder-menu-beaker-content-box-button = Eject Beaker
grinder-menu-beaker-content-box-is-empty = Empty grinder-menu-beaker-content-box-is-empty = Empty
## Entity
reagent-grinder-component-interact-using-no-hands = You have no hands.

View File

@@ -8,6 +8,16 @@
- type: Transform - type: Transform
anchored: true anchored: true
- type: ReagentGrinder - type: ReagentGrinder
beakerSlot:
insertSound: /Audio/Machines/machine_switch.ogg
ejectSound: /Audio/Machines/machine_switch.ogg
soundOptions:
volume: -2
whitelist:
components:
- FitsInDispenser
- type: ActivatableUI
key: enum.ReagentGrinderUiKey.Key
- type: UserInterface - type: UserInterface
interfaces: interfaces:
- key: enum.ReagentGrinderUiKey.Key - key: enum.ReagentGrinderUiKey.Key