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

@@ -2,7 +2,6 @@ using Content.Shared.CCVar;
using Content.Shared.Info;
using Robust.Shared.Configuration;
using Robust.Shared.ContentPack;
using Robust.Shared.Log;
namespace Content.Server.Info;
@@ -16,9 +15,9 @@ public sealed class InfoSystem : EntitySystem
SubscribeNetworkEvent<RequestRulesMessage>(OnRequestRules);
}
protected void OnRequestRules(RequestRulesMessage message, EntitySessionEventArgs eventArgs)
private void OnRequestRules(RequestRulesMessage message, EntitySessionEventArgs eventArgs)
{
Logger.DebugS("info", "Client requested rules.");
Log.Debug("info", "Client requested rules.");
var title = Loc.GetString(_cfg.GetCVar(CCVars.RulesHeader));
var path = _cfg.GetCVar(CCVars.RulesFile);
var rules = "Server could not read its rules.";
@@ -28,7 +27,7 @@ public sealed class InfoSystem : EntitySystem
}
catch (Exception)
{
Logger.ErrorS("info", "Could not read server rules file.");
Log.Debug("info", "Could not read server rules file.");
}
var response = new RulesMessage(title, rules);
RaiseNetworkEvent(response, eventArgs.SenderSession.Channel);