Admin freeze (#6668)

This commit is contained in:
mirrorcult
2022-02-11 19:01:37 -07:00
committed by GitHub
parent 0e63cbd404
commit 307e642a6d
7 changed files with 94 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ using Content.Shared.Database;
using Content.Shared.GameTicking;
using Content.Shared.Interaction.Helpers;
using Content.Shared.Inventory;
using Content.Shared.Movement.Components;
using Content.Shared.Popups;
using Content.Shared.Verbs;
using Robust.Server.Console;
@@ -77,6 +78,26 @@ namespace Content.Server.Administration
_console.RemoteExecuteCommand(player, $"openahelp \"{targetActor.PlayerSession.UserId}\"");
verb.Impact = LogImpact.Low;
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

View File

@@ -0,0 +1,9 @@
using Robust.Shared.GameStates;
namespace Content.Shared.Administration;
[RegisterComponent, Friend(typeof(AdminFrozenSystem))]
[NetworkedComponent]
public sealed class AdminFrozenComponent : Component
{
}

View 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());
}
}

View File

@@ -4,3 +4,5 @@ explode-verb-get-data-text = Explode
ahelp-verb-get-data-text = Message
admin-verbs-teleport-to = Teleport To
admin-verbs-teleport-here = Teleport Here
admin-verbs-freeze = Freeze
admin-verbs-unfreeze = Unfreeze

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -0,0 +1,2 @@
sample:
filter: true