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).
This commit is contained in:
@@ -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<IFFConsoleComponent, AnchorStateChangedEvent>(OnIFFConsoleAnchor);
|
||||
SubscribeLocalEvent<IFFConsoleComponent, IFFShowIFFMessage>(OnIFFShow);
|
||||
SubscribeLocalEvent<IFFConsoleComponent, IFFShowVesselMessage>(OnIFFShowVessel);
|
||||
SubscribeLocalEvent<GridSplitEvent>(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)
|
||||
|
||||
Reference in New Issue
Block a user