Remove placing items on tabletop boards. (#29513)

This feature should never have been merged, it can be trivially abused to break the entire server.

It's behind a CVar because honestly that's the easiest way to 1984 the feature.
This commit is contained in:
Pieter-Jan Briers
2024-06-27 16:57:55 +02:00
committed by GitHub
parent 849a790617
commit 0896edf06c
2 changed files with 16 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
using Content.Server.Popups;
using Content.Server.Tabletop.Components;
using Content.Shared.CCVar;
using Content.Shared.Hands.Components;
using Content.Shared.Interaction;
using Content.Shared.Item;
@@ -9,6 +10,7 @@ using Content.Shared.Tabletop.Events;
using Content.Shared.Verbs;
using JetBrains.Annotations;
using Robust.Server.GameObjects;
using Robust.Shared.Configuration;
using Robust.Shared.Enums;
using Robust.Shared.Map;
using Robust.Shared.Player;
@@ -23,6 +25,7 @@ namespace Content.Server.Tabletop
[Dependency] private readonly EyeSystem _eye = default!;
[Dependency] private readonly ViewSubscriberSystem _viewSubscriberSystem = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly IConfigurationManager _cfg = default!;
public override void Initialize()
{
@@ -73,6 +76,9 @@ namespace Content.Server.Tabletop
private void OnInteractUsing(EntityUid uid, TabletopGameComponent component, InteractUsingEvent args)
{
if (!_cfg.GetCVar(CCVars.GameTabletopPlace))
return;
if (!EntityManager.TryGetComponent(args.User, out HandsComponent? hands))
return;

View File

@@ -440,6 +440,16 @@ namespace Content.Shared.CCVar
public static readonly CVarDef<bool> RoundEndPVSOverrides =
CVarDef.Create("game.round_end_pvs_overrides", true, CVar.SERVERONLY);
/// <summary>
/// If true, players can place objects onto tabletop games like chess boards.
/// </summary>
/// <remarks>
/// This feature is currently highly abusable and can easily be used to crash the server,
/// so it's off by default.
/// </remarks>
public static readonly CVarDef<bool> GameTabletopPlace =
CVarDef.Create("game.tabletop_place", false, CVar.SERVERONLY);
/*
* Discord
*/