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>
(cherry picked from commit 68ce53ae17985876d6d112b764b2144964a9f42e)
This commit is contained in:
Pieter-Jan Briers
2024-02-13 22:48:39 +01:00
committed by Debug
parent 7b1eee2016
commit ccea85136b
210 changed files with 481 additions and 930 deletions

View File

@@ -24,7 +24,7 @@ public sealed class PinpointerSystem : SharedPinpointerSystem
SubscribeLocalEvent<FTLCompletedEvent>(OnLocateTarget);
}
public bool TogglePinpointer(EntityUid uid, PinpointerComponent? pinpointer = null)
public override bool TogglePinpointer(EntityUid uid, PinpointerComponent? pinpointer = null)
{
if (!Resolve(uid, ref pinpointer))
return false;
@@ -128,26 +128,13 @@ public sealed class PinpointerSystem : SharedPinpointerSystem
}
/// <summary>
/// Set pinpointers target to track
/// Update direction from pinpointer to selected target (if it was set)
/// </summary>
public void SetTarget(EntityUid uid, EntityUid? target, PinpointerComponent? pinpointer = null)
protected override void UpdateDirectionToTarget(EntityUid uid, PinpointerComponent? pinpointer = null)
{
if (!Resolve(uid, ref pinpointer))
return;
if (pinpointer.Target == target)
return;
pinpointer.Target = target;
if (pinpointer.IsActive)
UpdateDirectionToTarget(uid, pinpointer);
}
/// <summary>
/// Update direction from pinpointer to selected target (if it was set)
/// </summary>
private void UpdateDirectionToTarget(EntityUid uid, PinpointerComponent pinpointer)
{
if (!pinpointer.IsActive)
return;