From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sat, 27 Jul 2024 01:54:38 +0000 (+1000) Subject: Fix VGRoid grid spam (#29946) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=8f250581be8de74592c524a4c4007bf9dac6d9cf;p=space-station-14.git Fix VGRoid grid spam (#29946) Specifically if a grid splits under the cvar size it doesn't get a label. This also stops stuff like shuttles splitting in half creating new entries for the new grids. Splitting code leaves the largest grid as the existing one so this will always prefer to keep it large (but if there's multiple splits it won't adjust). --- diff --git a/Content.Server/Shuttles/Systems/ShuttleSystem.IFF.cs b/Content.Server/Shuttles/Systems/ShuttleSystem.IFF.cs index ed5d109e85..5e746fd495 100644 --- a/Content.Server/Shuttles/Systems/ShuttleSystem.IFF.cs +++ b/Content.Server/Shuttles/Systems/ShuttleSystem.IFF.cs @@ -1,4 +1,5 @@ using Content.Server.Shuttles.Components; +using Content.Shared.CCVar; using Content.Shared.Shuttles.BUIStates; using Content.Shared.Shuttles.Components; using Content.Shared.Shuttles.Events; @@ -12,6 +13,26 @@ public sealed partial class ShuttleSystem SubscribeLocalEvent(OnIFFConsoleAnchor); SubscribeLocalEvent(OnIFFShow); SubscribeLocalEvent(OnIFFShowVessel); + SubscribeLocalEvent(OnGridSplit); + } + + private void OnGridSplit(ref GridSplitEvent ev) + { + var splitMass = _cfg.GetCVar(CCVars.HideSplitGridsUnder); + + if (splitMass < 0) + return; + + foreach (var grid in ev.NewGrids) + { + if (!_physicsQuery.TryGetComponent(grid, out var physics) || + physics.Mass > splitMass) + { + continue; + } + + AddIFFFlag(grid, IFFFlags.HideLabel); + } } private void OnIFFShow(EntityUid uid, IFFConsoleComponent component, IFFShowIFFMessage args) diff --git a/Content.Shared/CCVar/CCVars.cs b/Content.Shared/CCVar/CCVars.cs index a0e9157e92..082d9c8033 100644 --- a/Content.Shared/CCVar/CCVars.cs +++ b/Content.Shared/CCVar/CCVars.cs @@ -1495,6 +1495,13 @@ namespace Content.Shared.CCVar public static readonly CVarDef GodmodeArrivals = CVarDef.Create("shuttle.godmode_arrivals", false, CVar.SERVERONLY); + /// + /// If a grid is split then hide any smaller ones under this mass (kg) from the map. + /// This is useful to avoid split grids spamming out labels. + /// + public static readonly CVarDef HideSplitGridsUnder = + CVarDef.Create("shuttle.hide_split_grids_under", 30, CVar.SERVERONLY); + /// /// Whether to automatically spawn escape shuttles. ///