Admin freeze (#6668)
This commit is contained in:
@@ -20,6 +20,7 @@ using Content.Shared.Database;
|
|||||||
using Content.Shared.GameTicking;
|
using Content.Shared.GameTicking;
|
||||||
using Content.Shared.Interaction.Helpers;
|
using Content.Shared.Interaction.Helpers;
|
||||||
using Content.Shared.Inventory;
|
using Content.Shared.Inventory;
|
||||||
|
using Content.Shared.Movement.Components;
|
||||||
using Content.Shared.Popups;
|
using Content.Shared.Popups;
|
||||||
using Content.Shared.Verbs;
|
using Content.Shared.Verbs;
|
||||||
using Robust.Server.Console;
|
using Robust.Server.Console;
|
||||||
@@ -77,6 +78,26 @@ namespace Content.Server.Administration
|
|||||||
_console.RemoteExecuteCommand(player, $"openahelp \"{targetActor.PlayerSession.UserId}\"");
|
_console.RemoteExecuteCommand(player, $"openahelp \"{targetActor.PlayerSession.UserId}\"");
|
||||||
verb.Impact = LogImpact.Low;
|
verb.Impact = LogImpact.Low;
|
||||||
args.Verbs.Add(verb);
|
args.Verbs.Add(verb);
|
||||||
|
|
||||||
|
// Freeze
|
||||||
|
var frozen = HasComp<AdminFrozenComponent>(args.Target);
|
||||||
|
args.Verbs.Add(new Verb
|
||||||
|
{
|
||||||
|
Priority = -1, // This is just so it doesn't change position in the menu between freeze/unfreeze.
|
||||||
|
Text = frozen
|
||||||
|
? Loc.GetString("admin-verbs-unfreeze")
|
||||||
|
: Loc.GetString("admin-verbs-freeze"),
|
||||||
|
Category = VerbCategory.Admin,
|
||||||
|
IconTexture = "/Textures/Interface/VerbIcons/snow.svg.192dpi.png",
|
||||||
|
Act = () =>
|
||||||
|
{
|
||||||
|
if (frozen)
|
||||||
|
RemComp<AdminFrozenComponent>(args.Target);
|
||||||
|
else
|
||||||
|
EnsureComp<AdminFrozenComponent>(args.Target);
|
||||||
|
},
|
||||||
|
Impact = LogImpact.Medium,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TeleportTo
|
// TeleportTo
|
||||||
|
|||||||
9
Content.Shared/Administration/AdminFrozenComponent.cs
Normal file
9
Content.Shared/Administration/AdminFrozenComponent.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using Robust.Shared.GameStates;
|
||||||
|
|
||||||
|
namespace Content.Shared.Administration;
|
||||||
|
|
||||||
|
[RegisterComponent, Friend(typeof(AdminFrozenSystem))]
|
||||||
|
[NetworkedComponent]
|
||||||
|
public sealed class AdminFrozenComponent : Component
|
||||||
|
{
|
||||||
|
}
|
||||||
21
Content.Shared/Administration/AdminFrozenSystem.cs
Normal file
21
Content.Shared/Administration/AdminFrozenSystem.cs
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
using Content.Shared.Interaction.Events;
|
||||||
|
using Content.Shared.Item;
|
||||||
|
using Content.Shared.Movement;
|
||||||
|
using Content.Shared.Throwing;
|
||||||
|
|
||||||
|
namespace Content.Shared.Administration;
|
||||||
|
|
||||||
|
public sealed class AdminFrozenSystem : EntitySystem
|
||||||
|
{
|
||||||
|
public override void Initialize()
|
||||||
|
{
|
||||||
|
base.Initialize();
|
||||||
|
|
||||||
|
SubscribeLocalEvent<AdminFrozenComponent, UseAttemptEvent>((_, _, args) => args.Cancel());
|
||||||
|
SubscribeLocalEvent<AdminFrozenComponent, PickupAttemptEvent>((_, _, args) => args.Cancel());
|
||||||
|
SubscribeLocalEvent<AdminFrozenComponent, ThrowAttemptEvent>((_, _, args) => args.Cancel());
|
||||||
|
SubscribeLocalEvent<AdminFrozenComponent, AttackAttemptEvent>((_, _, args) => args.Cancel());
|
||||||
|
SubscribeLocalEvent<AdminFrozenComponent, MovementAttemptEvent>((_, _, args) => args.Cancel());
|
||||||
|
SubscribeLocalEvent<AdminFrozenComponent, InteractionAttemptEvent>((_, _, args) => args.Cancel());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,3 +4,5 @@ explode-verb-get-data-text = Explode
|
|||||||
ahelp-verb-get-data-text = Message
|
ahelp-verb-get-data-text = Message
|
||||||
admin-verbs-teleport-to = Teleport To
|
admin-verbs-teleport-to = Teleport To
|
||||||
admin-verbs-teleport-here = Teleport Here
|
admin-verbs-teleport-here = Teleport Here
|
||||||
|
admin-verbs-freeze = Freeze
|
||||||
|
admin-verbs-unfreeze = Unfreeze
|
||||||
|
|||||||
39
Resources/Textures/Interface/VerbIcons/snow.svg
Normal file
39
Resources/Textures/Interface/VerbIcons/snow.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 8.5 KiB |
BIN
Resources/Textures/Interface/VerbIcons/snow.svg.192dpi.png
Normal file
BIN
Resources/Textures/Interface/VerbIcons/snow.svg.192dpi.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
@@ -0,0 +1,2 @@
|
|||||||
|
sample:
|
||||||
|
filter: true
|
||||||
Reference in New Issue
Block a user