Chem stuff QoL (#321)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Content.Server.Chemistry.Components;
|
||||
using Content.Server.Chemistry.Containers.EntitySystems;
|
||||
using Content.Server.DeviceLinking.Systems;
|
||||
using Content.Server.Labels;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.Storage.EntitySystems;
|
||||
@@ -10,6 +11,7 @@ using Content.Shared.Chemistry.EntitySystems;
|
||||
using Content.Shared.Chemistry.Reagent;
|
||||
using Content.Shared.Containers.ItemSlots;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.DeviceLinking.Events;
|
||||
using Content.Shared.FixedPoint;
|
||||
using Content.Shared.Storage;
|
||||
using JetBrains.Annotations;
|
||||
@@ -39,6 +41,8 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
[Dependency] private readonly StorageSystem _storageSystem = default!;
|
||||
[Dependency] private readonly LabelSystem _labelSystem = default!;
|
||||
[Dependency] private readonly ISharedAdminLogManager _adminLogger = default!;
|
||||
[Dependency] private readonly ReagentDispenserSystem _dispenserSystem = default!; // WD
|
||||
[Dependency] private readonly DeviceLinkSystem _signalSystem = default!; // WD
|
||||
|
||||
[ValidatePrototypeId<EntityPrototype>]
|
||||
private const string PillPrototypeId = "Pill";
|
||||
@@ -53,6 +57,13 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
SubscribeLocalEvent<ChemMasterComponent, EntRemovedFromContainerMessage>(SubscribeUpdateUiState);
|
||||
SubscribeLocalEvent<ChemMasterComponent, BoundUIOpenedEvent>(SubscribeUpdateUiState);
|
||||
|
||||
// WD START
|
||||
SubscribeLocalEvent<ChemMasterComponent, ComponentInit>(OnComponentInit);
|
||||
SubscribeLocalEvent<ChemMasterComponent, PortDisconnectedEvent>(OnPortDisconnected);
|
||||
SubscribeLocalEvent<ChemMasterComponent, AnchorStateChangedEvent>(OnAnchor);
|
||||
// WD END
|
||||
|
||||
|
||||
SubscribeLocalEvent<ChemMasterComponent, ChemMasterSetModeMessage>(OnSetModeMessage);
|
||||
SubscribeLocalEvent<ChemMasterComponent, ChemMasterSetPillTypeMessage>(OnSetPillTypeMessage);
|
||||
SubscribeLocalEvent<ChemMasterComponent, ChemMasterReagentAmountButtonMessage>(OnReagentButtonMessage);
|
||||
@@ -60,12 +71,36 @@ namespace Content.Server.Chemistry.EntitySystems
|
||||
SubscribeLocalEvent<ChemMasterComponent, ChemMasterOutputToBottleMessage>(OnOutputToBottleMessage);
|
||||
}
|
||||
|
||||
// WD START
|
||||
private void OnComponentInit(EntityUid uid, ChemMasterComponent clonePod, ComponentInit args)
|
||||
{
|
||||
_signalSystem.EnsureSinkPorts(uid, ChemMasterComponent.ChemMasterPort);
|
||||
}
|
||||
|
||||
private void OnPortDisconnected(EntityUid uid, ChemMasterComponent component, PortDisconnectedEvent args)
|
||||
{
|
||||
component.ConnectedDispenser = null;
|
||||
}
|
||||
|
||||
private void OnAnchor(EntityUid uid, ChemMasterComponent component, ref AnchorStateChangedEvent args)
|
||||
{
|
||||
if (component.ConnectedDispenser == null ||
|
||||
!TryComp<ReagentDispenserComponent>(component.ConnectedDispenser, out var dispenserComp))
|
||||
return;
|
||||
|
||||
if (!args.Anchored)
|
||||
return;
|
||||
|
||||
_dispenserSystem.UpdateConnection(component.ConnectedDispenser.Value, uid, dispenserComp, component);
|
||||
}
|
||||
// WD END
|
||||
|
||||
private void SubscribeUpdateUiState<T>(Entity<ChemMasterComponent> ent, ref T ev)
|
||||
{
|
||||
UpdateUiState(ent);
|
||||
}
|
||||
|
||||
private void UpdateUiState(Entity<ChemMasterComponent> ent, bool updateLabel = false)
|
||||
public void UpdateUiState(Entity<ChemMasterComponent> ent, bool updateLabel = false) // WD EDIT
|
||||
{
|
||||
var (owner, chemMaster) = ent;
|
||||
if (!_solutionContainerSystem.TryGetSolution(owner, SharedChemMaster.BufferSolutionName, out _, out var bufferSolution))
|
||||
|
||||
Reference in New Issue
Block a user