Random spontaneous cleanup PR (#25131)

* Use new Subs.CVar helper

Removes manual config OnValueChanged calls, removes need to remember to manually unsubscribe.

This both reduces boilerplate and fixes many issues where subscriptions weren't removed on entity system shutdown.

* Fix a bunch of warnings

* More warning fixes

* Use new DateTime serializer to get rid of ISerializationHooks in changelog code.

* Get rid of some more ISerializationHooks for enums

* And a little more

* Apply suggestions from code review

Co-authored-by: 0x6273 <0x40@keemail.me>

---------

Co-authored-by: 0x6273 <0x40@keemail.me>
This commit is contained in:
Pieter-Jan Briers
2024-02-13 22:48:39 +01:00
committed by GitHub
parent d0c174388c
commit 68ce53ae17
210 changed files with 481 additions and 930 deletions

View File

@@ -5,7 +5,8 @@ using Content.Server.Chat.Managers;
using Content.Server.Explosion.EntitySystems;
using Content.Server.NodeContainer.NodeGroups;
using Content.Server.NodeContainer.Nodes;
using Robust.Shared.Map;
using Robust.Server.GameObjects;
using Robust.Shared.Map.Components;
using Robust.Shared.Random;
namespace Content.Server.Ame;
@@ -18,7 +19,6 @@ public sealed class AmeNodeGroup : BaseNodeGroup
{
[Dependency] private readonly IChatManager _chat = default!;
[Dependency] private readonly IEntityManager _entMan = default!;
[Dependency] private readonly IMapManager _mapManager = default!;
[Dependency] private readonly IRobustRandom _random = default!;
/// <summary>
@@ -46,6 +46,7 @@ public sealed class AmeNodeGroup : BaseNodeGroup
var ameControllerSystem = _entMan.System<AmeControllerSystem>();
var ameShieldingSystem = _entMan.System<AmeShieldingSystem>();
var mapSystem = _entMan.System<MapSystem>();
var shieldQuery = _entMan.GetEntityQuery<AmeShieldComponent>();
var controllerQuery = _entMan.GetEntityQuery<AmeControllerComponent>();
@@ -57,7 +58,7 @@ public sealed class AmeNodeGroup : BaseNodeGroup
continue;
if (!xformQuery.TryGetComponent(nodeOwner, out var xform))
continue;
if (!_mapManager.TryGetGrid(xform.GridUid, out var grid))
if (!_entMan.TryGetComponent(xform.GridUid, out MapGridComponent? grid))
continue;
if (gridEnt == null)
@@ -65,7 +66,7 @@ public sealed class AmeNodeGroup : BaseNodeGroup
else if (gridEnt != xform.GridUid)
continue;
var nodeNeighbors = grid.GetCellsInSquareArea(xform.Coordinates, 1)
var nodeNeighbors = mapSystem.GetCellsInSquareArea(xform.GridUid.Value, grid, xform.Coordinates, 1)
.Where(entity => entity != nodeOwner && shieldQuery.HasComponent(entity));
if (nodeNeighbors.Count() >= 8)