Nuke PowerChangedMessage (#7231)
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -18,7 +18,10 @@ public sealed partial class ChemistrySystem : EntitySystem
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
// Why ChemMaster duplicates reagentdispenser nobody knows.
|
||||
InitializeChemMaster();
|
||||
InitializeHypospray();
|
||||
InitializeInjector();
|
||||
InitializeReagentDispenser();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user