make emagged marker component (fixed version of #13867) (#14096)

* The all-in-one hacking solution
The thinking man's lockpick
The iconic EMAG

* emagged medbay's stasis bed

* left med, emagged sec' apc

* went back to chem, emagged the dispenser

* emagged the fax while i was there

* had a donut while waiting for emag to charge

* i broke into the bridge then announced 'mandatory johnson inspection in medical'

* get system instead of dependency

* feedback

* net suggestion

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>

* use EnsureComp and import NetworkedComponent

---------

Co-authored-by: deltanedas <user@zenith>
Co-authored-by: deltanedas <deltanedas@laptop>
Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
deltanedas
2023-02-19 01:03:06 +00:00
committed by GitHub
parent 04a0faf478
commit 98b02b3d97
19 changed files with 65 additions and 84 deletions

View File

@@ -5,6 +5,7 @@ using Content.Shared.Chemistry;
using Content.Shared.Chemistry.Dispenser;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Database;
using Content.Shared.Emag.Components;
using Content.Shared.Emag.Systems;
using Content.Shared.FixedPoint;
using JetBrains.Annotations;
@@ -79,7 +80,7 @@ namespace Content.Server.Chemistry.EntitySystems
inventory.AddRange(packPrototype.Inventory);
}
if (reagentDispenser.IsEmagged
if (HasComp<EmaggedComponent>(reagentDispenser.Owner)
&& reagentDispenser.EmagPackPrototypeId is not null
&& _prototypeManager.TryIndex(reagentDispenser.EmagPackPrototypeId, out ReagentDispenserInventoryPrototype? emagPackPrototype))
{
@@ -91,12 +92,10 @@ namespace Content.Server.Chemistry.EntitySystems
private void OnEmagged(EntityUid uid, ReagentDispenserComponent reagentDispenser, ref GotEmaggedEvent args)
{
if (!reagentDispenser.IsEmagged)
{
reagentDispenser.IsEmagged = true;
args.Handled = true;
UpdateUiState(reagentDispenser);
}
// adding component manually to have correct state
EntityManager.AddComponent<EmaggedComponent>(uid);
UpdateUiState(reagentDispenser);
args.Handled = true;
}
private void OnSetDispenseAmountMessage(EntityUid uid, ReagentDispenserComponent reagentDispenser, ReagentDispenserSetDispenseAmountMessage message)