Nuke PowerChangedMessage (#7231)
This commit is contained in:
17
Content.Server/Arcade/ArcadeSystem.BlockGame.cs
Normal file
17
Content.Server/Arcade/ArcadeSystem.BlockGame.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Content.Server.Arcade.Components;
|
||||
using Content.Server.Power.Components;
|
||||
|
||||
namespace Content.Server.Arcade;
|
||||
|
||||
public sealed partial class ArcadeSystem
|
||||
{
|
||||
private void InitializeBlockGame()
|
||||
{
|
||||
SubscribeLocalEvent<BlockGameArcadeComponent, PowerChangedEvent>(OnBlockPowerChanged);
|
||||
}
|
||||
|
||||
private static void OnBlockPowerChanged(EntityUid uid, BlockGameArcadeComponent component, PowerChangedEvent args)
|
||||
{
|
||||
component.OnPowerStateChanged(args);
|
||||
}
|
||||
}
|
||||
17
Content.Server/Arcade/ArcadeSystem.SpaceVillain.cs
Normal file
17
Content.Server/Arcade/ArcadeSystem.SpaceVillain.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using Content.Server.Arcade.Components;
|
||||
using Content.Server.Power.Components;
|
||||
|
||||
namespace Content.Server.Arcade;
|
||||
|
||||
public sealed partial class ArcadeSystem
|
||||
{
|
||||
private void InitializeSpaceVillain()
|
||||
{
|
||||
SubscribeLocalEvent<SpaceVillainArcadeComponent, PowerChangedEvent>(OnSVillainPower);
|
||||
}
|
||||
|
||||
private void OnSVillainPower(EntityUid uid, SpaceVillainArcadeComponent component, PowerChangedEvent args)
|
||||
{
|
||||
component.OnPowerStateChanged(args);
|
||||
}
|
||||
}
|
||||
@@ -9,7 +9,7 @@ using Robust.Server.GameObjects;
|
||||
namespace Content.Server.Arcade
|
||||
{
|
||||
// ReSharper disable once ClassNeverInstantiated.Global
|
||||
public sealed class ArcadeSystem : EntitySystem
|
||||
public sealed partial class ArcadeSystem : EntitySystem
|
||||
{
|
||||
private readonly List<BlockGameMessages.HighScoreEntry> _roundHighscores = new();
|
||||
private readonly List<BlockGameMessages.HighScoreEntry> _globalHighscores = new();
|
||||
@@ -19,6 +19,8 @@ namespace Content.Server.Arcade
|
||||
base.Initialize();
|
||||
SubscribeLocalEvent<BlockGameArcadeComponent, AfterActivatableUIOpenEvent>(OnAfterUIOpen);
|
||||
SubscribeLocalEvent<SpaceVillainArcadeComponent, AfterActivatableUIOpenEvent>(OnAfterUIOpenSV);
|
||||
InitializeBlockGame();
|
||||
InitializeSpaceVillain();
|
||||
}
|
||||
|
||||
private void OnAfterUIOpen(EntityUid uid, BlockGameArcadeComponent component, AfterActivatableUIOpenEvent args)
|
||||
|
||||
@@ -23,20 +23,6 @@ namespace Content.Server.Arcade.Components
|
||||
private IPlayerSession? _player;
|
||||
private readonly List<IPlayerSession> _spectators = new();
|
||||
|
||||
[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:
|
||||
OnPowerStateChanged(powerChanged);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public void RegisterPlayerSession(IPlayerSession session)
|
||||
{
|
||||
if (_player == null) _player = session;
|
||||
@@ -92,7 +78,7 @@ namespace Content.Server.Arcade.Components
|
||||
_game = new BlockGame(this);
|
||||
}
|
||||
|
||||
private void OnPowerStateChanged(PowerChangedMessage e)
|
||||
public void OnPowerStateChanged(PowerChangedEvent e)
|
||||
{
|
||||
if (e.Powered) return;
|
||||
|
||||
|
||||
@@ -73,28 +73,13 @@ namespace Content.Server.Arcade.Components
|
||||
}
|
||||
}
|
||||
|
||||
[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:
|
||||
OnOnPowerStateChanged(powerChanged);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnOnPowerStateChanged(PowerChangedMessage e)
|
||||
public void OnPowerStateChanged(PowerChangedEvent e)
|
||||
{
|
||||
if (e.Powered) return;
|
||||
|
||||
UserInterface?.CloseAll();
|
||||
}
|
||||
|
||||
|
||||
private void UserInterfaceOnOnReceiveMessage(ServerBoundUserInterfaceMessage serverMsg)
|
||||
{
|
||||
if (!Powered)
|
||||
|
||||
Reference in New Issue
Block a user