Fix griddrag and tethergun (#10510)
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Client.Maps;
|
||||
|
||||
/// <summary>
|
||||
/// Toggles GridDragging on the system.
|
||||
/// </summary>
|
||||
public sealed class GridDraggingCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => SharedGridDraggingSystem.CommandName;
|
||||
public string Description => $"Allows someone with permissions to drag grids around.";
|
||||
public string Help => $"{Command}";
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var system = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<GridDraggingSystem>();
|
||||
system.Enabled ^= true;
|
||||
|
||||
if (system.Enabled)
|
||||
shell.WriteLine("Grid dragging toggled on");
|
||||
else
|
||||
shell.WriteLine("Grid dragging toggled off");
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,3 @@
|
||||
using Content.Client.Administration.Managers;
|
||||
using Content.Shared.Maps;
|
||||
using Robust.Client.GameObjects;
|
||||
using Robust.Client.Graphics;
|
||||
@@ -24,6 +23,23 @@ public sealed class GridDraggingSystem : SharedGridDraggingSystem
|
||||
private Vector2 _localPosition;
|
||||
private MapCoordinates? _lastMousePosition;
|
||||
|
||||
public override void Initialize()
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeNetworkEvent<GridDragToggleMessage>(OnToggleMessage);
|
||||
}
|
||||
|
||||
private void OnToggleMessage(GridDragToggleMessage ev)
|
||||
{
|
||||
if (Enabled == ev.Enabled)
|
||||
return;
|
||||
|
||||
Enabled = ev.Enabled;
|
||||
|
||||
if (!Enabled)
|
||||
StopDragging();
|
||||
}
|
||||
|
||||
private void StartDragging(EntityUid grid, Vector2 localPosition)
|
||||
{
|
||||
_dragging = grid;
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
using Content.Client.Weapons.Ranged.Systems;
|
||||
using Robust.Shared.Console;
|
||||
|
||||
namespace Content.Client.Weapons.Ranged;
|
||||
|
||||
public sealed class TetherGunCommand : IConsoleCommand
|
||||
{
|
||||
public string Command => "tethergun";
|
||||
public string Description => "Allows you to drag mobs around with your mouse.";
|
||||
public string Help => $"{Command}";
|
||||
public void Execute(IConsoleShell shell, string argStr, string[] args)
|
||||
{
|
||||
var system = IoCManager.Resolve<IEntitySystemManager>().GetEntitySystem<TetherGunSystem>();
|
||||
system.Enabled ^= true;
|
||||
|
||||
if (system.Enabled)
|
||||
shell.WriteLine("Tether gun toggled on");
|
||||
else
|
||||
shell.WriteLine("Tether gun toggled off");
|
||||
}
|
||||
}
|
||||
@@ -31,6 +31,12 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
|
||||
{
|
||||
base.Initialize();
|
||||
SubscribeNetworkEvent<PredictTetherEvent>(OnPredictTether);
|
||||
SubscribeNetworkEvent<TetherGunToggleMessage>(OnTetherGun);
|
||||
}
|
||||
|
||||
private void OnTetherGun(TetherGunToggleMessage ev)
|
||||
{
|
||||
Enabled = ev.Enabled;
|
||||
}
|
||||
|
||||
private void OnPredictTether(PredictTetherEvent ev)
|
||||
|
||||
Reference in New Issue
Block a user