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

@@ -35,7 +35,7 @@ public sealed class MeleeArcOverlay : Overlay
protected override void Draw(in OverlayDrawArgs args)
{
var player = _playerManager.LocalPlayer?.ControlledEntity;
var player = _playerManager.LocalEntity;
if (!_entManager.TryGetComponent<TransformComponent>(player, out var xform) ||
!_combatMode.IsInCombatMode(player))

View File

@@ -50,7 +50,7 @@ public sealed partial class MeleeWeaponSystem : SharedMeleeWeaponSystem
if (!Timing.IsFirstTimePredicted)
return;
var entityNull = _player.LocalPlayer?.ControlledEntity;
var entityNull = _player.LocalEntity;
if (entityNull == null)
return;

View File

@@ -26,7 +26,7 @@ public sealed class GrapplingGunSystem : SharedGrapplingGunSystem
if (!Timing.IsFirstTimePredicted)
return;
var local = _player.LocalPlayer?.ControlledEntity;
var local = _player.LocalEntity;
var handUid = _hands.GetActiveHandEntity();
if (!TryComp<GrapplingGunComponent>(handUid, out var grappling))

View File

@@ -54,7 +54,7 @@ public sealed class TetherGunSystem : SharedTetherGunSystem
if (!_timing.IsFirstTimePredicted)
return;
var player = _player.LocalPlayer?.ControlledEntity;
var player = _player.LocalEntity;
if (player == null ||
!TryGetTetherGun(player.Value, out var gunUid, out var gun) ||

View File

@@ -33,7 +33,7 @@ public sealed class GunSpreadOverlay : Overlay
{
var worldHandle = args.WorldHandle;
var player = _player.LocalPlayer?.ControlledEntity;
var player = _player.LocalEntity;
if (player == null ||
!_entManager.TryGetComponent<TransformComponent>(player, out var xform))

View File

@@ -24,7 +24,7 @@ public sealed class FlyBySoundSystem : SharedFlyBySoundSystem
private void OnCollide(EntityUid uid, FlyBySoundComponent component, ref StartCollideEvent args)
{
var attachedEnt = _player.LocalPlayer?.ControlledEntity;
var attachedEnt = _player.LocalEntity;
// If it's not our ent or we shot it.
if (attachedEnt == null ||

View File

@@ -132,7 +132,7 @@ public sealed partial class GunSystem : SharedGunSystem
if (!Timing.IsFirstTimePredicted)
return;
var entityNull = _player.LocalPlayer?.ControlledEntity;
var entityNull = _player.LocalEntity;
if (entityNull == null || !TryComp<CombatModeComponent>(entityNull, out var combat) || !combat.IsInCombatMode)
{