From 0896edf06c819080870e63e9744fd8f6e140b84c Mon Sep 17 00:00:00 2001 From: Pieter-Jan Briers Date: Thu, 27 Jun 2024 16:57:55 +0200 Subject: [PATCH] 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. --- Content.Server/Tabletop/TabletopSystem.cs | 6 ++++++ Content.Shared/CCVar/CCVars.cs | 10 ++++++++++ 2 files changed, 16 insertions(+) diff --git a/Content.Server/Tabletop/TabletopSystem.cs b/Content.Server/Tabletop/TabletopSystem.cs index caa319a0b7..f152648e21 100644 --- a/Content.Server/Tabletop/TabletopSystem.cs +++ b/Content.Server/Tabletop/TabletopSystem.cs @@ -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; diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index ef3615f103..a0e9157e92 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -440,6 +440,16 @@ namespace Content.Shared.CCVar public static readonly CVarDef RoundEndPVSOverrides = CVarDef.Create("game.round_end_pvs_overrides", true, CVar.SERVERONLY); + /// + /// If true, players can place objects onto tabletop games like chess boards. + /// + /// + /// This feature is currently highly abusable and can easily be used to crash the server, + /// so it's off by default. + /// + public static readonly CVarDef GameTabletopPlace = + CVarDef.Create("game.tabletop_place", false, CVar.SERVERONLY); + /* * Discord */