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

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

View File

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