Turn SandboxManager into a system (#6867)
This commit is contained in:
@@ -1,17 +1,12 @@
|
|||||||
using System.IO;
|
using System.IO;
|
||||||
using Content.Client.Administration.Managers;
|
using Content.Client.Administration.Managers;
|
||||||
using Content.Client.Decals.UI;
|
using Content.Client.Decals.UI;
|
||||||
|
using Content.Client.Sandbox;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
using Robust.Client.Placement;
|
|
||||||
using Robust.Client.ResourceManagement;
|
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
|
||||||
using Robust.Client.UserInterface.XAML;
|
using Robust.Client.UserInterface.XAML;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Map;
|
|
||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
|
||||||
namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
||||||
@@ -19,10 +14,6 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
|||||||
[GenerateTypedNameReferences]
|
[GenerateTypedNameReferences]
|
||||||
public sealed partial class AdminbusTab : Control
|
public sealed partial class AdminbusTab : Control
|
||||||
{
|
{
|
||||||
private EntitySpawnWindow? _entitySpawnWindow;
|
|
||||||
private TileSpawnWindow? _tileSpawnWindow;
|
|
||||||
private DecalPlacerWindow? _decalPlacerWindow;
|
|
||||||
|
|
||||||
public AdminbusTab()
|
public AdminbusTab()
|
||||||
{
|
{
|
||||||
RobustXamlLoader.Load(this);
|
RobustXamlLoader.Load(this);
|
||||||
@@ -53,38 +44,17 @@ namespace Content.Client.Administration.UI.Tabs.AdminbusTab
|
|||||||
|
|
||||||
private void SpawnEntitiesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
private void SpawnEntitiesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||||
{
|
{
|
||||||
//FIXME: WE SHOULDN'T NEED TO CHECK FOR DISPOSED
|
EntitySystem.Get<SandboxSystem>().ToggleEntitySpawnWindow();
|
||||||
if (_entitySpawnWindow == null || _entitySpawnWindow.Disposed)
|
|
||||||
{
|
|
||||||
_entitySpawnWindow = new EntitySpawnWindow(IoCManager.Resolve<IPlacementManager>(),
|
|
||||||
IoCManager.Resolve<IPrototypeManager>(),
|
|
||||||
IoCManager.Resolve<IResourceCache>());
|
|
||||||
}
|
|
||||||
|
|
||||||
EntitySystem.Get<AdminSystem>().OpenCommand(_entitySpawnWindow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SpawnTilesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
private void SpawnTilesButtonOnOnPressed(BaseButton.ButtonEventArgs obj)
|
||||||
{
|
{
|
||||||
//FIXME: WE SHOULDN'T NEED TO CHECK FOR DISPOSED
|
EntitySystem.Get<SandboxSystem>().ToggleTilesWindow();
|
||||||
if (_tileSpawnWindow == null || _tileSpawnWindow.Disposed)
|
|
||||||
{
|
|
||||||
_tileSpawnWindow = new TileSpawnWindow(IoCManager.Resolve<ITileDefinitionManager>(),
|
|
||||||
IoCManager.Resolve<IPlacementManager>(),
|
|
||||||
IoCManager.Resolve<IResourceCache>());
|
|
||||||
}
|
|
||||||
|
|
||||||
EntitySystem.Get<AdminSystem>().OpenCommand(_tileSpawnWindow);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SpawnDecalsButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
private void SpawnDecalsButtonOnPressed(BaseButton.ButtonEventArgs obj)
|
||||||
{
|
{
|
||||||
if (_decalPlacerWindow == null || _decalPlacerWindow.Disposed)
|
EntitySystem.Get<SandboxSystem>().ToggleDecalsWindow();
|
||||||
{
|
|
||||||
_decalPlacerWindow = new DecalPlacerWindow(IoCManager.Resolve<IPrototypeManager>());
|
|
||||||
}
|
|
||||||
|
|
||||||
EntitySystem.Get<AdminSystem>().OpenCommand(_decalPlacerWindow);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -186,7 +186,6 @@ namespace Content.Client.Entry
|
|||||||
overlayMgr.AddOverlay(new RadiationPulseOverlay());
|
overlayMgr.AddOverlay(new RadiationPulseOverlay());
|
||||||
|
|
||||||
IoCManager.Resolve<IChatManager>().Initialize();
|
IoCManager.Resolve<IChatManager>().Initialize();
|
||||||
IoCManager.Resolve<ISandboxManager>().Initialize();
|
|
||||||
IoCManager.Resolve<IClientPreferencesManager>().Initialize();
|
IoCManager.Resolve<IClientPreferencesManager>().Initialize();
|
||||||
IoCManager.Resolve<IStationEventManager>().Initialize();
|
IoCManager.Resolve<IStationEventManager>().Initialize();
|
||||||
IoCManager.Resolve<EuiManager>().Initialize();
|
IoCManager.Resolve<EuiManager>().Initialize();
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
using Content.Client.Administration;
|
using Content.Client.Administration.Managers;
|
||||||
using Content.Client.Administration.Managers;
|
|
||||||
using Content.Client.Changelog;
|
using Content.Client.Changelog;
|
||||||
using Content.Client.Chat.Managers;
|
using Content.Client.Chat.Managers;
|
||||||
using Content.Client.Clickable;
|
using Content.Client.Clickable;
|
||||||
@@ -11,7 +10,6 @@ using Content.Client.Items.Managers;
|
|||||||
using Content.Client.Module;
|
using Content.Client.Module;
|
||||||
using Content.Client.Parallax.Managers;
|
using Content.Client.Parallax.Managers;
|
||||||
using Content.Client.Preferences;
|
using Content.Client.Preferences;
|
||||||
using Content.Client.Sandbox;
|
|
||||||
using Content.Client.Screenshot;
|
using Content.Client.Screenshot;
|
||||||
using Content.Client.StationEvents.Managers;
|
using Content.Client.StationEvents.Managers;
|
||||||
using Content.Client.Stylesheets;
|
using Content.Client.Stylesheets;
|
||||||
@@ -20,7 +18,6 @@ using Content.Client.Voting;
|
|||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Module;
|
using Content.Shared.Module;
|
||||||
using Robust.Shared.IoC;
|
|
||||||
|
|
||||||
namespace Content.Client.IoC
|
namespace Content.Client.IoC
|
||||||
{
|
{
|
||||||
@@ -32,7 +29,6 @@ namespace Content.Client.IoC
|
|||||||
IoCManager.Register<IParallaxManager, ParallaxManager>();
|
IoCManager.Register<IParallaxManager, ParallaxManager>();
|
||||||
IoCManager.Register<IChatManager, ChatManager>();
|
IoCManager.Register<IChatManager, ChatManager>();
|
||||||
IoCManager.Register<IEscapeMenuOwner, EscapeMenuOwner>();
|
IoCManager.Register<IEscapeMenuOwner, EscapeMenuOwner>();
|
||||||
IoCManager.Register<ISandboxManager, SandboxManager>();
|
|
||||||
IoCManager.Register<IModuleManager, ClientModuleManager>();
|
IoCManager.Register<IModuleManager, ClientModuleManager>();
|
||||||
IoCManager.Register<IClientPreferencesManager, ClientPreferencesManager>();
|
IoCManager.Register<IClientPreferencesManager, ClientPreferencesManager>();
|
||||||
IoCManager.Register<IItemSlotManager, ItemSlotManager>();
|
IoCManager.Register<IItemSlotManager, ItemSlotManager>();
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
using System;
|
|
||||||
|
|
||||||
namespace Content.Client.Sandbox
|
|
||||||
{
|
|
||||||
public interface ISandboxManager
|
|
||||||
{
|
|
||||||
void Initialize();
|
|
||||||
bool SandboxAllowed { get; }
|
|
||||||
event Action<bool> AllowedChanged;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +1,12 @@
|
|||||||
using System;
|
using Content.Client.Administration.Managers;
|
||||||
using Content.Client.Decals.UI;
|
using Content.Client.Decals.UI;
|
||||||
using Content.Client.HUD;
|
using Content.Client.HUD;
|
||||||
using Content.Client.Markers;
|
using Content.Client.Markers;
|
||||||
using Content.Client.SubFloor;
|
using Content.Client.SubFloor;
|
||||||
|
using Content.Shared.Administration;
|
||||||
|
using Content.Shared.GameTicking;
|
||||||
using Content.Shared.Input;
|
using Content.Shared.Input;
|
||||||
using Content.Shared.Sandbox;
|
using Content.Shared.Sandbox;
|
||||||
using Content.Shared.SubFloor;
|
|
||||||
using Robust.Client.Console;
|
using Robust.Client.Console;
|
||||||
using Robust.Client.Debugging;
|
using Robust.Client.Debugging;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
@@ -14,13 +15,9 @@ using Robust.Client.Placement;
|
|||||||
using Robust.Client.ResourceManagement;
|
using Robust.Client.ResourceManagement;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
using Robust.Client.UserInterface.CustomControls;
|
using Robust.Client.UserInterface.CustomControls;
|
||||||
using Robust.Shared.GameObjects;
|
|
||||||
using Robust.Shared.Input.Binding;
|
using Robust.Shared.Input.Binding;
|
||||||
using Robust.Shared.IoC;
|
|
||||||
using Robust.Shared.Localization;
|
|
||||||
using Robust.Shared.Map;
|
using Robust.Shared.Map;
|
||||||
using Robust.Shared.Network;
|
using Robust.Shared.Network;
|
||||||
using Robust.Shared.Prototypes;
|
|
||||||
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
using static Robust.Client.UserInterface.Controls.BoxContainer;
|
||||||
|
|
||||||
namespace Content.Client.Sandbox
|
namespace Content.Client.Sandbox
|
||||||
@@ -116,41 +113,33 @@ namespace Content.Client.Sandbox
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal sealed class SandboxManager : SharedSandboxManager, ISandboxManager
|
public sealed class SandboxSystem : SharedSandboxSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
[Dependency] private readonly IClientConsoleHost _consoleHost = default!;
|
||||||
[Dependency] private readonly IGameHud _gameHud = default!;
|
[Dependency] private readonly IGameHud _gameHud = default!;
|
||||||
[Dependency] private readonly IClientNetManager _netManager = default!;
|
|
||||||
[Dependency] private readonly IPlacementManager _placementManager = default!;
|
[Dependency] private readonly IPlacementManager _placementManager = default!;
|
||||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
|
||||||
[Dependency] private readonly IResourceCache _resourceCache = default!;
|
[Dependency] private readonly IResourceCache _resourceCache = default!;
|
||||||
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
[Dependency] private readonly ITileDefinitionManager _tileDefinitionManager = default!;
|
||||||
[Dependency] private readonly IInputManager _inputManager = default!;
|
[Dependency] private readonly IInputManager _inputManager = default!;
|
||||||
|
[Dependency] private readonly IClientAdminManager _adminManager = default!;
|
||||||
|
|
||||||
public bool SandboxAllowed { get; private set; }
|
public bool SandboxAllowed { get; private set; }
|
||||||
|
|
||||||
public event Action<bool>? AllowedChanged;
|
private SandboxWindow? _sandboxWindow;
|
||||||
|
|
||||||
private SandboxWindow? _window;
|
|
||||||
private EntitySpawnWindow? _spawnWindow;
|
private EntitySpawnWindow? _spawnWindow;
|
||||||
private TileSpawnWindow? _tilesSpawnWindow;
|
private TileSpawnWindow? _tilesSpawnWindow;
|
||||||
private DecalPlacerWindow? _decalSpawnWindow;
|
private DecalPlacerWindow? _decalSpawnWindow;
|
||||||
private bool _sandboxWindowToggled;
|
|
||||||
|
|
||||||
public void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
_netManager.RegisterNetMessage<MsgSandboxStatus>(message => SetAllowed(message.SandboxAllowed));
|
base.Initialize();
|
||||||
|
SubscribeNetworkEvent<MsgSandboxStatus>(OnSandboxStatus);
|
||||||
_netManager.RegisterNetMessage<MsgSandboxGiveAccess>();
|
SubscribeNetworkEvent<RoundRestartCleanupEvent>(OnRoundRestart);
|
||||||
|
|
||||||
_netManager.RegisterNetMessage<MsgSandboxRespawn>();
|
|
||||||
|
|
||||||
_netManager.RegisterNetMessage<MsgSandboxGiveAghost>();
|
|
||||||
|
|
||||||
_netManager.RegisterNetMessage<MsgSandboxSuicide>();
|
|
||||||
|
|
||||||
|
_adminManager.AdminStatusUpdated += OnAdminStatus;
|
||||||
_gameHud.SandboxButtonToggled += SandboxButtonPressed;
|
_gameHud.SandboxButtonToggled += SandboxButtonPressed;
|
||||||
|
|
||||||
|
// Do these need cleanup?
|
||||||
_inputManager.SetInputCommand(ContentKeyFunctions.OpenEntitySpawnWindow,
|
_inputManager.SetInputCommand(ContentKeyFunctions.OpenEntitySpawnWindow,
|
||||||
InputCmdHandler.FromDelegate(session => ToggleEntitySpawnWindow()));
|
InputCmdHandler.FromDelegate(session => ToggleEntitySpawnWindow()));
|
||||||
_inputManager.SetInputCommand(ContentKeyFunctions.OpenSandboxWindow,
|
_inputManager.SetInputCommand(ContentKeyFunctions.OpenSandboxWindow,
|
||||||
@@ -161,83 +150,129 @@ namespace Content.Client.Sandbox
|
|||||||
InputCmdHandler.FromDelegate(session => ToggleDecalsWindow()));
|
InputCmdHandler.FromDelegate(session => ToggleDecalsWindow()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnAdminStatus()
|
||||||
|
{
|
||||||
|
if (CanSandbox())
|
||||||
|
Enable();
|
||||||
|
else
|
||||||
|
Disable();
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool CanSandbox()
|
||||||
|
{
|
||||||
|
return SandboxAllowed || _adminManager.IsActive();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Run when sandbox is disabled
|
||||||
|
/// </summary>
|
||||||
|
private void Disable()
|
||||||
|
{
|
||||||
|
_gameHud.SandboxButtonVisible = false;
|
||||||
|
_sandboxWindow?.Close();
|
||||||
|
_sandboxWindow = null;
|
||||||
|
_spawnWindow?.Close();
|
||||||
|
_tilesSpawnWindow?.Close();
|
||||||
|
_decalSpawnWindow?.Close();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Enable()
|
||||||
|
{
|
||||||
|
_gameHud.SandboxButtonVisible = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnRoundRestart(RoundRestartCleanupEvent ev)
|
||||||
|
{
|
||||||
|
// Go through and cleanup windows (even if they remain adminned better to just shut them).
|
||||||
|
Disable();
|
||||||
|
|
||||||
|
if (CanSandbox())
|
||||||
|
Enable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Shutdown()
|
||||||
|
{
|
||||||
|
base.Shutdown();
|
||||||
|
// TODO: Gamehud moment
|
||||||
|
_gameHud.SandboxButtonToggled -= SandboxButtonPressed;
|
||||||
|
_adminManager.AdminStatusUpdated -= OnAdminStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnSandboxStatus(MsgSandboxStatus ev)
|
||||||
|
{
|
||||||
|
SetAllowed(ev.SandboxAllowed);
|
||||||
|
}
|
||||||
|
|
||||||
private void SandboxButtonPressed(bool newValue)
|
private void SandboxButtonPressed(bool newValue)
|
||||||
{
|
{
|
||||||
_sandboxWindowToggled = newValue;
|
|
||||||
UpdateSandboxWindowVisibility();
|
UpdateSandboxWindowVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleSandboxWindow()
|
private void ToggleSandboxWindow()
|
||||||
{
|
{
|
||||||
_sandboxWindowToggled = !_sandboxWindowToggled;
|
|
||||||
UpdateSandboxWindowVisibility();
|
UpdateSandboxWindowVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSandboxWindowVisibility()
|
private void UpdateSandboxWindowVisibility()
|
||||||
{
|
{
|
||||||
if (_sandboxWindowToggled && SandboxAllowed)
|
if (CanSandbox() && _sandboxWindow?.IsOpen != true)
|
||||||
OpenWindow();
|
OpenSandboxWindow();
|
||||||
else
|
else
|
||||||
_window?.Close();
|
_sandboxWindow?.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetAllowed(bool newAllowed)
|
private void SetAllowed(bool newAllowed)
|
||||||
{
|
{
|
||||||
if (newAllowed == SandboxAllowed)
|
if (newAllowed == SandboxAllowed)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
SandboxAllowed = newAllowed;
|
SandboxAllowed = newAllowed;
|
||||||
_gameHud.SandboxButtonVisible = newAllowed;
|
_gameHud.SandboxButtonVisible = CanSandbox();
|
||||||
|
|
||||||
if (!newAllowed)
|
if (!CanSandbox())
|
||||||
{
|
Disable();
|
||||||
// Sandbox permission revoked, close window.
|
|
||||||
_window?.Close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AllowedChanged?.Invoke(newAllowed);
|
private void OpenSandboxWindow()
|
||||||
}
|
{
|
||||||
|
if (_sandboxWindow != null)
|
||||||
|
{
|
||||||
|
if (!_sandboxWindow.IsOpen)
|
||||||
|
_sandboxWindow.Open();
|
||||||
|
|
||||||
private void OpenWindow()
|
|
||||||
{
|
|
||||||
if (_window != null)
|
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_window = new SandboxWindow();
|
_sandboxWindow = new SandboxWindow();
|
||||||
|
|
||||||
_window.OnClose += WindowOnOnClose;
|
_sandboxWindow.OnClose += SandboxWindowOnClose;
|
||||||
|
|
||||||
_window.RespawnButton.OnPressed += OnRespawnButtonOnOnPressed;
|
_sandboxWindow.RespawnButton.OnPressed += OnRespawnButtonOnOnPressed;
|
||||||
_window.SpawnTilesButton.OnPressed += OnSpawnTilesButtonClicked;
|
_sandboxWindow.SpawnTilesButton.OnPressed += OnSpawnTilesButtonClicked;
|
||||||
_window.SpawnEntitiesButton.OnPressed += OnSpawnEntitiesButtonClicked;
|
_sandboxWindow.SpawnEntitiesButton.OnPressed += OnSpawnEntitiesButtonClicked;
|
||||||
_window.SpawnDecalsButton.OnPressed += OnSpawnDecalsButtonClicked;
|
_sandboxWindow.SpawnDecalsButton.OnPressed += OnSpawnDecalsButtonClicked;
|
||||||
_window.GiveFullAccessButton.OnPressed += OnGiveAdminAccessButtonClicked;
|
_sandboxWindow.GiveFullAccessButton.OnPressed += OnGiveAdminAccessButtonClicked;
|
||||||
_window.GiveAghostButton.OnPressed += OnGiveAghostButtonClicked;
|
_sandboxWindow.GiveAghostButton.OnPressed += OnGiveAghostButtonClicked;
|
||||||
_window.ToggleLightButton.OnToggled += OnToggleLightButtonClicked;
|
_sandboxWindow.ToggleLightButton.OnToggled += OnToggleLightButtonClicked;
|
||||||
_window.ToggleFovButton.OnToggled += OnToggleFovButtonClicked;
|
_sandboxWindow.ToggleFovButton.OnToggled += OnToggleFovButtonClicked;
|
||||||
_window.ToggleShadowsButton.OnToggled += OnToggleShadowsButtonClicked;
|
_sandboxWindow.ToggleShadowsButton.OnToggled += OnToggleShadowsButtonClicked;
|
||||||
_window.SuicideButton.OnPressed += OnSuicideButtonClicked;
|
_sandboxWindow.SuicideButton.OnPressed += OnSuicideButtonClicked;
|
||||||
_window.ToggleSubfloorButton.OnPressed += OnToggleSubfloorButtonClicked;
|
_sandboxWindow.ToggleSubfloorButton.OnPressed += OnToggleSubfloorButtonClicked;
|
||||||
_window.ShowMarkersButton.OnPressed += OnShowMarkersButtonClicked;
|
_sandboxWindow.ShowMarkersButton.OnPressed += OnShowMarkersButtonClicked;
|
||||||
_window.ShowBbButton.OnPressed += OnShowBbButtonClicked;
|
_sandboxWindow.ShowBbButton.OnPressed += OnShowBbButtonClicked;
|
||||||
_window.MachineLinkingButton.OnPressed += OnMachineLinkingButtonClicked;
|
_sandboxWindow.MachineLinkingButton.OnPressed += OnMachineLinkingButtonClicked;
|
||||||
|
|
||||||
_window.OpenCentered();
|
_sandboxWindow.OpenCentered();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WindowOnOnClose()
|
private void SandboxWindowOnClose()
|
||||||
{
|
{
|
||||||
_window = null;
|
_sandboxWindow = null;
|
||||||
_sandboxWindowToggled = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnRespawnButtonOnOnPressed(BaseButton.ButtonEventArgs args)
|
private void OnRespawnButtonOnOnPressed(BaseButton.ButtonEventArgs args)
|
||||||
{
|
{
|
||||||
_netManager.ClientSendMessage(_netManager.CreateNetMessage<MsgSandboxRespawn>());
|
RaiseNetworkEvent(new MsgSandboxRespawn());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSpawnEntitiesButtonClicked(BaseButton.ButtonEventArgs args)
|
private void OnSpawnEntitiesButtonClicked(BaseButton.ButtonEventArgs args)
|
||||||
@@ -291,24 +326,27 @@ namespace Content.Client.Sandbox
|
|||||||
|
|
||||||
private void OnGiveAdminAccessButtonClicked(BaseButton.ButtonEventArgs args)
|
private void OnGiveAdminAccessButtonClicked(BaseButton.ButtonEventArgs args)
|
||||||
{
|
{
|
||||||
_netManager.ClientSendMessage(_netManager.CreateNetMessage<MsgSandboxGiveAccess>());
|
RaiseNetworkEvent(new MsgSandboxGiveAccess());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnGiveAghostButtonClicked(BaseButton.ButtonEventArgs args)
|
private void OnGiveAghostButtonClicked(BaseButton.ButtonEventArgs args)
|
||||||
{
|
{
|
||||||
_netManager.ClientSendMessage(_netManager.CreateNetMessage<MsgSandboxGiveAghost>());
|
RaiseNetworkEvent(new MsgSandboxGiveAghost());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnSuicideButtonClicked(BaseButton.ButtonEventArgs args)
|
private void OnSuicideButtonClicked(BaseButton.ButtonEventArgs args)
|
||||||
{
|
{
|
||||||
_netManager.ClientSendMessage(_netManager.CreateNetMessage<MsgSandboxSuicide>());
|
RaiseNetworkEvent(new MsgSandboxSuicide());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleEntitySpawnWindow()
|
// TODO: These should check for command perms + be reset if the round is over.
|
||||||
|
public void ToggleEntitySpawnWindow()
|
||||||
{
|
{
|
||||||
if (_spawnWindow == null)
|
if (_spawnWindow == null)
|
||||||
{
|
{
|
||||||
_spawnWindow = new EntitySpawnWindow(_placementManager, _prototypeManager, _resourceCache);
|
if (!CanSandbox()) return;
|
||||||
|
|
||||||
|
_spawnWindow = new EntitySpawnWindow(_placementManager, PrototypeManager, _resourceCache);
|
||||||
_spawnWindow.OpenToLeft();
|
_spawnWindow.OpenToLeft();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -323,10 +361,12 @@ namespace Content.Client.Sandbox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleTilesWindow()
|
public void ToggleTilesWindow()
|
||||||
{
|
{
|
||||||
if (_tilesSpawnWindow == null)
|
if (_tilesSpawnWindow == null)
|
||||||
{
|
{
|
||||||
|
if (!CanSandbox()) return;
|
||||||
|
|
||||||
_tilesSpawnWindow = new TileSpawnWindow(_tileDefinitionManager, _placementManager, _resourceCache);
|
_tilesSpawnWindow = new TileSpawnWindow(_tileDefinitionManager, _placementManager, _resourceCache);
|
||||||
_tilesSpawnWindow.OpenToLeft();
|
_tilesSpawnWindow.OpenToLeft();
|
||||||
return;
|
return;
|
||||||
@@ -342,11 +382,13 @@ namespace Content.Client.Sandbox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ToggleDecalsWindow()
|
public void ToggleDecalsWindow()
|
||||||
{
|
{
|
||||||
if (_decalSpawnWindow == null)
|
if (_decalSpawnWindow == null)
|
||||||
{
|
{
|
||||||
_decalSpawnWindow = new DecalPlacerWindow(_prototypeManager);
|
if (!CanSandbox()) return;
|
||||||
|
|
||||||
|
_decalSpawnWindow = new DecalPlacerWindow(PrototypeManager);
|
||||||
_decalSpawnWindow.OpenToLeft();
|
_decalSpawnWindow.OpenToLeft();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -361,6 +403,7 @@ namespace Content.Client.Sandbox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: need to cleanup these
|
||||||
private void ToggleLight()
|
private void ToggleLight()
|
||||||
{
|
{
|
||||||
_consoleHost.ExecuteCommand("togglelight");
|
_consoleHost.ExecuteCommand("togglelight");
|
||||||
@@ -112,7 +112,6 @@ namespace Content.Server.Entry
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
IoCManager.Resolve<ISandboxManager>().Initialize();
|
|
||||||
IoCManager.Resolve<RecipeManager>().Initialize();
|
IoCManager.Resolve<RecipeManager>().Initialize();
|
||||||
IoCManager.Resolve<ActionManager>().Initialize();
|
IoCManager.Resolve<ActionManager>().Initialize();
|
||||||
IoCManager.Resolve<BlackboardManager>().Initialize();
|
IoCManager.Resolve<BlackboardManager>().Initialize();
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
using Content.Server.Sandbox;
|
using Content.Server.Sandbox;
|
||||||
using Robust.Shared.IoC;
|
|
||||||
|
|
||||||
namespace Content.Server.GameTicking.Rules;
|
namespace Content.Server.GameTicking.Rules;
|
||||||
|
|
||||||
public sealed class SandboxRuleSystem : GameRuleSystem
|
public sealed class SandboxRuleSystem : GameRuleSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly ISandboxManager _sandbox = default!;
|
[Dependency] private readonly SandboxSystem _sandbox = default!;
|
||||||
|
|
||||||
public override string Prototype => "Sandbox";
|
public override string Prototype => "Sandbox";
|
||||||
|
|
||||||
|
|||||||
@@ -16,13 +16,11 @@ using Content.Server.NodeContainer.NodeGroups;
|
|||||||
using Content.Server.Objectives;
|
using Content.Server.Objectives;
|
||||||
using Content.Server.Objectives.Interfaces;
|
using Content.Server.Objectives.Interfaces;
|
||||||
using Content.Server.Preferences.Managers;
|
using Content.Server.Preferences.Managers;
|
||||||
using Content.Server.Sandbox;
|
|
||||||
using Content.Server.Voting.Managers;
|
using Content.Server.Voting.Managers;
|
||||||
using Content.Shared.Actions;
|
using Content.Shared.Actions;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.Kitchen;
|
using Content.Shared.Kitchen;
|
||||||
using Content.Shared.Module;
|
using Content.Shared.Module;
|
||||||
using Robust.Shared.IoC;
|
|
||||||
|
|
||||||
namespace Content.Server.IoC
|
namespace Content.Server.IoC
|
||||||
{
|
{
|
||||||
@@ -33,7 +31,6 @@ namespace Content.Server.IoC
|
|||||||
IoCManager.Register<IChatManager, ChatManager>();
|
IoCManager.Register<IChatManager, ChatManager>();
|
||||||
IoCManager.Register<IChatSanitizationManager, ChatSanitizationManager>();
|
IoCManager.Register<IChatSanitizationManager, ChatSanitizationManager>();
|
||||||
IoCManager.Register<IMoMMILink, MoMMILink>();
|
IoCManager.Register<IMoMMILink, MoMMILink>();
|
||||||
IoCManager.Register<ISandboxManager, SandboxManager>();
|
|
||||||
IoCManager.Register<IModuleManager, ServerModuleManager>();
|
IoCManager.Register<IModuleManager, ServerModuleManager>();
|
||||||
IoCManager.Register<IServerPreferencesManager, ServerPreferencesManager>();
|
IoCManager.Register<IServerPreferencesManager, ServerPreferencesManager>();
|
||||||
IoCManager.Register<IServerDbManager, ServerDbManager>();
|
IoCManager.Register<IServerDbManager, ServerDbManager>();
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ namespace Content.Server.Sandbox.Commands
|
|||||||
|
|
||||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||||
{
|
{
|
||||||
var sandboxManager = IoCManager.Resolve<ISandboxManager>();
|
var sandboxManager = EntitySystem.Get<SandboxSystem>();
|
||||||
var adminManager = IoCManager.Resolve<IAdminManager>();
|
var adminManager = IoCManager.Resolve<IAdminManager>();
|
||||||
if (shell.IsClient && (!sandboxManager.IsSandboxEnabled && !adminManager.HasAdminFlag((IPlayerSession)shell.Player!, AdminFlags.Mapping)))
|
if (shell.IsClient && (!sandboxManager.IsSandboxEnabled && !adminManager.HasAdminFlag((IPlayerSession)shell.Player!, AdminFlags.Mapping)))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,8 +0,0 @@
|
|||||||
namespace Content.Server.Sandbox
|
|
||||||
{
|
|
||||||
public interface ISandboxManager
|
|
||||||
{
|
|
||||||
bool IsSandboxEnabled { get; set; }
|
|
||||||
void Initialize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -22,14 +22,16 @@ using Robust.Shared.ViewVariables;
|
|||||||
|
|
||||||
namespace Content.Server.Sandbox
|
namespace Content.Server.Sandbox
|
||||||
{
|
{
|
||||||
internal sealed class SandboxManager : SharedSandboxManager, ISandboxManager, IEntityEventSubscriber
|
public sealed class SandboxSystem : SharedSandboxSystem
|
||||||
{
|
{
|
||||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||||
[Dependency] private readonly IServerNetManager _netManager = default!;
|
|
||||||
[Dependency] private readonly IPlacementManager _placementManager = default!;
|
[Dependency] private readonly IPlacementManager _placementManager = default!;
|
||||||
[Dependency] private readonly IConGroupController _conGroupController = default!;
|
[Dependency] private readonly IConGroupController _conGroupController = default!;
|
||||||
[Dependency] private readonly IEntityManager _entityManager = default!;
|
|
||||||
[Dependency] private readonly IServerConsoleHost _host = default!;
|
[Dependency] private readonly IServerConsoleHost _host = default!;
|
||||||
|
[Dependency] private readonly AccessSystem _access = default!;
|
||||||
|
[Dependency] private readonly InventorySystem _inventory = default!;
|
||||||
|
[Dependency] private readonly ItemSlotsSystem _slots = default!;
|
||||||
|
[Dependency] private readonly GameTicker _ticker = default!;
|
||||||
|
|
||||||
private bool _isSandboxEnabled;
|
private bool _isSandboxEnabled;
|
||||||
|
|
||||||
@@ -44,16 +46,17 @@ namespace Content.Server.Sandbox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
_netManager.RegisterNetMessage<MsgSandboxStatus>();
|
base.Initialize();
|
||||||
_netManager.RegisterNetMessage<MsgSandboxRespawn>(SandboxRespawnReceived);
|
SubscribeNetworkEvent<MsgSandboxRespawn>(SandboxRespawnReceived);
|
||||||
_netManager.RegisterNetMessage<MsgSandboxGiveAccess>(SandboxGiveAccessReceived);
|
SubscribeNetworkEvent<MsgSandboxGiveAccess>(SandboxGiveAccessReceived);
|
||||||
_netManager.RegisterNetMessage<MsgSandboxGiveAghost>(SandboxGiveAghostReceived);
|
SubscribeNetworkEvent<MsgSandboxGiveAghost>(SandboxGiveAghostReceived);
|
||||||
_netManager.RegisterNetMessage<MsgSandboxSuicide>(SandboxSuicideReceived);
|
SubscribeNetworkEvent<MsgSandboxSuicide>(SandboxSuicideReceived);
|
||||||
|
|
||||||
|
SubscribeLocalEvent<GameRunLevelChangedEvent>(GameTickerOnOnRunLevelChanged);
|
||||||
|
|
||||||
_playerManager.PlayerStatusChanged += OnPlayerStatusChanged;
|
_playerManager.PlayerStatusChanged += OnPlayerStatusChanged;
|
||||||
_entityManager.EventBus.SubscribeEvent<GameRunLevelChangedEvent>(EventSource.Local, this, GameTickerOnOnRunLevelChanged);
|
|
||||||
|
|
||||||
_placementManager.AllowPlacementFunc = placement =>
|
_placementManager.AllowPlacementFunc = placement =>
|
||||||
{
|
{
|
||||||
@@ -74,6 +77,13 @@ namespace Content.Server.Sandbox
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override void Shutdown()
|
||||||
|
{
|
||||||
|
base.Shutdown();
|
||||||
|
_placementManager.AllowPlacementFunc = null;
|
||||||
|
_playerManager.PlayerStatusChanged -= OnPlayerStatusChanged;
|
||||||
|
}
|
||||||
|
|
||||||
private void GameTickerOnOnRunLevelChanged(GameRunLevelChangedEvent obj)
|
private void GameTickerOnOnRunLevelChanged(GameRunLevelChangedEvent obj)
|
||||||
{
|
{
|
||||||
// Automatically clear sandbox state when round resets.
|
// Automatically clear sandbox state when round resets.
|
||||||
@@ -86,60 +96,51 @@ namespace Content.Server.Sandbox
|
|||||||
private void OnPlayerStatusChanged(object? sender, SessionStatusEventArgs e)
|
private void OnPlayerStatusChanged(object? sender, SessionStatusEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.NewStatus != SessionStatus.Connected || e.OldStatus != SessionStatus.Connecting)
|
if (e.NewStatus != SessionStatus.Connected || e.OldStatus != SessionStatus.Connecting)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
RaiseNetworkEvent(new MsgSandboxStatus {SandboxAllowed = IsSandboxEnabled}, e.Session.ConnectedClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
var msg = _netManager.CreateNetMessage<MsgSandboxStatus>();
|
private void SandboxRespawnReceived(MsgSandboxRespawn message, EntitySessionEventArgs args)
|
||||||
msg.SandboxAllowed = IsSandboxEnabled;
|
|
||||||
_netManager.ServerSendMessage(msg, e.Session.ConnectedClient);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SandboxRespawnReceived(MsgSandboxRespawn message)
|
|
||||||
{
|
{
|
||||||
if (!IsSandboxEnabled)
|
if (!IsSandboxEnabled)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var player = _playerManager.GetSessionByChannel(args.SenderSession.ConnectedClient);
|
||||||
|
if (player.AttachedEntity == null) return;
|
||||||
|
|
||||||
|
_ticker.Respawn(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
var player = _playerManager.GetSessionByChannel(message.MsgChannel);
|
private void SandboxGiveAccessReceived(MsgSandboxGiveAccess message, EntitySessionEventArgs args)
|
||||||
EntitySystem.Get<GameTicker>().Respawn(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void SandboxGiveAccessReceived(MsgSandboxGiveAccess message)
|
|
||||||
{
|
{
|
||||||
if (!IsSandboxEnabled)
|
if (!IsSandboxEnabled)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
var player = _playerManager.GetSessionByChannel(message.MsgChannel);
|
var player = _playerManager.GetSessionByChannel(args.SenderSession.ConnectedClient);
|
||||||
if (player.AttachedEntity is not {} attached)
|
if (player.AttachedEntity is not {} attached)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var allAccess = IoCManager.Resolve<IPrototypeManager>()
|
var allAccess = PrototypeManager
|
||||||
.EnumeratePrototypes<AccessLevelPrototype>()
|
.EnumeratePrototypes<AccessLevelPrototype>()
|
||||||
.Select(p => p.ID).ToArray();
|
.Select(p => p.ID).ToArray();
|
||||||
|
|
||||||
var invSystem = EntitySystem.Get<InventorySystem>();
|
if (_inventory.TryGetSlotEntity(attached, "id", out var slotEntity))
|
||||||
|
|
||||||
if (invSystem.TryGetSlotEntity(attached, "id", out var slotEntity))
|
|
||||||
{
|
{
|
||||||
if (_entityManager.HasComponent<AccessComponent>(slotEntity))
|
if (HasComp<AccessComponent>(slotEntity))
|
||||||
{
|
{
|
||||||
UpgradeId(slotEntity.Value);
|
UpgradeId(slotEntity.Value);
|
||||||
}
|
}
|
||||||
else if (_entityManager.TryGetComponent(slotEntity, out PDAComponent? pda))
|
else if (TryComp<PDAComponent>(slotEntity, out var pda))
|
||||||
{
|
{
|
||||||
if (pda.ContainedID == null)
|
if (pda.ContainedID == null)
|
||||||
{
|
{
|
||||||
var newID = CreateFreshId();
|
var newID = CreateFreshId();
|
||||||
if (_entityManager.TryGetComponent(pda.Owner, out ItemSlotsComponent? itemSlots))
|
if (TryComp<ItemSlotsComponent>(pda.Owner, out var itemSlots))
|
||||||
{
|
{
|
||||||
_entityManager.EntitySysManager.GetEntitySystem<ItemSlotsSystem>().
|
_slots.TryInsert(slotEntity.Value, pda.IdSlot, newID, null);
|
||||||
TryInsert(slotEntity.Value, pda.IdSlot, newID, null);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -148,21 +149,20 @@ namespace Content.Server.Sandbox
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (_entityManager.TryGetComponent<HandsComponent?>(attached, out var hands))
|
else if (TryComp<HandsComponent>(attached, out var hands))
|
||||||
{
|
{
|
||||||
var card = CreateFreshId();
|
var card = CreateFreshId();
|
||||||
if (!invSystem.TryEquip(attached, card, "id", true, true))
|
if (!_inventory.TryEquip(attached, card, "id", true, true))
|
||||||
{
|
{
|
||||||
hands.PutInHandOrDrop(_entityManager.GetComponent<SharedItemComponent>(card));
|
hands.PutInHandOrDrop(Comp<SharedItemComponent>(card));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpgradeId(EntityUid id)
|
void UpgradeId(EntityUid id)
|
||||||
{
|
{
|
||||||
var accessSystem = EntitySystem.Get<AccessSystem>();
|
_access.TrySetTags(id, allAccess);
|
||||||
accessSystem.TrySetTags(id, allAccess);
|
|
||||||
|
|
||||||
if (_entityManager.TryGetComponent(id, out SpriteComponent? sprite))
|
if (TryComp<SpriteComponent>(id, out var sprite))
|
||||||
{
|
{
|
||||||
sprite.LayerSetState(0, "gold");
|
sprite.LayerSetState(0, "gold");
|
||||||
}
|
}
|
||||||
@@ -170,42 +170,36 @@ namespace Content.Server.Sandbox
|
|||||||
|
|
||||||
EntityUid CreateFreshId()
|
EntityUid CreateFreshId()
|
||||||
{
|
{
|
||||||
var card = _entityManager.SpawnEntity("CaptainIDCard", _entityManager.GetComponent<TransformComponent>(attached).Coordinates);
|
var card = Spawn("CaptainIDCard", Transform(attached).Coordinates);
|
||||||
UpgradeId(card);
|
UpgradeId(card);
|
||||||
|
|
||||||
_entityManager.GetComponent<IdCardComponent>(card).FullName = _entityManager.GetComponent<MetaDataComponent>(attached).EntityName;
|
Comp<IdCardComponent>(card).FullName = MetaData(attached).EntityName;
|
||||||
return card;
|
return card;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SandboxGiveAghostReceived(MsgSandboxGiveAghost message)
|
private void SandboxGiveAghostReceived(MsgSandboxGiveAghost message, EntitySessionEventArgs args)
|
||||||
{
|
{
|
||||||
if (!IsSandboxEnabled)
|
if (!IsSandboxEnabled)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
var player = _playerManager.GetSessionByChannel(message.MsgChannel);
|
var player = _playerManager.GetSessionByChannel(args.SenderSession.ConnectedClient);
|
||||||
|
|
||||||
_host.ExecuteCommand(player, _conGroupController.CanCommand(player, "aghost") ? "aghost" : "ghost");
|
_host.ExecuteCommand(player, _conGroupController.CanCommand(player, "aghost") ? "aghost" : "ghost");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SandboxSuicideReceived(MsgSandboxSuicide message)
|
private void SandboxSuicideReceived(MsgSandboxSuicide message, EntitySessionEventArgs args)
|
||||||
{
|
{
|
||||||
if (!IsSandboxEnabled)
|
if (!IsSandboxEnabled)
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
var player = _playerManager.GetSessionByChannel(message.MsgChannel);
|
var player = _playerManager.GetSessionByChannel(args.SenderSession.ConnectedClient);
|
||||||
_host.ExecuteCommand(player, "suicide");
|
_host.ExecuteCommand(player, "suicide");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSandboxStatusForAll()
|
private void UpdateSandboxStatusForAll()
|
||||||
{
|
{
|
||||||
var msg = _netManager.CreateNetMessage<MsgSandboxStatus>();
|
RaiseNetworkEvent(new MsgSandboxStatus {SandboxAllowed = IsSandboxEnabled});
|
||||||
msg.SandboxAllowed = IsSandboxEnabled;
|
|
||||||
_netManager.ServerSendToAll(msg);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
using Lidgren.Network;
|
|
||||||
using Robust.Shared.Network;
|
|
||||||
|
|
||||||
namespace Content.Shared.Sandbox
|
|
||||||
{
|
|
||||||
public abstract class SharedSandboxManager
|
|
||||||
{
|
|
||||||
protected sealed class MsgSandboxStatus : NetMessage
|
|
||||||
{
|
|
||||||
public override MsgGroups MsgGroup => MsgGroups.Command;
|
|
||||||
|
|
||||||
public bool SandboxAllowed { get; set; }
|
|
||||||
|
|
||||||
public override void ReadFromBuffer(NetIncomingMessage buffer)
|
|
||||||
{
|
|
||||||
SandboxAllowed = buffer.ReadBoolean();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void WriteToBuffer(NetOutgoingMessage buffer)
|
|
||||||
{
|
|
||||||
buffer.Write(SandboxAllowed);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected sealed class MsgSandboxRespawn : NetMessage
|
|
||||||
{
|
|
||||||
public override MsgGroups MsgGroup => MsgGroups.Command;
|
|
||||||
|
|
||||||
public override void ReadFromBuffer(NetIncomingMessage buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void WriteToBuffer(NetOutgoingMessage buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected sealed class MsgSandboxGiveAccess : NetMessage
|
|
||||||
{
|
|
||||||
public override MsgGroups MsgGroup => MsgGroups.Command;
|
|
||||||
|
|
||||||
public override void ReadFromBuffer(NetIncomingMessage buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void WriteToBuffer(NetOutgoingMessage buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected sealed class MsgSandboxGiveAghost : NetMessage
|
|
||||||
{
|
|
||||||
public override MsgGroups MsgGroup => MsgGroups.Command;
|
|
||||||
|
|
||||||
public override void ReadFromBuffer(NetIncomingMessage buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void WriteToBuffer(NetOutgoingMessage buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
protected sealed class MsgSandboxSuicide : NetMessage
|
|
||||||
{
|
|
||||||
public override MsgGroups MsgGroup => MsgGroups.Command;
|
|
||||||
|
|
||||||
public override void ReadFromBuffer(NetIncomingMessage buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void WriteToBuffer(NetOutgoingMessage buffer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
28
Content.Shared/Sandbox/SharedSandboxSystem.cs
Normal file
28
Content.Shared/Sandbox/SharedSandboxSystem.cs
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Serialization;
|
||||||
|
|
||||||
|
namespace Content.Shared.Sandbox
|
||||||
|
{
|
||||||
|
public abstract class SharedSandboxSystem : EntitySystem
|
||||||
|
{
|
||||||
|
[Dependency] protected readonly IPrototypeManager PrototypeManager = default!;
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
protected sealed class MsgSandboxStatus : EntityEventArgs
|
||||||
|
{
|
||||||
|
public bool SandboxAllowed { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
protected sealed class MsgSandboxRespawn : EntityEventArgs {}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
protected sealed class MsgSandboxGiveAccess : EntityEventArgs {}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
protected sealed class MsgSandboxGiveAghost : EntityEventArgs {}
|
||||||
|
|
||||||
|
[Serializable, NetSerializable]
|
||||||
|
protected sealed class MsgSandboxSuicide : EntityEventArgs {}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user