Nuke PowerChangedMessage (#7231)

This commit is contained in:
metalgearsloth
2022-03-29 03:58:51 +11:00
committed by GitHub
parent 2d610ebb52
commit 49163f1dec
18 changed files with 134 additions and 140 deletions

View File

@@ -68,25 +68,6 @@ namespace Content.Server.Chemistry.Components
_bufferSolution = EntitySystem.Get<SolutionContainerSystem>().EnsureSolution(Owner, SolutionName);
}
[Obsolete("Component Messages are deprecated, use Entity Events instead.")]
public override void HandleMessage(ComponentMessage message, IComponent? component)
{
#pragma warning disable 618
base.HandleMessage(message, component);
#pragma warning restore 618
switch (message)
{
case PowerChangedMessage:
OnPowerChanged();
break;
}
}
private void OnPowerChanged()
{
UpdateUserInterface();
}
/// <summary>
/// Handles ui messages from the client. For things such as button presses
/// which interact with the world and require server action.

View File

@@ -74,20 +74,6 @@ namespace Content.Server.Chemistry.Components
InitializeFromPrototype();
}
[Obsolete("Component Messages are deprecated, use Entity Events instead.")]
public override void HandleMessage(ComponentMessage message, IComponent? component)
{
#pragma warning disable 618
base.HandleMessage(message, component);
#pragma warning restore 618
switch (message)
{
case PowerChangedMessage powerChanged:
OnPowerChanged(powerChanged);
break;
}
}
/// <summary>
/// Checks to see if the <c>pack</c> defined in this components yaml prototype
/// exists. If so, it fills the reagent inventory list.
@@ -127,7 +113,7 @@ namespace Content.Server.Chemistry.Components
}
private void OnPowerChanged(PowerChangedMessage e)
public void OnPowerChanged()
{
UpdateUserInterface();
}

View File

@@ -0,0 +1,17 @@
using Content.Server.Chemistry.Components;
using Content.Server.Power.Components;
namespace Content.Server.Chemistry.EntitySystems;
public sealed partial class ChemistrySystem
{
private void InitializeChemMaster()
{
SubscribeLocalEvent<ChemMasterComponent, PowerChangedEvent>(OnChemMasterPowerChange);
}
private static void OnChemMasterPowerChange(EntityUid uid, ChemMasterComponent component, PowerChangedEvent args)
{
component.UpdateUserInterface();
}
}

View File

@@ -0,0 +1,17 @@
using Content.Server.Chemistry.Components;
using Content.Server.Power.Components;
namespace Content.Server.Chemistry.EntitySystems;
public sealed partial class ChemistrySystem
{
private void InitializeReagentDispenser()
{
SubscribeLocalEvent<ReagentDispenserComponent, PowerChangedEvent>(OnReagentDispenserPower);
}
private static void OnReagentDispenserPower(EntityUid uid, ReagentDispenserComponent component, PowerChangedEvent args)
{
component.OnPowerChanged();
}
}

View File

@@ -18,7 +18,10 @@ public sealed partial class ChemistrySystem : EntitySystem
public override void Initialize()
{
// Why ChemMaster duplicates reagentdispenser nobody knows.
InitializeChemMaster();
InitializeHypospray();
InitializeInjector();
InitializeReagentDispenser();
}
}