From ae8bf9a8b2b03276cbde53e5cd134be833b720ea Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Sat, 20 Nov 2021 19:49:50 +0000 Subject: [PATCH] aaaaaaaaaa --- .../Events/AnglerChangeStateEvent.cs | 2 +- QSB/Anglerfish/Patches/AnglerPatches.cs | 10 ++-- .../TransformSync/AnglerTransformSync.cs | 2 +- QSB/Animation/NPC/Events/NpcAnimationEvent.cs | 2 +- .../QSBCharacterAnimController.cs | 2 +- .../WorldObjects/QSBSolanumAnimController.cs | 2 +- QSB/Animation/Player/AnimationSync.cs | 2 +- QSB/Animation/Player/AnimatorMirror.cs | 2 +- .../Player/Events/AnimationTriggerEvent.cs | 2 +- .../Player/Events/ChangeAnimTypeEvent.cs | 2 +- .../Player/Events/PlayerSuitEvent.cs | 2 +- .../RemoteThrusterFlameController.cs | 2 +- .../Player/Thrusters/ThrusterManager.cs | 21 ++------- QSB/CampfireSync/Events/CampfireStateEvent.cs | 2 +- .../Events/ClientStateEvent.cs | 2 +- .../Events/ServerStateEvent.cs | 2 +- .../ServerStateManager.cs | 6 +-- .../Events/ConversationEvent.cs | 2 +- .../Events/ConversationStartEndEvent.cs | 2 +- .../Events/DialogueConditionEvent.cs | 2 +- QSB/DeathSync/Events/EndLoopEvent.cs | 2 +- QSB/DeathSync/Events/PlayerDeathEvent.cs | 2 +- QSB/DeathSync/Events/StartLoopEvent.cs | 2 +- QSB/DeathSync/Necronomicon.cs | 2 +- QSB/ElevatorSync/Events/ElevatorEvent.cs | 2 +- QSB/Events/QSBEventManager.cs | 2 +- .../Events/IdentifyFrequencyEvent.cs | 2 +- .../Events/IdentifySignalEvent.cs | 2 +- QSB/GeyserSync/Events/GeyserEvent.cs | 2 +- QSB/ItemSync/Events/DropItemEvent.cs | 2 +- QSB/ItemSync/Events/MoveToCarryEvent.cs | 46 ++++++------------- QSB/ItemSync/Events/SocketItemEvent.cs | 2 +- QSB/LogSync/Events/RevealFactEvent.cs | 2 +- QSB/Menus/MenuManager.cs | 40 +++++----------- QSB/MeteorSync/Events/FragmentDamageEvent.cs | 2 +- QSB/MeteorSync/Events/FragmentResyncEvent.cs | 4 +- QSB/MeteorSync/Events/MeteorLaunchEvent.cs | 2 +- QSB/MeteorSync/Events/MeteorPreLaunchEvent.cs | 2 +- .../Events/MeteorSpecialImpactEvent.cs | 2 +- QSB/MeteorSync/Patches/MeteorClientPatches.cs | 4 +- QSB/MeteorSync/Patches/MeteorServerPatches.cs | 4 +- QSB/MeteorSync/WorldObjects/QSBFragment.cs | 4 +- QSB/OrbSync/Events/OrbSlotEvent.cs | 2 +- QSB/OrbSync/Events/OrbUserEvent.cs | 2 +- QSB/OrbSync/OrbManager.cs | 2 +- .../TransformSync/NomaiOrbTransformSync.cs | 2 +- QSB/Patches/QSBPatchManager.cs | 6 +-- QSB/Player/Events/EnterLeaveEvent.cs | 2 +- QSB/Player/Events/PlayerEntangledEvent.cs | 2 +- QSB/Player/Events/PlayerInformationEvent.cs | 2 +- QSB/Player/Events/PlayerJoinEvent.cs | 2 +- QSB/Player/Events/PlayerKickEvent.cs | 2 +- QSB/Player/Events/PlayerReadyEvent.cs | 2 +- QSB/Player/Events/RequestStateResyncEvent.cs | 2 +- QSB/Player/PlayerInfo.cs | 19 ++------ QSB/Player/QSBPlayerManager.cs | 6 +-- .../CustomNomaiRemoteCameraPlatform.cs | 10 ++-- QSB/QSB.csproj | 6 ++- QSB/QSBSceneManager.cs | 2 +- .../Events/MoonStateChangeEvent.cs | 2 +- .../Events/MultiStateChangeEvent.cs | 2 +- .../Events/QuantumAuthorityEvent.cs | 2 +- QSB/QuantumSync/Events/QuantumShuffleEvent.cs | 2 +- .../Events/SocketStateChangeEvent.cs | 2 +- QSB/RespawnSync/Events/PlayerRespawnEvent.cs | 2 +- QSB/RespawnSync/RespawnManager.cs | 2 +- .../Events/EnterExitRoastingEvent.cs | 13 ++---- .../Events/MarshmallowEventEvent.cs | 2 +- .../Events/SatelliteProjectorEvent.cs | 2 +- .../Events/SatelliteProjectorSnapshotEvent.cs | 2 +- QSB/SectorSync/QSBSectorManager.cs | 4 +- QSB/SectorSync/SectorSync.cs | 2 +- QSB/SectorSync/WorldObjects/QSBSector.cs | 2 +- QSB/ShipSync/Events/FlyShipEvent.cs | 2 +- QSB/ShipSync/Events/FunnelEnableEvent.cs | 2 +- QSB/ShipSync/Events/HatchEvent.cs | 2 +- QSB/ShipSync/Patches/ShipPatches.cs | 2 +- QSB/ShipSync/ShipManager.cs | 2 +- QSB/StatueSync/Events/StartStatueEvent.cs | 2 +- QSB/Syncs/SyncBase.cs | 2 +- QSB/TimeSync/Events/ServerTimeEvent.cs | 2 +- QSB/TimeSync/WakeUpSync.cs | 4 +- .../Events/PlayerFlashlightEvent.cs | 2 +- QSB/Tools/FlashlightTool/FlashlightCreator.cs | 2 +- .../Events/EquipProbeLauncherEvent.cs | 2 +- .../Events/LaunchProbeEvent.cs | 2 +- .../Events/PlayerLaunchProbeEvent.cs | 2 +- .../Events/PlayerRetrieveProbeEvent.cs | 2 +- .../Events/RetrieveProbeEvent.cs | 2 +- .../ProbeLauncherTool/ProbeLauncherCreator.cs | 2 +- .../ProbeTool/Events/PlayerProbeEvent.cs | 2 +- .../Events/ProbeStartRetrieveEvent.cs | 2 +- .../Events/PlayerSignalscopeEvent.cs | 2 +- .../SignalscopeTool/SignalscopeCreator.cs | 2 +- .../Events/PlayerTranslatorEvent.cs | 2 +- .../TranslatorTool/QSBNomaiTranslator.cs | 10 ++-- .../TranslatorTool/QSBTranslatorScanBeam.cs | 10 ++-- QSB/Tools/TranslatorTool/TranslatorCreator.cs | 2 +- .../Events/SetAsTranslatedEvent.cs | 2 +- QSB/Utility/DebugGUI.cs | 2 +- QSB/Utility/Events/DebugEvent.cs | 2 +- QSB/Utility/Extensions.cs | 4 +- QSB/Utility/GlobalMessenger4Args.cs | 4 +- QSB/Utility/GlobalMessenger5Args.cs | 4 +- QSB/Utility/GlobalMessenger6Args.cs | 4 +- QSB/Utility/Popcron.Gizmos/Drawer.cs | 11 ++--- .../Popcron.Gizmos/Drawers/PolygonDrawer.cs | 8 ++-- QSB/Utility/RepeatingManager.cs | 2 +- QSB/Utility/ZOverride.cs | 2 +- QSB/WorldSync/QSBWorldSync.cs | 4 +- QSB/WorldSync/WorldObjectManager.cs | 2 +- 111 files changed, 184 insertions(+), 252 deletions(-) diff --git a/QSB/Anglerfish/Events/AnglerChangeStateEvent.cs b/QSB/Anglerfish/Events/AnglerChangeStateEvent.cs index ed15eaed..efd0dcfa 100644 --- a/QSB/Anglerfish/Events/AnglerChangeStateEvent.cs +++ b/QSB/Anglerfish/Events/AnglerChangeStateEvent.cs @@ -19,7 +19,7 @@ namespace QSB.Anglerfish.Events private void Handler(QSBAngler qsbAngler) => SendEvent(CreateMessage(qsbAngler)); - private AnglerChangeStateMessage CreateMessage(QSBAngler qsbAngler) => new AnglerChangeStateMessage + private AnglerChangeStateMessage CreateMessage(QSBAngler qsbAngler) => new() { ObjectId = qsbAngler.ObjectId, EnumValue = qsbAngler.AttachedObject._currentState, diff --git a/QSB/Anglerfish/Patches/AnglerPatches.cs b/QSB/Anglerfish/Patches/AnglerPatches.cs index cfd556c2..5b8ef3db 100644 --- a/QSB/Anglerfish/Patches/AnglerPatches.cs +++ b/QSB/Anglerfish/Patches/AnglerPatches.cs @@ -228,7 +228,7 @@ namespace QSB.Anglerfish.Patches } } - __instance._targetPos = qsbAngler.TargetTransform.position + normalized * num2; + __instance._targetPos = qsbAngler.TargetTransform.position + (normalized * num2); __instance.RotateTowardsTarget(__instance._targetPos, __instance._turnSpeed, __instance._quickTurnSpeed); if (__instance._turningInPlace) { @@ -287,8 +287,8 @@ namespace QSB.Anglerfish.Patches return false; } - if (__instance._currentState == AnglerfishController.AnglerState.Consuming - || __instance._currentState == AnglerfishController.AnglerState.Stunned) + if (__instance._currentState is AnglerfishController.AnglerState.Consuming + or AnglerfishController.AnglerState.Stunned) { return false; } @@ -311,8 +311,8 @@ namespace QSB.Anglerfish.Patches } else { - if (__instance._currentState != AnglerfishController.AnglerState.Lurking - && __instance._currentState != AnglerfishController.AnglerState.Investigating) + if (__instance._currentState is not AnglerfishController.AnglerState.Lurking + and not AnglerfishController.AnglerState.Investigating) { return false; } diff --git a/QSB/Anglerfish/TransformSync/AnglerTransformSync.cs b/QSB/Anglerfish/TransformSync/AnglerTransformSync.cs index bf8db853..36502bb0 100644 --- a/QSB/Anglerfish/TransformSync/AnglerTransformSync.cs +++ b/QSB/Anglerfish/TransformSync/AnglerTransformSync.cs @@ -13,7 +13,7 @@ namespace QSB.Anglerfish.TransformSync public override bool UseInterpolation => false; private QSBAngler _qsbAngler; - private static readonly List _instances = new List(); + private static readonly List _instances = new(); protected override OWRigidbody GetRigidbody() => _qsbAngler.AttachedObject._anglerBody; diff --git a/QSB/Animation/NPC/Events/NpcAnimationEvent.cs b/QSB/Animation/NPC/Events/NpcAnimationEvent.cs index 46108968..2316e2fa 100644 --- a/QSB/Animation/NPC/Events/NpcAnimationEvent.cs +++ b/QSB/Animation/NPC/Events/NpcAnimationEvent.cs @@ -13,7 +13,7 @@ namespace QSB.Animation.NPC.Events private void Handler(AnimationEvent animEvent, int index) => SendEvent(CreateMessage(animEvent, index)); - private NpcAnimationMessage CreateMessage(AnimationEvent animEvent, int index) => new NpcAnimationMessage + private NpcAnimationMessage CreateMessage(AnimationEvent animEvent, int index) => new() { AboutId = LocalPlayerId, AnimationEvent = animEvent, diff --git a/QSB/Animation/NPC/WorldObjects/QSBCharacterAnimController.cs b/QSB/Animation/NPC/WorldObjects/QSBCharacterAnimController.cs index 56f4b6bd..368717e4 100644 --- a/QSB/Animation/NPC/WorldObjects/QSBCharacterAnimController.cs +++ b/QSB/Animation/NPC/WorldObjects/QSBCharacterAnimController.cs @@ -6,7 +6,7 @@ namespace QSB.Animation.NPC.WorldObjects { internal class QSBCharacterAnimController : NpcAnimController { - private readonly List _playersInHeadZone = new List(); + private readonly List _playersInHeadZone = new(); public List GetPlayersInHeadZone() => _playersInHeadZone; diff --git a/QSB/Animation/NPC/WorldObjects/QSBSolanumAnimController.cs b/QSB/Animation/NPC/WorldObjects/QSBSolanumAnimController.cs index b4e127de..3505f973 100644 --- a/QSB/Animation/NPC/WorldObjects/QSBSolanumAnimController.cs +++ b/QSB/Animation/NPC/WorldObjects/QSBSolanumAnimController.cs @@ -6,7 +6,7 @@ namespace QSB.Animation.NPC.WorldObjects { internal class QSBSolanumAnimController : WorldObject { - private readonly List _playersInHeadZone = new List(); + private readonly List _playersInHeadZone = new(); public override void Init(SolanumAnimController controller, int id) { diff --git a/QSB/Animation/Player/AnimationSync.cs b/QSB/Animation/Player/AnimationSync.cs index 53204e38..0766e86f 100644 --- a/QSB/Animation/Player/AnimationSync.cs +++ b/QSB/Animation/Player/AnimationSync.cs @@ -225,7 +225,7 @@ namespace QSB.Animation.Player InvisibleAnimator.runtimeAnimatorController = controller; VisibleAnimator.runtimeAnimatorController = controller; - if (type != AnimationType.PlayerSuited && type != AnimationType.PlayerUnsuited) + if (type is not AnimationType.PlayerSuited and not AnimationType.PlayerUnsuited) { VisibleAnimator.SetTrigger("Playing"); InvisibleAnimator.SetTrigger("Playing"); diff --git a/QSB/Animation/Player/AnimatorMirror.cs b/QSB/Animation/Player/AnimatorMirror.cs index 08299aa3..b324413b 100644 --- a/QSB/Animation/Player/AnimatorMirror.cs +++ b/QSB/Animation/Player/AnimatorMirror.cs @@ -13,7 +13,7 @@ namespace QSB.Animation.Player private Animator _from; private Animator _to; - private readonly Dictionary _floatParams = new Dictionary(); + private readonly Dictionary _floatParams = new(); public void Init(Animator from, Animator to) { diff --git a/QSB/Animation/Player/Events/AnimationTriggerEvent.cs b/QSB/Animation/Player/Events/AnimationTriggerEvent.cs index c82942a0..8a6709bf 100644 --- a/QSB/Animation/Player/Events/AnimationTriggerEvent.cs +++ b/QSB/Animation/Player/Events/AnimationTriggerEvent.cs @@ -12,7 +12,7 @@ namespace QSB.Animation.Player.Events private void Handler(uint attachedNetId, string name) => SendEvent(CreateMessage(attachedNetId, name)); - private AnimationTriggerMessage CreateMessage(uint attachedNetId, string name) => new AnimationTriggerMessage + private AnimationTriggerMessage CreateMessage(uint attachedNetId, string name) => new() { AboutId = LocalPlayerId, AttachedNetId = attachedNetId, diff --git a/QSB/Animation/Player/Events/ChangeAnimTypeEvent.cs b/QSB/Animation/Player/Events/ChangeAnimTypeEvent.cs index d7ec029d..3773c8fd 100644 --- a/QSB/Animation/Player/Events/ChangeAnimTypeEvent.cs +++ b/QSB/Animation/Player/Events/ChangeAnimTypeEvent.cs @@ -14,7 +14,7 @@ namespace QSB.Animation.Player.Events private void Handler(uint player, AnimationType type) => SendEvent(CreateMessage(player, type)); - private EnumMessage CreateMessage(uint player, AnimationType type) => new EnumMessage + private EnumMessage CreateMessage(uint player, AnimationType type) => new() { AboutId = player, EnumValue = type diff --git a/QSB/Animation/Player/Events/PlayerSuitEvent.cs b/QSB/Animation/Player/Events/PlayerSuitEvent.cs index 87f2dd1f..410d1fa8 100644 --- a/QSB/Animation/Player/Events/PlayerSuitEvent.cs +++ b/QSB/Animation/Player/Events/PlayerSuitEvent.cs @@ -23,7 +23,7 @@ namespace QSB.Animation.Player.Events private void HandleSuitUp() => SendEvent(CreateMessage(true)); private void HandleSuitDown() => SendEvent(CreateMessage(false)); - private ToggleMessage CreateMessage(bool value) => new ToggleMessage + private ToggleMessage CreateMessage(bool value) => new() { AboutId = LocalPlayerId, ToggleValue = value diff --git a/QSB/Animation/Player/Thrusters/RemoteThrusterFlameController.cs b/QSB/Animation/Player/Thrusters/RemoteThrusterFlameController.cs index 1134d483..6d291293 100644 --- a/QSB/Animation/Player/Thrusters/RemoteThrusterFlameController.cs +++ b/QSB/Animation/Player/Thrusters/RemoteThrusterFlameController.cs @@ -8,7 +8,7 @@ namespace QSB.Animation.Player.Thrusters private Thruster _thruster; private Light _light; private AnimationCurve _scaleByThrust = AnimationCurve.Linear(0f, 0f, 1f, 1f); - private DampedSpring _scaleSpring = new DampedSpring(); + private DampedSpring _scaleSpring = new(); private float _belowMaxThrustScalar = 1f; private MeshRenderer _thrusterRenderer; private Vector3 _thrusterFilter; diff --git a/QSB/Animation/Player/Thrusters/ThrusterManager.cs b/QSB/Animation/Player/Thrusters/ThrusterManager.cs index f7238e6e..e8870a03 100644 --- a/QSB/Animation/Player/Thrusters/ThrusterManager.cs +++ b/QSB/Animation/Player/Thrusters/ThrusterManager.cs @@ -47,23 +47,12 @@ namespace QSB.Animation.Player.Thrusters var gameObject = controller.gameObject; var oldThruster = controller.GetValue("_thruster"); var oldLight = controller.GetValue("_light"); - - // pain - Vector3 localPos; - switch (oldThruster) + var localPos = oldThruster switch { - case Thruster.Up_RightThruster: - case Thruster.Up_LeftThruster: - localPos = new Vector3(0, 0, 3); - break; - case Thruster.Down_RightThruster: - case Thruster.Down_LeftThruster: - localPos = new Vector3(0, 0, 7); - break; - default: - localPos = new Vector3(0, 0, 5); - break; - } + Thruster.Up_RightThruster or Thruster.Up_LeftThruster => new Vector3(0, 0, 3), + Thruster.Down_RightThruster or Thruster.Down_LeftThruster => new Vector3(0, 0, 7), + _ => new Vector3(0, 0, 5), + }; oldLight.transform.localPosition = localPos; var oldAnimCurve = controller.GetValue("_scaleByThrust"); diff --git a/QSB/CampfireSync/Events/CampfireStateEvent.cs b/QSB/CampfireSync/Events/CampfireStateEvent.cs index e0bc3df8..1bfb13fa 100644 --- a/QSB/CampfireSync/Events/CampfireStateEvent.cs +++ b/QSB/CampfireSync/Events/CampfireStateEvent.cs @@ -14,7 +14,7 @@ namespace QSB.CampfireSync.Events private void Handler(int objId, Campfire.State state) => SendEvent(CreateMessage(objId, state)); - private EnumWorldObjectMessage CreateMessage(int objId, Campfire.State state) => new EnumWorldObjectMessage + private EnumWorldObjectMessage CreateMessage(int objId, Campfire.State state) => new() { AboutId = LocalPlayerId, ObjectId = objId, diff --git a/QSB/ClientServerStateSync/Events/ClientStateEvent.cs b/QSB/ClientServerStateSync/Events/ClientStateEvent.cs index b664a3e1..aa3b8126 100644 --- a/QSB/ClientServerStateSync/Events/ClientStateEvent.cs +++ b/QSB/ClientServerStateSync/Events/ClientStateEvent.cs @@ -17,7 +17,7 @@ namespace QSB.ClientServerStateSync.Events private void Handler(ClientState state) => SendEvent(CreateMessage(state)); - private EnumMessage CreateMessage(ClientState state) => new EnumMessage + private EnumMessage CreateMessage(ClientState state) => new() { AboutId = LocalPlayerId, EnumValue = state diff --git a/QSB/ClientServerStateSync/Events/ServerStateEvent.cs b/QSB/ClientServerStateSync/Events/ServerStateEvent.cs index c0cabdef..170ea063 100644 --- a/QSB/ClientServerStateSync/Events/ServerStateEvent.cs +++ b/QSB/ClientServerStateSync/Events/ServerStateEvent.cs @@ -15,7 +15,7 @@ namespace QSB.ClientServerStateSync.Events private void Handler(ServerState state) => SendEvent(CreateMessage(state)); - private EnumMessage CreateMessage(ServerState state) => new EnumMessage + private EnumMessage CreateMessage(ServerState state) => new() { AboutId = LocalPlayerId, EnumValue = state diff --git a/QSB/ClientServerStateSync/ServerStateManager.cs b/QSB/ClientServerStateSync/ServerStateManager.cs index 777ca516..85f323c7 100644 --- a/QSB/ClientServerStateSync/ServerStateManager.cs +++ b/QSB/ClientServerStateSync/ServerStateManager.cs @@ -133,9 +133,9 @@ namespace QSB.ClientServerStateSync if (_currentState == ServerState.WaitingForAllPlayersToReady) { if (QSBPlayerManager.PlayerList.All(x - => x.State == ClientState.WaitingForOthersToReadyInSolarSystem - || x.State == ClientState.AliveInSolarSystem - || x.State == ClientState.AliveInEye)) + => x.State is ClientState.WaitingForOthersToReadyInSolarSystem + or ClientState.AliveInSolarSystem + or ClientState.AliveInEye)) { DebugLog.DebugWrite($"All ready!!"); QSBEventManager.FireEvent(EventNames.QSBStartLoop); diff --git a/QSB/ConversationSync/Events/ConversationEvent.cs b/QSB/ConversationSync/Events/ConversationEvent.cs index d60a1d76..c9073432 100644 --- a/QSB/ConversationSync/Events/ConversationEvent.cs +++ b/QSB/ConversationSync/Events/ConversationEvent.cs @@ -14,7 +14,7 @@ namespace QSB.ConversationSync.Events private void Handler(uint id, string message, ConversationType type) => SendEvent(CreateMessage(id, message, type)); - private ConversationMessage CreateMessage(uint id, string message, ConversationType type) => new ConversationMessage + private ConversationMessage CreateMessage(uint id, string message, ConversationType type) => new() { AboutId = LocalPlayerId, ObjectId = (int)id, diff --git a/QSB/ConversationSync/Events/ConversationStartEndEvent.cs b/QSB/ConversationSync/Events/ConversationStartEndEvent.cs index 83fbc3c1..32dc8178 100644 --- a/QSB/ConversationSync/Events/ConversationStartEndEvent.cs +++ b/QSB/ConversationSync/Events/ConversationStartEndEvent.cs @@ -15,7 +15,7 @@ namespace QSB.ConversationSync.Events private void Handler(int objId, uint playerId, bool state) => SendEvent(CreateMessage(objId, playerId, state)); - private ConversationStartEndMessage CreateMessage(int objId, uint playerId, bool state) => new ConversationStartEndMessage + private ConversationStartEndMessage CreateMessage(int objId, uint playerId, bool state) => new() { AboutId = LocalPlayerId, TreeId = objId, diff --git a/QSB/ConversationSync/Events/DialogueConditionEvent.cs b/QSB/ConversationSync/Events/DialogueConditionEvent.cs index c1380ff4..c97e3cf5 100644 --- a/QSB/ConversationSync/Events/DialogueConditionEvent.cs +++ b/QSB/ConversationSync/Events/DialogueConditionEvent.cs @@ -12,7 +12,7 @@ namespace QSB.ConversationSync.Events private void Handler(string name, bool state) => SendEvent(CreateMessage(name, state)); - private DialogueConditionMessage CreateMessage(string name, bool state) => new DialogueConditionMessage + private DialogueConditionMessage CreateMessage(string name, bool state) => new() { AboutId = LocalPlayerId, ConditionName = name, diff --git a/QSB/DeathSync/Events/EndLoopEvent.cs b/QSB/DeathSync/Events/EndLoopEvent.cs index 17ed544d..17af3ffb 100644 --- a/QSB/DeathSync/Events/EndLoopEvent.cs +++ b/QSB/DeathSync/Events/EndLoopEvent.cs @@ -15,7 +15,7 @@ namespace QSB.DeathSync.Events private void Handler(EndLoopReason type) => SendEvent(CreateMessage(type)); - private EnumMessage CreateMessage(EndLoopReason type) => new EnumMessage + private EnumMessage CreateMessage(EndLoopReason type) => new() { AboutId = LocalPlayerId, EnumValue = type diff --git a/QSB/DeathSync/Events/PlayerDeathEvent.cs b/QSB/DeathSync/Events/PlayerDeathEvent.cs index 8767faf6..0cf756c4 100644 --- a/QSB/DeathSync/Events/PlayerDeathEvent.cs +++ b/QSB/DeathSync/Events/PlayerDeathEvent.cs @@ -15,7 +15,7 @@ namespace QSB.DeathSync.Events private void Handler(DeathType type) => SendEvent(CreateMessage(type)); - private PlayerDeathMessage CreateMessage(DeathType type) => new PlayerDeathMessage + private PlayerDeathMessage CreateMessage(DeathType type) => new() { AboutId = LocalPlayerId, EnumValue = type, diff --git a/QSB/DeathSync/Events/StartLoopEvent.cs b/QSB/DeathSync/Events/StartLoopEvent.cs index a24ae4a7..4911070c 100644 --- a/QSB/DeathSync/Events/StartLoopEvent.cs +++ b/QSB/DeathSync/Events/StartLoopEvent.cs @@ -14,7 +14,7 @@ namespace QSB.DeathSync.Events private void Handler() => SendEvent(CreateMessage()); - private PlayerMessage CreateMessage() => new PlayerMessage + private PlayerMessage CreateMessage() => new() { AboutId = LocalPlayerId }; diff --git a/QSB/DeathSync/Necronomicon.cs b/QSB/DeathSync/Necronomicon.cs index c41a7663..7759b662 100644 --- a/QSB/DeathSync/Necronomicon.cs +++ b/QSB/DeathSync/Necronomicon.cs @@ -5,7 +5,7 @@ namespace QSB.DeathSync { public static class Necronomicon { - private static readonly Dictionary Darkhold = new Dictionary + private static readonly Dictionary Darkhold = new() { { DeathType.Default, new[] // Running out of health { diff --git a/QSB/ElevatorSync/Events/ElevatorEvent.cs b/QSB/ElevatorSync/Events/ElevatorEvent.cs index 5328676a..84f037e4 100644 --- a/QSB/ElevatorSync/Events/ElevatorEvent.cs +++ b/QSB/ElevatorSync/Events/ElevatorEvent.cs @@ -14,7 +14,7 @@ namespace QSB.ElevatorSync.Events private void Handler(int id, bool isGoingUp) => SendEvent(CreateMessage(id, isGoingUp)); - private BoolWorldObjectMessage CreateMessage(int id, bool isGoingUp) => new BoolWorldObjectMessage + private BoolWorldObjectMessage CreateMessage(int id, bool isGoingUp) => new() { State = isGoingUp, ObjectId = id diff --git a/QSB/Events/QSBEventManager.cs b/QSB/Events/QSBEventManager.cs index 1336ee66..4fb43a48 100644 --- a/QSB/Events/QSBEventManager.cs +++ b/QSB/Events/QSBEventManager.cs @@ -39,7 +39,7 @@ namespace QSB.Events { public static bool Ready { get; private set; } - private static List _eventList = new List(); + private static List _eventList = new(); public static void Init() { diff --git a/QSB/FrequencySync/Events/IdentifyFrequencyEvent.cs b/QSB/FrequencySync/Events/IdentifyFrequencyEvent.cs index da96f4b5..37acd137 100644 --- a/QSB/FrequencySync/Events/IdentifyFrequencyEvent.cs +++ b/QSB/FrequencySync/Events/IdentifyFrequencyEvent.cs @@ -13,7 +13,7 @@ namespace QSB.FrequencySync.Events private void Handler(SignalFrequency frequency) => SendEvent(CreateMessage(frequency)); - private EnumMessage CreateMessage(SignalFrequency frequency) => new EnumMessage + private EnumMessage CreateMessage(SignalFrequency frequency) => new() { AboutId = QSBPlayerManager.LocalPlayerId, EnumValue = frequency diff --git a/QSB/FrequencySync/Events/IdentifySignalEvent.cs b/QSB/FrequencySync/Events/IdentifySignalEvent.cs index 622e48ab..8c0d5522 100644 --- a/QSB/FrequencySync/Events/IdentifySignalEvent.cs +++ b/QSB/FrequencySync/Events/IdentifySignalEvent.cs @@ -13,7 +13,7 @@ namespace QSB.FrequencySync.Events private void Handler(SignalName name) => SendEvent(CreateMessage(name)); - private EnumMessage CreateMessage(SignalName name) => new EnumMessage + private EnumMessage CreateMessage(SignalName name) => new() { AboutId = QSBPlayerManager.LocalPlayerId, EnumValue = name diff --git a/QSB/GeyserSync/Events/GeyserEvent.cs b/QSB/GeyserSync/Events/GeyserEvent.cs index 13ac1e02..d13a50c6 100644 --- a/QSB/GeyserSync/Events/GeyserEvent.cs +++ b/QSB/GeyserSync/Events/GeyserEvent.cs @@ -14,7 +14,7 @@ namespace QSB.GeyserSync.Events private void Handler(int id, bool state) => SendEvent(CreateMessage(id, state)); - private BoolWorldObjectMessage CreateMessage(int id, bool state) => new BoolWorldObjectMessage + private BoolWorldObjectMessage CreateMessage(int id, bool state) => new() { AboutId = LocalPlayerId, ObjectId = id, diff --git a/QSB/ItemSync/Events/DropItemEvent.cs b/QSB/ItemSync/Events/DropItemEvent.cs index 92024fa4..4ecc5e00 100644 --- a/QSB/ItemSync/Events/DropItemEvent.cs +++ b/QSB/ItemSync/Events/DropItemEvent.cs @@ -20,7 +20,7 @@ namespace QSB.ItemSync.Events private void Handler(int objectId, Vector3 position, Vector3 normal, Sector sector) => SendEvent(CreateMessage(objectId, position, normal, sector)); - private DropItemMessage CreateMessage(int objectId, Vector3 position, Vector3 normal, Sector sector) => new DropItemMessage + private DropItemMessage CreateMessage(int objectId, Vector3 position, Vector3 normal, Sector sector) => new() { ObjectId = objectId, Position = position, diff --git a/QSB/ItemSync/Events/MoveToCarryEvent.cs b/QSB/ItemSync/Events/MoveToCarryEvent.cs index 6f118ad3..ab5cf81c 100644 --- a/QSB/ItemSync/Events/MoveToCarryEvent.cs +++ b/QSB/ItemSync/Events/MoveToCarryEvent.cs @@ -20,7 +20,7 @@ namespace QSB.ItemSync.Events private void Handler(int itemId) => SendEvent(CreateMessage(itemId)); - private WorldObjectMessage CreateMessage(int itemid) => new WorldObjectMessage + private WorldObjectMessage CreateMessage(int itemid) => new() { AboutId = QSBPlayerManager.LocalPlayerId, ObjectId = itemid @@ -33,39 +33,19 @@ namespace QSB.ItemSync.Events var itemType = itemObject.GetItemType(); player.HeldItem = itemObject; - - Transform itemSocket = null; - switch (itemType) + var itemSocket = itemType switch { - case ItemType.Scroll: - itemSocket = player.ScrollSocket; - break; - case ItemType.SharedStone: - itemSocket = player.SharedStoneSocket; - break; - case ItemType.WarpCore: - itemSocket = ((QSBWarpCoreItem)itemObject).IsVesselCoreType() - ? player.VesselCoreSocket - : player.WarpCoreSocket; - break; - case ItemType.Lantern: - itemSocket = player.SimpleLanternSocket; - break; - case ItemType.DreamLantern: - itemSocket = player.DreamLanternSocket; - break; - case ItemType.SlideReel: - itemSocket = player.SlideReelSocket; - break; - case ItemType.VisionTorch: - itemSocket = player.VisionTorchSocket; - break; - default: - itemSocket = player.ItemSocket; - break; - - } - + ItemType.Scroll => player.ScrollSocket, + ItemType.SharedStone => player.SharedStoneSocket, + ItemType.WarpCore => ((QSBWarpCoreItem)itemObject).IsVesselCoreType() + ? player.VesselCoreSocket + : player.WarpCoreSocket, + ItemType.Lantern => player.SimpleLanternSocket, + ItemType.DreamLantern => player.DreamLanternSocket, + ItemType.SlideReel => player.SlideReelSocket, + ItemType.VisionTorch => player.VisionTorchSocket, + _ => player.ItemSocket, + }; itemObject.PickUpItem(itemSocket, message.AboutId); } } diff --git a/QSB/ItemSync/Events/SocketItemEvent.cs b/QSB/ItemSync/Events/SocketItemEvent.cs index a36e139a..088ab528 100644 --- a/QSB/ItemSync/Events/SocketItemEvent.cs +++ b/QSB/ItemSync/Events/SocketItemEvent.cs @@ -20,7 +20,7 @@ namespace QSB.ItemSync.Events private void Handler(int socketId, int itemId, SocketEventType type) => SendEvent(CreateMessage(socketId, itemId, type)); - private SocketItemMessage CreateMessage(int socketId, int itemId, SocketEventType type) => new SocketItemMessage + private SocketItemMessage CreateMessage(int socketId, int itemId, SocketEventType type) => new() { AboutId = QSBPlayerManager.LocalPlayerId, SocketId = socketId, diff --git a/QSB/LogSync/Events/RevealFactEvent.cs b/QSB/LogSync/Events/RevealFactEvent.cs index 3c93efb2..2fd1c43f 100644 --- a/QSB/LogSync/Events/RevealFactEvent.cs +++ b/QSB/LogSync/Events/RevealFactEvent.cs @@ -12,7 +12,7 @@ namespace QSB.LogSync.Events private void Handler(string id, bool saveGame, bool showNotification) => SendEvent(CreateMessage(id, saveGame, showNotification)); - private RevealFactMessage CreateMessage(string id, bool saveGame, bool showNotification) => new RevealFactMessage + private RevealFactMessage CreateMessage(string id, bool saveGame, bool showNotification) => new() { AboutId = LocalPlayerId, FactId = id, diff --git a/QSB/Menus/MenuManager.cs b/QSB/Menus/MenuManager.cs index 633d090d..350a911c 100644 --- a/QSB/Menus/MenuManager.cs +++ b/QSB/Menus/MenuManager.cs @@ -196,26 +196,14 @@ namespace QSB.Menus public void OnKicked(KickReason reason) { - string text; - switch (reason) + var text = reason switch { - case KickReason.QSBVersionNotMatching: - text = "Server refused connection as QSB version does not match."; - break; - case KickReason.GameVersionNotMatching: - text = "Server refused connection as Outer Wilds version does not match."; - break; - case KickReason.GamePlatformNotMatching: - text = "Server refused connection as Outer Wilds platform does not match. (Steam/Epic)"; - break; - case KickReason.None: - text = "Kicked from server. No reason given."; - break; - default: - text = $"Kicked from server. KickReason:{reason}"; - break; - } - + KickReason.QSBVersionNotMatching => "Server refused connection as QSB version does not match.", + KickReason.GameVersionNotMatching => "Server refused connection as Outer Wilds version does not match.", + KickReason.GamePlatformNotMatching => "Server refused connection as Outer Wilds platform does not match. (Steam/Epic)", + KickReason.None => "Kicked from server. No reason given.", + _ => $"Kicked from server. KickReason:{reason}", + }; OpenInfoPopup(text, "OK"); DisconnectButton.gameObject.SetActive(false); @@ -230,17 +218,11 @@ namespace QSB.Menus return; } - string text; - switch (error) + var text = error switch { - case NetworkError.Timeout: - text = "Client disconnected with error!\r\nConnection timed out."; - break; - default: - text = $"Client disconnected with error!\r\nNetworkError:{error}"; - break; - } - + NetworkError.Timeout => "Client disconnected with error!\r\nConnection timed out.", + _ => $"Client disconnected with error!\r\nNetworkError:{error}", + }; OpenInfoPopup(text, "OK"); DisconnectButton.gameObject.SetActive(false); diff --git a/QSB/MeteorSync/Events/FragmentDamageEvent.cs b/QSB/MeteorSync/Events/FragmentDamageEvent.cs index cc9edb39..4b830cbd 100644 --- a/QSB/MeteorSync/Events/FragmentDamageEvent.cs +++ b/QSB/MeteorSync/Events/FragmentDamageEvent.cs @@ -17,7 +17,7 @@ namespace QSB.MeteorSync.Events private void Handler(QSBFragment qsbFragment, float damage) => SendEvent(CreateMessage(qsbFragment, damage)); - private FragmentDamageMessage CreateMessage(QSBFragment qsbFragment, float damage) => new FragmentDamageMessage + private FragmentDamageMessage CreateMessage(QSBFragment qsbFragment, float damage) => new() { ObjectId = qsbFragment.ObjectId, Damage = damage diff --git a/QSB/MeteorSync/Events/FragmentResyncEvent.cs b/QSB/MeteorSync/Events/FragmentResyncEvent.cs index 7fb7c83c..443fc85d 100644 --- a/QSB/MeteorSync/Events/FragmentResyncEvent.cs +++ b/QSB/MeteorSync/Events/FragmentResyncEvent.cs @@ -73,11 +73,11 @@ namespace QSB.MeteorSync.Events var whiteHoleVolume = MeteorManager.WhiteHoleVolume; var attachedFluidDetector = body.GetAttachedFluidDetector(); var attachedForceDetector = body.GetAttachedForceDetector(); - if (attachedFluidDetector != null && attachedFluidDetector is ConstantFluidDetector constantFluidDetector) + if (attachedFluidDetector is not null and ConstantFluidDetector constantFluidDetector) { constantFluidDetector.SetDetectableFluid(whiteHoleVolume._fluidVolume); } - if (attachedForceDetector != null && attachedForceDetector is ConstantForceDetector constantForceDetector) + if (attachedForceDetector is not null and ConstantForceDetector constantForceDetector) { constantForceDetector.ClearAllFields(); } diff --git a/QSB/MeteorSync/Events/MeteorLaunchEvent.cs b/QSB/MeteorSync/Events/MeteorLaunchEvent.cs index 814ce498..6ab9fe82 100644 --- a/QSB/MeteorSync/Events/MeteorLaunchEvent.cs +++ b/QSB/MeteorSync/Events/MeteorLaunchEvent.cs @@ -17,7 +17,7 @@ namespace QSB.MeteorSync.Events private void Handler(QSBMeteorLauncher qsbMeteorLauncher) => SendEvent(CreateMessage(qsbMeteorLauncher)); - private MeteorLaunchMessage CreateMessage(QSBMeteorLauncher qsbMeteorLauncher) => new MeteorLaunchMessage + private MeteorLaunchMessage CreateMessage(QSBMeteorLauncher qsbMeteorLauncher) => new() { ObjectId = qsbMeteorLauncher.ObjectId, MeteorId = qsbMeteorLauncher.MeteorId, diff --git a/QSB/MeteorSync/Events/MeteorPreLaunchEvent.cs b/QSB/MeteorSync/Events/MeteorPreLaunchEvent.cs index 08bf54d3..b56b87a8 100644 --- a/QSB/MeteorSync/Events/MeteorPreLaunchEvent.cs +++ b/QSB/MeteorSync/Events/MeteorPreLaunchEvent.cs @@ -17,7 +17,7 @@ namespace QSB.MeteorSync.Events private void Handler(QSBMeteorLauncher qsbMeteorLauncher) => SendEvent(CreateMessage(qsbMeteorLauncher)); - private WorldObjectMessage CreateMessage(QSBMeteorLauncher qsbMeteorLauncher) => new WorldObjectMessage + private WorldObjectMessage CreateMessage(QSBMeteorLauncher qsbMeteorLauncher) => new() { ObjectId = qsbMeteorLauncher.ObjectId }; diff --git a/QSB/MeteorSync/Events/MeteorSpecialImpactEvent.cs b/QSB/MeteorSync/Events/MeteorSpecialImpactEvent.cs index 7ebc3723..f2433ae9 100644 --- a/QSB/MeteorSync/Events/MeteorSpecialImpactEvent.cs +++ b/QSB/MeteorSync/Events/MeteorSpecialImpactEvent.cs @@ -17,7 +17,7 @@ namespace QSB.MeteorSync.Events private void Handler(QSBMeteor qsbMeteor) => SendEvent(CreateMessage(qsbMeteor)); - private WorldObjectMessage CreateMessage(QSBMeteor qsbMeteor) => new WorldObjectMessage + private WorldObjectMessage CreateMessage(QSBMeteor qsbMeteor) => new() { ObjectId = qsbMeteor.ObjectId }; diff --git a/QSB/MeteorSync/Patches/MeteorClientPatches.cs b/QSB/MeteorSync/Patches/MeteorClientPatches.cs index 6ae3ef85..1db879bc 100644 --- a/QSB/MeteorSync/Patches/MeteorClientPatches.cs +++ b/QSB/MeteorSync/Patches/MeteorClientPatches.cs @@ -52,7 +52,7 @@ namespace QSB.MeteorSync.Patches } if (meteorController != null) { - var linearVelocity = __instance._parentBody.GetPointVelocity(__instance.transform.position) + __instance.transform.TransformDirection(__instance._launchDirection) * qsbMeteorLauncher.LaunchSpeed; + var linearVelocity = __instance._parentBody.GetPointVelocity(__instance.transform.position) + (__instance.transform.TransformDirection(__instance._launchDirection) * qsbMeteorLauncher.LaunchSpeed); var angularVelocity = __instance.transform.forward * 2f; meteorController.Launch(null, __instance.transform.position, __instance.transform.rotation, linearVelocity, angularVelocity); if (__instance._audioSector.ContainsOccupant(DynamicOccupant.Player)) @@ -134,7 +134,7 @@ namespace QSB.MeteorSync.Patches { var vector = __instance._attachedBody.GetPosition() - __instance._anchorBody.GetPosition(); var d = Mathf.Min(distance, qsbFragment.LeashLength - vector.magnitude); - __instance._attachedBody.SetPosition(__instance._anchorBody.GetPosition() + vector.normalized * d); + __instance._attachedBody.SetPosition(__instance._anchorBody.GetPosition() + (vector.normalized * d)); } return false; diff --git a/QSB/MeteorSync/Patches/MeteorServerPatches.cs b/QSB/MeteorSync/Patches/MeteorServerPatches.cs index ab20f802..54fbe8b1 100644 --- a/QSB/MeteorSync/Patches/MeteorServerPatches.cs +++ b/QSB/MeteorSync/Patches/MeteorServerPatches.cs @@ -118,7 +118,7 @@ namespace QSB.MeteorSync.Patches qsbMeteorLauncher.MeteorId = qsbMeteor.ObjectId; qsbMeteorLauncher.LaunchSpeed = Random.Range(__instance._minLaunchSpeed, __instance._maxLaunchSpeed); - var linearVelocity = __instance._parentBody.GetPointVelocity(__instance.transform.position) + __instance.transform.TransformDirection(__instance._launchDirection) * qsbMeteorLauncher.LaunchSpeed; + var linearVelocity = __instance._parentBody.GetPointVelocity(__instance.transform.position) + (__instance.transform.TransformDirection(__instance._launchDirection) * qsbMeteorLauncher.LaunchSpeed); var angularVelocity = __instance.transform.forward * 2f; meteorController.Launch(null, __instance.transform.position, __instance.transform.rotation, linearVelocity, angularVelocity); if (__instance._audioSector.ContainsOccupant(DynamicOccupant.Player)) @@ -184,7 +184,7 @@ namespace QSB.MeteorSync.Patches { var vector = __instance._attachedBody.GetPosition() - __instance._anchorBody.GetPosition(); var d = Mathf.Min(distance, qsbFragment.LeashLength - vector.magnitude); - __instance._attachedBody.SetPosition(__instance._anchorBody.GetPosition() + vector.normalized * d); + __instance._attachedBody.SetPosition(__instance._anchorBody.GetPosition() + (vector.normalized * d)); } return false; diff --git a/QSB/MeteorSync/WorldObjects/QSBFragment.cs b/QSB/MeteorSync/WorldObjects/QSBFragment.cs index b9d26ab6..66e0d840 100644 --- a/QSB/MeteorSync/WorldObjects/QSBFragment.cs +++ b/QSB/MeteorSync/WorldObjects/QSBFragment.cs @@ -36,8 +36,6 @@ namespace QSB.MeteorSync.WorldObjects public float LeashLength; public void AddDamage(float damage) - { - AttachedObject.AddDamage(damage); - } + => AttachedObject.AddDamage(damage); } } diff --git a/QSB/OrbSync/Events/OrbSlotEvent.cs b/QSB/OrbSync/Events/OrbSlotEvent.cs index 15b6bc81..d3b2e21e 100644 --- a/QSB/OrbSync/Events/OrbSlotEvent.cs +++ b/QSB/OrbSync/Events/OrbSlotEvent.cs @@ -13,7 +13,7 @@ namespace QSB.OrbSync.Events private void Handler(int slotId, int orbId, bool slotState) => SendEvent(CreateMessage(slotId, orbId, slotState)); - private OrbSlotMessage CreateMessage(int slotId, int orbId, bool slotState) => new OrbSlotMessage + private OrbSlotMessage CreateMessage(int slotId, int orbId, bool slotState) => new() { AboutId = LocalPlayerId, SlotId = slotId, diff --git a/QSB/OrbSync/Events/OrbUserEvent.cs b/QSB/OrbSync/Events/OrbUserEvent.cs index 77f8c1a9..1387be75 100644 --- a/QSB/OrbSync/Events/OrbUserEvent.cs +++ b/QSB/OrbSync/Events/OrbUserEvent.cs @@ -19,7 +19,7 @@ namespace QSB.OrbSync.Events private void Handler(int id) => SendEvent(CreateMessage(id)); - private WorldObjectMessage CreateMessage(int id) => new WorldObjectMessage + private WorldObjectMessage CreateMessage(int id) => new() { AboutId = LocalPlayerId, ObjectId = id diff --git a/QSB/OrbSync/OrbManager.cs b/QSB/OrbSync/OrbManager.cs index e04584fc..b25a315a 100644 --- a/QSB/OrbSync/OrbManager.cs +++ b/QSB/OrbSync/OrbManager.cs @@ -12,7 +12,7 @@ namespace QSB.OrbSync { public class OrbManager : WorldObjectManager { - private List _orbs = new List(); + private List _orbs = new(); protected override void RebuildWorldObjects(OWScene scene) { diff --git a/QSB/OrbSync/TransformSync/NomaiOrbTransformSync.cs b/QSB/OrbSync/TransformSync/NomaiOrbTransformSync.cs index 6333612b..f955aeb4 100644 --- a/QSB/OrbSync/TransformSync/NomaiOrbTransformSync.cs +++ b/QSB/OrbSync/TransformSync/NomaiOrbTransformSync.cs @@ -9,7 +9,7 @@ namespace QSB.OrbSync.TransformSync { internal class NomaiOrbTransformSync : UnsectoredTransformSync { - public static List OrbTransformSyncs = new List(); + public static List OrbTransformSyncs = new(); private int _index => OrbTransformSyncs.IndexOf(this); diff --git a/QSB/Patches/QSBPatchManager.cs b/QSB/Patches/QSBPatchManager.cs index aa368234..72a234aa 100644 --- a/QSB/Patches/QSBPatchManager.cs +++ b/QSB/Patches/QSBPatchManager.cs @@ -37,10 +37,10 @@ namespace QSB.Patches public static event Action OnPatchType; public static event Action OnUnpatchType; - private static List _patchList = new List(); - private static List _patchedTypes = new List(); + private static List _patchList = new(); + private static List _patchedTypes = new(); - public static Dictionary TypeToInstance = new Dictionary(); + public static Dictionary TypeToInstance = new(); public static void Init() { diff --git a/QSB/Player/Events/EnterLeaveEvent.cs b/QSB/Player/Events/EnterLeaveEvent.cs index 8ac611cc..430ceec7 100644 --- a/QSB/Player/Events/EnterLeaveEvent.cs +++ b/QSB/Player/Events/EnterLeaveEvent.cs @@ -44,7 +44,7 @@ namespace QSB.Player.Events private void Handler(EnterLeaveType type, int objectId = -1) => SendEvent(CreateMessage(type, objectId)); - private EnumWorldObjectMessage CreateMessage(EnterLeaveType type, int objectId) => new EnumWorldObjectMessage + private EnumWorldObjectMessage CreateMessage(EnterLeaveType type, int objectId) => new() { AboutId = LocalPlayerId, EnumValue = type, diff --git a/QSB/Player/Events/PlayerEntangledEvent.cs b/QSB/Player/Events/PlayerEntangledEvent.cs index 047f6d9e..6e2ee698 100644 --- a/QSB/Player/Events/PlayerEntangledEvent.cs +++ b/QSB/Player/Events/PlayerEntangledEvent.cs @@ -14,7 +14,7 @@ namespace QSB.Player.Events private void Handler(int id) => SendEvent(CreateMessage(id)); - private WorldObjectMessage CreateMessage(int id) => new WorldObjectMessage + private WorldObjectMessage CreateMessage(int id) => new() { AboutId = LocalPlayerId, ObjectId = id diff --git a/QSB/Player/Events/PlayerInformationEvent.cs b/QSB/Player/Events/PlayerInformationEvent.cs index 89e0ba55..8866348c 100644 --- a/QSB/Player/Events/PlayerInformationEvent.cs +++ b/QSB/Player/Events/PlayerInformationEvent.cs @@ -13,7 +13,7 @@ namespace QSB.Player.Events private void Handler() => SendEvent(CreateMessage(QSBPlayerManager.LocalPlayer)); - private PlayerInformationMessage CreateMessage(PlayerInfo player) => new PlayerInformationMessage + private PlayerInformationMessage CreateMessage(PlayerInfo player) => new() { AboutId = player.PlayerId, PlayerName = player.Name, diff --git a/QSB/Player/Events/PlayerJoinEvent.cs b/QSB/Player/Events/PlayerJoinEvent.cs index 7a3f0149..af1c939a 100644 --- a/QSB/Player/Events/PlayerJoinEvent.cs +++ b/QSB/Player/Events/PlayerJoinEvent.cs @@ -13,7 +13,7 @@ namespace QSB.Player.Events private void Handler(string name) => SendEvent(CreateMessage(name)); - private PlayerJoinMessage CreateMessage(string name) => new PlayerJoinMessage + private PlayerJoinMessage CreateMessage(string name) => new() { AboutId = LocalPlayerId, PlayerName = name, diff --git a/QSB/Player/Events/PlayerKickEvent.cs b/QSB/Player/Events/PlayerKickEvent.cs index ad4216d8..18cf0fd4 100644 --- a/QSB/Player/Events/PlayerKickEvent.cs +++ b/QSB/Player/Events/PlayerKickEvent.cs @@ -16,7 +16,7 @@ namespace QSB.Player.Events private void Handler(uint player, KickReason reason) => SendEvent(CreateMessage(player, reason)); - private EnumMessage CreateMessage(uint player, KickReason reason) => new EnumMessage + private EnumMessage CreateMessage(uint player, KickReason reason) => new() { AboutId = player, EnumValue = reason diff --git a/QSB/Player/Events/PlayerReadyEvent.cs b/QSB/Player/Events/PlayerReadyEvent.cs index 88b147b9..c10ba090 100644 --- a/QSB/Player/Events/PlayerReadyEvent.cs +++ b/QSB/Player/Events/PlayerReadyEvent.cs @@ -14,7 +14,7 @@ namespace QSB.Player.Events private void Handler(bool ready) => SendEvent(CreateMessage(ready)); - private ToggleMessage CreateMessage(bool ready) => new ToggleMessage + private ToggleMessage CreateMessage(bool ready) => new() { AboutId = LocalPlayerId, ToggleValue = ready diff --git a/QSB/Player/Events/RequestStateResyncEvent.cs b/QSB/Player/Events/RequestStateResyncEvent.cs index bd8802df..8fba4773 100644 --- a/QSB/Player/Events/RequestStateResyncEvent.cs +++ b/QSB/Player/Events/RequestStateResyncEvent.cs @@ -23,7 +23,7 @@ namespace QSB.Player.Events private void Handler() => SendEvent(CreateMessage()); - private PlayerMessage CreateMessage() => new PlayerMessage + private PlayerMessage CreateMessage() => new() { AboutId = LocalPlayerId }; diff --git a/QSB/Player/PlayerInfo.cs b/QSB/Player/PlayerInfo.cs index 584cd0de..6c64da03 100644 --- a/QSB/Player/PlayerInfo.cs +++ b/QSB/Player/PlayerInfo.cs @@ -56,6 +56,7 @@ namespace QSB.Player { DebugLog.ToConsole($"Warning - {PlayerId}.Body is null!", MessageType.Warning); } + return _body; } set @@ -64,6 +65,7 @@ namespace QSB.Player { DebugLog.ToConsole($"Warning - Setting {PlayerId}.Body to null.", MessageType.Warning); } + _body = value; } } @@ -75,18 +77,7 @@ namespace QSB.Player // Tools public GameObject ProbeBody { get; set; } public QSBProbe Probe { get; set; } - public QSBFlashlight FlashLight - { - get - { - if (CameraBody == null) - { - return null; - } - - return CameraBody.GetComponentInChildren(); - } - } + public QSBFlashlight FlashLight => CameraBody?.GetComponentInChildren(); public QSBTool Signalscope => GetToolByType(ToolType.Signalscope); public QSBTool Translator => GetToolByType(ToolType.Translator); public QSBProbeLauncherTool ProbeLauncher => (QSBProbeLauncherTool)GetToolByType(ToolType.ProbeLauncher); @@ -109,8 +100,8 @@ namespace QSB.Player // Animation public AnimationSync AnimationSync => QSBPlayerManager.GetSyncObject(PlayerId); - public bool PlayingInstrument => AnimationSync.CurrentType != AnimationType.PlayerSuited - && AnimationSync.CurrentType != AnimationType.PlayerUnsuited; + public bool PlayingInstrument => AnimationSync.CurrentType is not AnimationType.PlayerSuited + and not AnimationType.PlayerUnsuited; public JetpackAccelerationSync JetpackAcceleration { get; set; } // Misc diff --git a/QSB/Player/QSBPlayerManager.cs b/QSB/Player/QSBPlayerManager.cs index 7a5efe55..268aacfd 100644 --- a/QSB/Player/QSBPlayerManager.cs +++ b/QSB/Player/QSBPlayerManager.cs @@ -41,11 +41,11 @@ namespace QSB.Player public static PlayerInfo LocalPlayer => GetPlayer(LocalPlayerId); public static List PlayerList { get; } = new List(); - private static readonly List PlayerSyncObjects = new List(); + private static readonly List PlayerSyncObjects = new(); public static PlayerInfo GetPlayer(uint id) { - if (id == uint.MaxValue || id == 0U) + if (id is uint.MaxValue or 0U) { return default; } @@ -129,7 +129,7 @@ namespace QSB.Player } public static Tuple> GetPlayerFlashlights() - => new Tuple>(Locator.GetFlashlight(), PlayerList.Where(x => x.FlashLight != null).Select(x => x.FlashLight)); + => new(Locator.GetFlashlight(), PlayerList.Where(x => x.FlashLight != null).Select(x => x.FlashLight)); public static void ShowAllPlayers() => PlayerList.Where(x => x != LocalPlayer).ToList().ForEach(x => ChangePlayerVisibility(x.PlayerId, true)); diff --git a/QSB/PoolSync/CustomNomaiRemoteCameraPlatform.cs b/QSB/PoolSync/CustomNomaiRemoteCameraPlatform.cs index d7ac3218..dd59607e 100644 --- a/QSB/PoolSync/CustomNomaiRemoteCameraPlatform.cs +++ b/QSB/PoolSync/CustomNomaiRemoteCameraPlatform.cs @@ -55,7 +55,7 @@ namespace QSB.PoolSync private bool _anyoneStillOnPlatform; private bool _wasLocalInBounds; private CameraState _cameraState; - private readonly Dictionary _playerToHologram = new Dictionary(); + private readonly Dictionary _playerToHologram = new(); private void Awake() { @@ -129,7 +129,7 @@ namespace QSB.PoolSync CustomPlatformList.Remove(this); } - if (_cameraState == CameraState.Connected || _cameraState == CameraState.Connecting_FadeIn || _cameraState == CameraState.Connecting_FadeOut) + if (_cameraState is CameraState.Connected or CameraState.Connecting_FadeIn or CameraState.Connecting_FadeOut) { DisconnectCamera(); SwitchToPlayerCamera(); @@ -231,7 +231,7 @@ namespace QSB.PoolSync _slavePlatform.UpdatePoolRenderer(); if (_slavePlatform._transitionFade == 1f) { - _slavePlatform._poolT = ((!(_slavePlatform._sharedStone == null)) ? 1f : 0f); + _slavePlatform._poolT = (!(_slavePlatform._sharedStone == null)) ? 1f : 0f; _slavePlatform._showPlayerRipples = false; _slavePlatform._activePlayerHolo = null; _slavePlatform.UpdatePoolRenderer(); @@ -550,7 +550,7 @@ namespace QSB.PoolSync } var cameraState = _cameraState; - if (cameraState != CameraState.Disconnected && cameraState != CameraState.Disconnecting_FadeOut) + if (cameraState is not CameraState.Disconnected and not CameraState.Disconnecting_FadeOut) { if (cameraState == CameraState.Disconnecting_FadeIn) { @@ -574,7 +574,7 @@ namespace QSB.PoolSync } var cameraState = _cameraState; - if (cameraState != CameraState.Connected && cameraState != CameraState.Connecting_FadeOut) + if (cameraState is not CameraState.Connected and not CameraState.Connecting_FadeOut) { if (cameraState == CameraState.Connecting_FadeIn) { diff --git a/QSB/QSB.csproj b/QSB/QSB.csproj index 88b5d5b5..f66faa03 100644 --- a/QSB/QSB.csproj +++ b/QSB/QSB.csproj @@ -1,5 +1,8 @@  + + 9 + Debug @@ -88,6 +91,8 @@ + + @@ -147,7 +152,6 @@ - diff --git a/QSB/QSBSceneManager.cs b/QSB/QSBSceneManager.cs index e099d9e9..17377f0a 100644 --- a/QSB/QSBSceneManager.cs +++ b/QSB/QSBSceneManager.cs @@ -38,6 +38,6 @@ namespace QSB } private static bool InUniverse(OWScene scene) => - scene == OWScene.SolarSystem || scene == OWScene.EyeOfTheUniverse; + scene is OWScene.SolarSystem or OWScene.EyeOfTheUniverse; } } \ No newline at end of file diff --git a/QSB/QuantumSync/Events/MoonStateChangeEvent.cs b/QSB/QuantumSync/Events/MoonStateChangeEvent.cs index 8b6919b0..44a73839 100644 --- a/QSB/QuantumSync/Events/MoonStateChangeEvent.cs +++ b/QSB/QuantumSync/Events/MoonStateChangeEvent.cs @@ -15,7 +15,7 @@ namespace QSB.QuantumSync.Events private void Handler(int stateIndex, Vector3 onUnitSphere, int orbitAngle) => SendEvent(CreateMessage(stateIndex, onUnitSphere, orbitAngle)); - private MoonStateChangeMessage CreateMessage(int stateIndex, Vector3 onUnitSphere, int orbitAngle) => new MoonStateChangeMessage + private MoonStateChangeMessage CreateMessage(int stateIndex, Vector3 onUnitSphere, int orbitAngle) => new() { AboutId = LocalPlayerId, StateIndex = stateIndex, diff --git a/QSB/QuantumSync/Events/MultiStateChangeEvent.cs b/QSB/QuantumSync/Events/MultiStateChangeEvent.cs index cc5ae231..c1fe429c 100644 --- a/QSB/QuantumSync/Events/MultiStateChangeEvent.cs +++ b/QSB/QuantumSync/Events/MultiStateChangeEvent.cs @@ -15,7 +15,7 @@ namespace QSB.QuantumSync.Events private void Handler(int objid, int stateIndex) => SendEvent(CreateMessage(objid, stateIndex)); - private MultiStateChangeMessage CreateMessage(int objid, int stateIndex) => new MultiStateChangeMessage + private MultiStateChangeMessage CreateMessage(int objid, int stateIndex) => new() { AboutId = LocalPlayerId, ObjectId = objid, diff --git a/QSB/QuantumSync/Events/QuantumAuthorityEvent.cs b/QSB/QuantumSync/Events/QuantumAuthorityEvent.cs index ca14d361..5696779d 100644 --- a/QSB/QuantumSync/Events/QuantumAuthorityEvent.cs +++ b/QSB/QuantumSync/Events/QuantumAuthorityEvent.cs @@ -13,7 +13,7 @@ namespace QSB.QuantumSync.Events private void Handler(int objId, uint authorityOwner) => SendEvent(CreateMessage(objId, authorityOwner)); - private QuantumAuthorityMessage CreateMessage(int objId, uint authorityOwner) => new QuantumAuthorityMessage + private QuantumAuthorityMessage CreateMessage(int objId, uint authorityOwner) => new() { AboutId = LocalPlayerId, ObjectId = objId, diff --git a/QSB/QuantumSync/Events/QuantumShuffleEvent.cs b/QSB/QuantumSync/Events/QuantumShuffleEvent.cs index ba7d0454..9eb6f257 100644 --- a/QSB/QuantumSync/Events/QuantumShuffleEvent.cs +++ b/QSB/QuantumSync/Events/QuantumShuffleEvent.cs @@ -13,7 +13,7 @@ namespace QSB.QuantumSync.Events private void Handler(int objid, int[] indexArray) => SendEvent(CreateMessage(objid, indexArray)); - private QuantumShuffleMessage CreateMessage(int objid, int[] indexArray) => new QuantumShuffleMessage + private QuantumShuffleMessage CreateMessage(int objid, int[] indexArray) => new() { AboutId = LocalPlayerId, ObjectId = objid, diff --git a/QSB/QuantumSync/Events/SocketStateChangeEvent.cs b/QSB/QuantumSync/Events/SocketStateChangeEvent.cs index fae1d8a1..4130b420 100644 --- a/QSB/QuantumSync/Events/SocketStateChangeEvent.cs +++ b/QSB/QuantumSync/Events/SocketStateChangeEvent.cs @@ -16,7 +16,7 @@ namespace QSB.QuantumSync.Events private void Handler(int objid, int socketid, Quaternion localRotation) => SendEvent(CreateMessage(objid, socketid, localRotation)); - private SocketStateChangeMessage CreateMessage(int objid, int socketid, Quaternion localRotation) => new SocketStateChangeMessage + private SocketStateChangeMessage CreateMessage(int objid, int socketid, Quaternion localRotation) => new() { AboutId = LocalPlayerId, ObjectId = objid, diff --git a/QSB/RespawnSync/Events/PlayerRespawnEvent.cs b/QSB/RespawnSync/Events/PlayerRespawnEvent.cs index 51af5b16..96f3924d 100644 --- a/QSB/RespawnSync/Events/PlayerRespawnEvent.cs +++ b/QSB/RespawnSync/Events/PlayerRespawnEvent.cs @@ -17,7 +17,7 @@ namespace QSB.RespawnSync.Events private void Handler(uint playerId) => SendEvent(CreateMessage(playerId)); - private PlayerMessage CreateMessage(uint playerId) => new PlayerMessage + private PlayerMessage CreateMessage(uint playerId) => new() { AboutId = playerId }; diff --git a/QSB/RespawnSync/RespawnManager.cs b/QSB/RespawnSync/RespawnManager.cs index e5c8f9a5..d0ec0688 100644 --- a/QSB/RespawnSync/RespawnManager.cs +++ b/QSB/RespawnSync/RespawnManager.cs @@ -16,7 +16,7 @@ namespace QSB.RespawnSync public bool RespawnNeeded => _playersPendingRespawn.Count != 0; - private List _playersPendingRespawn = new List(); + private List _playersPendingRespawn = new(); private NotificationData _previousNotification; private GameObject _owRecoveryPoint; private GameObject _qsbRecoveryPoint; diff --git a/QSB/RoastingSync/Events/EnterExitRoastingEvent.cs b/QSB/RoastingSync/Events/EnterExitRoastingEvent.cs index 14bdda8b..99ceccbd 100644 --- a/QSB/RoastingSync/Events/EnterExitRoastingEvent.cs +++ b/QSB/RoastingSync/Events/EnterExitRoastingEvent.cs @@ -35,7 +35,7 @@ namespace QSB.RoastingSync.Events SendEvent(CreateMessage(qsbObj.ObjectId, roasting)); } - private BoolWorldObjectMessage CreateMessage(int objectId, bool roasting) => new BoolWorldObjectMessage + private BoolWorldObjectMessage CreateMessage(int objectId, bool roasting) => new() { AboutId = LocalPlayerId, State = roasting, @@ -57,14 +57,9 @@ namespace QSB.RoastingSync.Events var player = QSBPlayerManager.GetPlayer(message.AboutId); player.RoastingStick.SetActive(message.State); - if (message.State) - { - player.Campfire = QSBWorldSync.GetWorldFromId(message.ObjectId); - } - else - { - player.Campfire = null; - } + player.Campfire = message.State + ? QSBWorldSync.GetWorldFromId(message.ObjectId) + : null; } } } diff --git a/QSB/RoastingSync/Events/MarshmallowEventEvent.cs b/QSB/RoastingSync/Events/MarshmallowEventEvent.cs index 75d78e31..d422d636 100644 --- a/QSB/RoastingSync/Events/MarshmallowEventEvent.cs +++ b/QSB/RoastingSync/Events/MarshmallowEventEvent.cs @@ -18,7 +18,7 @@ namespace QSB.RoastingSync.Events private void Handler(MarshmallowEventType type) => SendEvent(CreateMessage(type)); - private EnumMessage CreateMessage(MarshmallowEventType type) => new EnumMessage + private EnumMessage CreateMessage(MarshmallowEventType type) => new() { AboutId = LocalPlayerId, EnumValue = type diff --git a/QSB/SatelliteSync/Events/SatelliteProjectorEvent.cs b/QSB/SatelliteSync/Events/SatelliteProjectorEvent.cs index 685912a2..c49cfa97 100644 --- a/QSB/SatelliteSync/Events/SatelliteProjectorEvent.cs +++ b/QSB/SatelliteSync/Events/SatelliteProjectorEvent.cs @@ -21,7 +21,7 @@ namespace QSB.SatelliteSync.Events private void Handler(bool usingProjector) => SendEvent(CreateMessage(usingProjector)); - private BoolMessage CreateMessage(bool usingProjector) => new BoolMessage + private BoolMessage CreateMessage(bool usingProjector) => new() { AboutId = LocalPlayerId, Value = usingProjector diff --git a/QSB/SatelliteSync/Events/SatelliteProjectorSnapshotEvent.cs b/QSB/SatelliteSync/Events/SatelliteProjectorSnapshotEvent.cs index 144754a4..6c29f3d9 100644 --- a/QSB/SatelliteSync/Events/SatelliteProjectorSnapshotEvent.cs +++ b/QSB/SatelliteSync/Events/SatelliteProjectorSnapshotEvent.cs @@ -13,7 +13,7 @@ namespace QSB.SatelliteSync.Events private void Handler(bool forward) => SendEvent(CreateMessage(forward)); - private BoolMessage CreateMessage(bool forward) => new BoolMessage + private BoolMessage CreateMessage(bool forward) => new() { AboutId = LocalPlayerId, Value = forward diff --git a/QSB/SectorSync/QSBSectorManager.cs b/QSB/SectorSync/QSBSectorManager.cs index 9dedaa14..6967cc40 100644 --- a/QSB/SectorSync/QSBSectorManager.cs +++ b/QSB/SectorSync/QSBSectorManager.cs @@ -13,12 +13,12 @@ namespace QSB.SectorSync { public static QSBSectorManager Instance { get; private set; } public bool IsReady { get; private set; } - public List FakeSectors = new List(); + public List FakeSectors = new(); private void OnEnable() => RepeatingManager.Repeatings.Add(this); private void OnDisable() => RepeatingManager.Repeatings.Remove(this); - public List SectoredSyncs = new List(); + public List SectoredSyncs = new(); public void Invoke() { diff --git a/QSB/SectorSync/SectorSync.cs b/QSB/SectorSync/SectorSync.cs index 105d85a0..ed1f9895 100644 --- a/QSB/SectorSync/SectorSync.cs +++ b/QSB/SectorSync/SectorSync.cs @@ -13,7 +13,7 @@ namespace QSB.SectorSync public class SectorSync : MonoBehaviour { public bool IsReady { get; private set; } - public List SectorList = new List(); + public List SectorList = new(); private OWRigidbody _attachedOWRigidbody; private SectorDetector _sectorDetector; diff --git a/QSB/SectorSync/WorldObjects/QSBSector.cs b/QSB/SectorSync/WorldObjects/QSBSector.cs index 63b3ae51..0a85a8e5 100644 --- a/QSB/SectorSync/WorldObjects/QSBSector.cs +++ b/QSB/SectorSync/WorldObjects/QSBSector.cs @@ -63,7 +63,7 @@ namespace QSB.SectorSync.WorldObjects return false; } - if (AttachedObject.name == "Sector_Shuttle" || AttachedObject.name == "Sector_NomaiShuttleInterior") + if (AttachedObject.name is "Sector_Shuttle" or "Sector_NomaiShuttleInterior") { if (QSBSceneManager.CurrentScene == OWScene.SolarSystem) { diff --git a/QSB/ShipSync/Events/FlyShipEvent.cs b/QSB/ShipSync/Events/FlyShipEvent.cs index da877e20..db4f9c56 100644 --- a/QSB/ShipSync/Events/FlyShipEvent.cs +++ b/QSB/ShipSync/Events/FlyShipEvent.cs @@ -28,7 +28,7 @@ namespace QSB.ShipSync.Events private void Handler(bool flying) => SendEvent(CreateMessage(flying)); - private BoolMessage CreateMessage(bool flying) => new BoolMessage + private BoolMessage CreateMessage(bool flying) => new() { AboutId = LocalPlayerId, Value = flying diff --git a/QSB/ShipSync/Events/FunnelEnableEvent.cs b/QSB/ShipSync/Events/FunnelEnableEvent.cs index ab177fa3..2a7e4789 100644 --- a/QSB/ShipSync/Events/FunnelEnableEvent.cs +++ b/QSB/ShipSync/Events/FunnelEnableEvent.cs @@ -15,7 +15,7 @@ namespace QSB.ShipSync.Events private void Handler() => SendEvent(CreateMessage()); - private PlayerMessage CreateMessage() => new PlayerMessage + private PlayerMessage CreateMessage() => new() { AboutId = LocalPlayerId }; diff --git a/QSB/ShipSync/Events/HatchEvent.cs b/QSB/ShipSync/Events/HatchEvent.cs index d1dcb503..8991b342 100644 --- a/QSB/ShipSync/Events/HatchEvent.cs +++ b/QSB/ShipSync/Events/HatchEvent.cs @@ -16,7 +16,7 @@ namespace QSB.ShipSync.Events private void Handler(bool open) => SendEvent(CreateMessage(open)); - private BoolMessage CreateMessage(bool open) => new BoolMessage + private BoolMessage CreateMessage(bool open) => new() { AboutId = LocalPlayerId, Value = open diff --git a/QSB/ShipSync/Patches/ShipPatches.cs b/QSB/ShipSync/Patches/ShipPatches.cs index da558a15..2bc90fa0 100644 --- a/QSB/ShipSync/Patches/ShipPatches.cs +++ b/QSB/ShipSync/Patches/ShipPatches.cs @@ -224,7 +224,7 @@ namespace QSB.ShipSync.Patches return false; } - ____integrity = Mathf.Min(____integrity + Time.deltaTime / ____repairTime, 1f); + ____integrity = Mathf.Min(____integrity + (Time.deltaTime / ____repairTime), 1f); QSBEventManager.FireEvent(EventNames.QSBHullRepairTick, __instance, ____integrity); if (____integrity >= 1f) diff --git a/QSB/ShipSync/ShipManager.cs b/QSB/ShipSync/ShipManager.cs index 9d008d31..31204387 100644 --- a/QSB/ShipSync/ShipManager.cs +++ b/QSB/ShipSync/ShipManager.cs @@ -37,7 +37,7 @@ namespace QSB.ShipSync } } - private List _playersInShip = new List(); + private List _playersInShip = new(); private uint _currentFlyer = uint.MaxValue; diff --git a/QSB/StatueSync/Events/StartStatueEvent.cs b/QSB/StatueSync/Events/StartStatueEvent.cs index 75238b05..614cb689 100644 --- a/QSB/StatueSync/Events/StartStatueEvent.cs +++ b/QSB/StatueSync/Events/StartStatueEvent.cs @@ -17,7 +17,7 @@ namespace QSB.StatueSync.Events private void Handler(Vector3 position, Quaternion rotation, float degrees) => SendEvent(CreateMessage(position, rotation, degrees)); - private StartStatueMessage CreateMessage(Vector3 position, Quaternion rotation, float degrees) => new StartStatueMessage + private StartStatueMessage CreateMessage(Vector3 position, Quaternion rotation, float degrees) => new() { AboutId = LocalPlayerId, PlayerPosition = position, diff --git a/QSB/Syncs/SyncBase.cs b/QSB/Syncs/SyncBase.cs index b991ea2f..4215809a 100644 --- a/QSB/Syncs/SyncBase.cs +++ b/QSB/Syncs/SyncBase.cs @@ -18,7 +18,7 @@ namespace QSB.Syncs public abstract class SyncBase : QNetworkTransform { - private static readonly Dictionary> _storedTransformSyncs = new Dictionary>(); + private static readonly Dictionary> _storedTransformSyncs = new(); public static T GetPlayers(PlayerInfo player) where T : SyncBase diff --git a/QSB/TimeSync/Events/ServerTimeEvent.cs b/QSB/TimeSync/Events/ServerTimeEvent.cs index cde7c7bc..ea42df74 100644 --- a/QSB/TimeSync/Events/ServerTimeEvent.cs +++ b/QSB/TimeSync/Events/ServerTimeEvent.cs @@ -11,7 +11,7 @@ namespace QSB.TimeSync.Events private void Handler(float time, int count) => SendEvent(CreateMessage(time, count)); - private ServerTimeMessage CreateMessage(float time, int count) => new ServerTimeMessage + private ServerTimeMessage CreateMessage(float time, int count) => new() { AboutId = LocalPlayerId, ServerTime = time, diff --git a/QSB/TimeSync/WakeUpSync.cs b/QSB/TimeSync/WakeUpSync.cs index 5b42b415..203b0dbd 100644 --- a/QSB/TimeSync/WakeUpSync.cs +++ b/QSB/TimeSync/WakeUpSync.cs @@ -324,7 +324,7 @@ namespace QSB.TimeSync // Checks to pause/fastforward - if (clientState == ClientState.NotLoaded || clientState == ClientState.InTitleScreen) + if (clientState is ClientState.NotLoaded or ClientState.InTitleScreen) { return; } @@ -400,7 +400,7 @@ namespace QSB.TimeSync { var diff = GetTimeDifference(); - if (diff > PauseOrFastForwardThreshold || diff < -PauseOrFastForwardThreshold) + if (diff is > PauseOrFastForwardThreshold or < (-PauseOrFastForwardThreshold)) { WakeUpOrSleep(); return; diff --git a/QSB/Tools/FlashlightTool/Events/PlayerFlashlightEvent.cs b/QSB/Tools/FlashlightTool/Events/PlayerFlashlightEvent.cs index 8865a744..d91e6dbc 100644 --- a/QSB/Tools/FlashlightTool/Events/PlayerFlashlightEvent.cs +++ b/QSB/Tools/FlashlightTool/Events/PlayerFlashlightEvent.cs @@ -23,7 +23,7 @@ namespace QSB.Tools.FlashlightTool.Events private void HandleTurnOn() => SendEvent(CreateMessage(true)); private void HandleTurnOff() => SendEvent(CreateMessage(false)); - private ToggleMessage CreateMessage(bool value) => new ToggleMessage + private ToggleMessage CreateMessage(bool value) => new() { AboutId = LocalPlayerId, ToggleValue = value diff --git a/QSB/Tools/FlashlightTool/FlashlightCreator.cs b/QSB/Tools/FlashlightTool/FlashlightCreator.cs index 05fa28ea..3478edf5 100644 --- a/QSB/Tools/FlashlightTool/FlashlightCreator.cs +++ b/QSB/Tools/FlashlightTool/FlashlightCreator.cs @@ -4,7 +4,7 @@ namespace QSB.Tools.FlashlightTool { internal static class FlashlightCreator { - private static readonly Vector3 FlashlightOffset = new Vector3(0.7196316f, -0.2697681f, 0.3769455f); + private static readonly Vector3 FlashlightOffset = new(0.7196316f, -0.2697681f, 0.3769455f); internal static void CreateFlashlight(Transform cameraBody) { diff --git a/QSB/Tools/ProbeLauncherTool/Events/EquipProbeLauncherEvent.cs b/QSB/Tools/ProbeLauncherTool/Events/EquipProbeLauncherEvent.cs index 378b60e3..b198acf9 100644 --- a/QSB/Tools/ProbeLauncherTool/Events/EquipProbeLauncherEvent.cs +++ b/QSB/Tools/ProbeLauncherTool/Events/EquipProbeLauncherEvent.cs @@ -57,7 +57,7 @@ namespace QSB.Tools.ProbeLauncherTool.Events SendEvent(CreateMessage(false)); } - private ToggleMessage CreateMessage(bool value) => new ToggleMessage + private ToggleMessage CreateMessage(bool value) => new() { AboutId = LocalPlayerId, ToggleValue = value diff --git a/QSB/Tools/ProbeLauncherTool/Events/LaunchProbeEvent.cs b/QSB/Tools/ProbeLauncherTool/Events/LaunchProbeEvent.cs index 6dd99eb8..af41dfb2 100644 --- a/QSB/Tools/ProbeLauncherTool/Events/LaunchProbeEvent.cs +++ b/QSB/Tools/ProbeLauncherTool/Events/LaunchProbeEvent.cs @@ -17,7 +17,7 @@ namespace QSB.Tools.ProbeLauncherTool.Events private void Handler(QSBProbeLauncher launcher) => SendEvent(CreateMessage(launcher)); - private BoolWorldObjectMessage CreateMessage(QSBProbeLauncher launcher) => new BoolWorldObjectMessage + private BoolWorldObjectMessage CreateMessage(QSBProbeLauncher launcher) => new() { AboutId = LocalPlayerId, ObjectId = launcher.ObjectId diff --git a/QSB/Tools/ProbeLauncherTool/Events/PlayerLaunchProbeEvent.cs b/QSB/Tools/ProbeLauncherTool/Events/PlayerLaunchProbeEvent.cs index 27c4a226..7af2d342 100644 --- a/QSB/Tools/ProbeLauncherTool/Events/PlayerLaunchProbeEvent.cs +++ b/QSB/Tools/ProbeLauncherTool/Events/PlayerLaunchProbeEvent.cs @@ -16,7 +16,7 @@ namespace QSB.Tools.ProbeLauncherTool.Events private void Handler() => SendEvent(CreateMessage()); - private PlayerMessage CreateMessage() => new PlayerMessage + private PlayerMessage CreateMessage() => new() { AboutId = LocalPlayerId }; diff --git a/QSB/Tools/ProbeLauncherTool/Events/PlayerRetrieveProbeEvent.cs b/QSB/Tools/ProbeLauncherTool/Events/PlayerRetrieveProbeEvent.cs index 92c5b5b9..d0a44229 100644 --- a/QSB/Tools/ProbeLauncherTool/Events/PlayerRetrieveProbeEvent.cs +++ b/QSB/Tools/ProbeLauncherTool/Events/PlayerRetrieveProbeEvent.cs @@ -16,7 +16,7 @@ namespace QSB.Tools.ProbeLauncherTool.Events private void Handler(bool playEffects) => SendEvent(CreateMessage(playEffects)); - private BoolMessage CreateMessage(bool playEffects) => new BoolMessage + private BoolMessage CreateMessage(bool playEffects) => new() { AboutId = LocalPlayerId, Value = playEffects diff --git a/QSB/Tools/ProbeLauncherTool/Events/RetrieveProbeEvent.cs b/QSB/Tools/ProbeLauncherTool/Events/RetrieveProbeEvent.cs index 493ea936..ab0dfdd8 100644 --- a/QSB/Tools/ProbeLauncherTool/Events/RetrieveProbeEvent.cs +++ b/QSB/Tools/ProbeLauncherTool/Events/RetrieveProbeEvent.cs @@ -17,7 +17,7 @@ namespace QSB.Tools.ProbeLauncherTool.Events private void Handler(QSBProbeLauncher launcher, bool playEffects) => SendEvent(CreateMessage(launcher, playEffects)); - private BoolWorldObjectMessage CreateMessage(QSBProbeLauncher launcher, bool playEffects) => new BoolWorldObjectMessage + private BoolWorldObjectMessage CreateMessage(QSBProbeLauncher launcher, bool playEffects) => new() { AboutId = LocalPlayerId, ObjectId = launcher.ObjectId, diff --git a/QSB/Tools/ProbeLauncherTool/ProbeLauncherCreator.cs b/QSB/Tools/ProbeLauncherTool/ProbeLauncherCreator.cs index 5f9e97db..0a38bfd1 100644 --- a/QSB/Tools/ProbeLauncherTool/ProbeLauncherCreator.cs +++ b/QSB/Tools/ProbeLauncherTool/ProbeLauncherCreator.cs @@ -4,7 +4,7 @@ namespace QSB.Tools.ProbeLauncherTool { internal static class ProbeLauncherCreator { - private static readonly Vector3 ProbeLauncherOffset = new Vector3(0.5745087f, -0.26f, 0.4453125f); + private static readonly Vector3 ProbeLauncherOffset = new(0.5745087f, -0.26f, 0.4453125f); internal static void CreateProbeLauncher(Transform cameraBody) { diff --git a/QSB/Tools/ProbeTool/Events/PlayerProbeEvent.cs b/QSB/Tools/ProbeTool/Events/PlayerProbeEvent.cs index c63f9dfc..fae21b5e 100644 --- a/QSB/Tools/ProbeTool/Events/PlayerProbeEvent.cs +++ b/QSB/Tools/ProbeTool/Events/PlayerProbeEvent.cs @@ -16,7 +16,7 @@ namespace QSB.Tools.ProbeTool.Events private void Handler(ProbeEvent probeEvent) => SendEvent(CreateMessage(probeEvent)); - private EnumMessage CreateMessage(ProbeEvent probeEvent) => new EnumMessage + private EnumMessage CreateMessage(ProbeEvent probeEvent) => new() { AboutId = LocalPlayerId, EnumValue = probeEvent diff --git a/QSB/Tools/ProbeTool/Events/ProbeStartRetrieveEvent.cs b/QSB/Tools/ProbeTool/Events/ProbeStartRetrieveEvent.cs index b0c1cdf8..c696a2cb 100644 --- a/QSB/Tools/ProbeTool/Events/ProbeStartRetrieveEvent.cs +++ b/QSB/Tools/ProbeTool/Events/ProbeStartRetrieveEvent.cs @@ -16,7 +16,7 @@ namespace QSB.Tools.ProbeTool.Events private void Handler(float duration) => SendEvent(CreateMessage(duration)); - private FloatMessage CreateMessage(float duration) => new FloatMessage + private FloatMessage CreateMessage(float duration) => new() { AboutId = LocalPlayerId, Value = duration diff --git a/QSB/Tools/SignalscopeTool/Events/PlayerSignalscopeEvent.cs b/QSB/Tools/SignalscopeTool/Events/PlayerSignalscopeEvent.cs index 1463010f..08c96e8d 100644 --- a/QSB/Tools/SignalscopeTool/Events/PlayerSignalscopeEvent.cs +++ b/QSB/Tools/SignalscopeTool/Events/PlayerSignalscopeEvent.cs @@ -23,7 +23,7 @@ namespace QSB.Tools.SignalscopeTool.Events private void HandleEquip(Signalscope var) => SendEvent(CreateMessage(true)); private void HandleUnequip() => SendEvent(CreateMessage(false)); - private ToggleMessage CreateMessage(bool value) => new ToggleMessage + private ToggleMessage CreateMessage(bool value) => new() { AboutId = LocalPlayerId, ToggleValue = value diff --git a/QSB/Tools/SignalscopeTool/SignalscopeCreator.cs b/QSB/Tools/SignalscopeTool/SignalscopeCreator.cs index a7771849..b2d92dd9 100644 --- a/QSB/Tools/SignalscopeTool/SignalscopeCreator.cs +++ b/QSB/Tools/SignalscopeTool/SignalscopeCreator.cs @@ -4,7 +4,7 @@ namespace QSB.Tools.SignalscopeTool { internal static class SignalscopeCreator { - private static readonly Vector3 SignalscopeScale = new Vector3(1.5f, 1.5f, 1.5f); + private static readonly Vector3 SignalscopeScale = new(1.5f, 1.5f, 1.5f); internal static void CreateSignalscope(Transform cameraBody) { diff --git a/QSB/Tools/TranslatorTool/Events/PlayerTranslatorEvent.cs b/QSB/Tools/TranslatorTool/Events/PlayerTranslatorEvent.cs index 82570126..30cac533 100644 --- a/QSB/Tools/TranslatorTool/Events/PlayerTranslatorEvent.cs +++ b/QSB/Tools/TranslatorTool/Events/PlayerTranslatorEvent.cs @@ -23,7 +23,7 @@ namespace QSB.Tools.TranslatorTool.Events private void HandleEquip() => SendEvent(CreateMessage(true)); private void HandleUnequip() => SendEvent(CreateMessage(false)); - private ToggleMessage CreateMessage(bool value) => new ToggleMessage + private ToggleMessage CreateMessage(bool value) => new() { AboutId = LocalPlayerId, ToggleValue = value diff --git a/QSB/Tools/TranslatorTool/QSBNomaiTranslator.cs b/QSB/Tools/TranslatorTool/QSBNomaiTranslator.cs index b2e7aca0..32e3ee7d 100644 --- a/QSB/Tools/TranslatorTool/QSBNomaiTranslator.cs +++ b/QSB/Tools/TranslatorTool/QSBNomaiTranslator.cs @@ -25,9 +25,7 @@ namespace QSB.Tools.TranslatorTool } public override void OnDisable() - { - _translatorProp.OnFinishUnequipAnimation(); - } + => _translatorProp.OnFinishUnequipAnimation(); public override void EquipTool() { @@ -72,7 +70,7 @@ namespace QSB.Tools.TranslatorTool if (_currentNomaiText != null) { - tooCloseToTarget = (num < _currentNomaiText.GetMinimumReadableDistance()); + tooCloseToTarget = num < _currentNomaiText.GetMinimumReadableDistance(); if (_currentNomaiText is NomaiWallText) { @@ -83,7 +81,7 @@ namespace QSB.Tools.TranslatorTool if (distToCenter > _lastLineDist + 0.1f) { _lastHighlightedTextLine = nomaiTextLine; - _lastLineWasTranslated = (nomaiTextLine != null && nomaiTextLine.IsTranslated()); + _lastLineWasTranslated = nomaiTextLine != null && nomaiTextLine.IsTranslated(); _lastLineLocked = false; } else @@ -105,7 +103,7 @@ namespace QSB.Tools.TranslatorTool else { _lastHighlightedTextLine = nomaiTextLine; - _lastLineWasTranslated = (nomaiTextLine != null && nomaiTextLine.IsTranslated()); + _lastLineWasTranslated = nomaiTextLine != null && nomaiTextLine.IsTranslated(); } if (nomaiTextLine && !nomaiTextLine.IsHidden() && nomaiTextLine.IsActive()) diff --git a/QSB/Tools/TranslatorTool/QSBTranslatorScanBeam.cs b/QSB/Tools/TranslatorTool/QSBTranslatorScanBeam.cs index ba9258c9..bfba9e69 100644 --- a/QSB/Tools/TranslatorTool/QSBTranslatorScanBeam.cs +++ b/QSB/Tools/TranslatorTool/QSBTranslatorScanBeam.cs @@ -15,8 +15,8 @@ namespace QSB.Tools.TranslatorTool const float _fadeLength = 0.66f; public float _scanSpeed = 1f; - public readonly Color _baseProjectorColor = new Color(0.3545942f, 2.206932f, 4.594794f, 1f); - public readonly Color _baseLightColor = new Color(0.1301365f, 0.2158605f, 0.6239606f, 1f); + public readonly Color _baseProjectorColor = new(0.3545942f, 2.206932f, 4.594794f, 1f); + public readonly Color _baseLightColor = new(0.1301365f, 0.2158605f, 0.6239606f, 1f); public Quaternion _baseRotation; private bool _tooCloseToTarget; @@ -92,7 +92,7 @@ namespace QSB.Tools.TranslatorTool _switchTime = Mathf.MoveTowards(_switchTime, 1f, Time.deltaTime / _switchLength); var smoothedSwitchTime = Mathf.SmoothStep(0f, 1f, _switchTime); _scanTime += Time.deltaTime * _scanSpeed; - var num = Mathf.Cos(_scanTime + _scanOffset) * 0.5f + 0.5f; + var num = (Mathf.Cos(_scanTime + _scanOffset) * 0.5f) + 0.5f; var pointAlongLine = _nomaiTextLine.GetPointAlongLine(num); var rhs = _nomaiTextLine.GetPointAlongLine(num + 0.1f) - _nomaiTextLine.GetPointAlongLine(num - 0.1f); var vector = pointAlongLine - transform.position; @@ -108,7 +108,7 @@ namespace QSB.Tools.TranslatorTool _switchTime = Mathf.MoveTowards(_switchTime, 1f, Time.deltaTime / _switchLength); var t2 = Mathf.SmoothStep(0f, 1f, _switchTime); _scanTime += Time.deltaTime * _scanSpeed; - var t3 = Mathf.Cos(_scanTime + _scanOffset) * 0.5f + 0.5f; + var t3 = (Mathf.Cos(_scanTime + _scanOffset) * 0.5f) + 0.5f; t3 = Mathf.Lerp(0.25f, 0.75f, t3); var pointOnRing = _nomaiComputerRing.GetPointOnRing(t3, transform.position); var forward = pointOnRing - transform.position; @@ -125,7 +125,7 @@ namespace QSB.Tools.TranslatorTool var smoothedSwitchTime = Mathf.SmoothStep(0f, 1f, _switchTime); _scanTime += Time.deltaTime * _scanSpeed; - var t5 = Mathf.Cos(_scanTime + _scanOffset) * 0.5f + 0.5f; + var t5 = (Mathf.Cos(_scanTime + _scanOffset) * 0.5f) + 0.5f; t5 = Mathf.Lerp(0.25f, 0.75f, t5); var pointOnRing2 = _nomaiVesselComputerRing.GetPointOnRing(t5, transform.position); var forward2 = pointOnRing2 - transform.position; diff --git a/QSB/Tools/TranslatorTool/TranslatorCreator.cs b/QSB/Tools/TranslatorTool/TranslatorCreator.cs index 582c17bb..8659914d 100644 --- a/QSB/Tools/TranslatorTool/TranslatorCreator.cs +++ b/QSB/Tools/TranslatorTool/TranslatorCreator.cs @@ -5,7 +5,7 @@ namespace QSB.Tools.TranslatorTool { internal static class TranslatorCreator { - private static readonly Vector3 TranslatorScale = new Vector3(0.75f, 0.75f, 0.75f); + private static readonly Vector3 TranslatorScale = new(0.75f, 0.75f, 0.75f); internal static void CreateTranslator(Transform cameraBody) { diff --git a/QSB/TranslationSync/Events/SetAsTranslatedEvent.cs b/QSB/TranslationSync/Events/SetAsTranslatedEvent.cs index ce613f3c..a414ea2e 100644 --- a/QSB/TranslationSync/Events/SetAsTranslatedEvent.cs +++ b/QSB/TranslationSync/Events/SetAsTranslatedEvent.cs @@ -13,7 +13,7 @@ namespace QSB.TranslationSync.Events private void Handler(NomaiTextType type, int objId, int textId) => SendEvent(CreateMessage(type, objId, textId)); - private SetAsTranslatedMessage CreateMessage(NomaiTextType type, int objId, int textId) => new SetAsTranslatedMessage + private SetAsTranslatedMessage CreateMessage(NomaiTextType type, int objId, int textId) => new() { AboutId = LocalPlayerId, ObjectId = objId, diff --git a/QSB/Utility/DebugGUI.cs b/QSB/Utility/DebugGUI.cs index e5d4e212..91262b5a 100644 --- a/QSB/Utility/DebugGUI.cs +++ b/QSB/Utility/DebugGUI.cs @@ -24,7 +24,7 @@ namespace QSB.Utility private const float Column4 = Column3 + FixedWidth; private float column4Offset = 10f; - private GUIStyle guiStyle = new GUIStyle() + private GUIStyle guiStyle = new() { fontSize = 9 }; diff --git a/QSB/Utility/Events/DebugEvent.cs b/QSB/Utility/Events/DebugEvent.cs index 03669c86..5900fc7c 100644 --- a/QSB/Utility/Events/DebugEvent.cs +++ b/QSB/Utility/Events/DebugEvent.cs @@ -12,7 +12,7 @@ namespace QSB.Utility.Events private void Handler(DebugEventEnum type) => SendEvent(CreateMessage(type)); - private EnumMessage CreateMessage(DebugEventEnum type) => new EnumMessage + private EnumMessage CreateMessage(DebugEventEnum type) => new() { AboutId = LocalPlayerId, EnumValue = type diff --git a/QSB/Utility/Extensions.cs b/QSB/Utility/Extensions.cs index 5f5433d4..aa0adb50 100644 --- a/QSB/Utility/Extensions.cs +++ b/QSB/Utility/Extensions.cs @@ -118,9 +118,9 @@ namespace QSB.Utility public static void RaiseEvent(this T instance, string eventName, params object[] args) { - if (!(typeof(T) + if (typeof(T) .GetField(eventName, Flags)? - .GetValue(instance) is MulticastDelegate multiDelegate)) + .GetValue(instance) is not MulticastDelegate multiDelegate) { return; } diff --git a/QSB/Utility/GlobalMessenger4Args.cs b/QSB/Utility/GlobalMessenger4Args.cs index 0f71dd7c..ffa849ac 100644 --- a/QSB/Utility/GlobalMessenger4Args.cs +++ b/QSB/Utility/GlobalMessenger4Args.cs @@ -74,8 +74,8 @@ namespace QSB.Utility private class EventData { - public List> Callbacks = new List>(); - public List> Temp = new List>(); + public List> Callbacks = new(); + public List> Temp = new(); public bool IsInvoking; } } diff --git a/QSB/Utility/GlobalMessenger5Args.cs b/QSB/Utility/GlobalMessenger5Args.cs index 31a7e6f1..00752f13 100644 --- a/QSB/Utility/GlobalMessenger5Args.cs +++ b/QSB/Utility/GlobalMessenger5Args.cs @@ -74,8 +74,8 @@ namespace QSB.Utility private class EventData { - public List> Callbacks = new List>(); - public List> Temp = new List>(); + public List> Callbacks = new(); + public List> Temp = new(); public bool IsInvoking; } } diff --git a/QSB/Utility/GlobalMessenger6Args.cs b/QSB/Utility/GlobalMessenger6Args.cs index 3caebcaa..e7448e27 100644 --- a/QSB/Utility/GlobalMessenger6Args.cs +++ b/QSB/Utility/GlobalMessenger6Args.cs @@ -74,8 +74,8 @@ namespace QSB.Utility private class EventData { - public List> Callbacks = new List>(); - public List> Temp = new List>(); + public List> Callbacks = new(); + public List> Temp = new(); public bool IsInvoking; } } diff --git a/QSB/Utility/Popcron.Gizmos/Drawer.cs b/QSB/Utility/Popcron.Gizmos/Drawer.cs index 0c9e5419..baa16119 100644 --- a/QSB/Utility/Popcron.Gizmos/Drawer.cs +++ b/QSB/Utility/Popcron.Gizmos/Drawer.cs @@ -32,14 +32,9 @@ namespace Popcron }; } - if (typeToDrawer.TryGetValue(typeof(T), out var drawer)) - { - return drawer; - } - else - { - return null; - } + return typeToDrawer.TryGetValue(typeof(T), out var drawer) + ? drawer + : null; } } } diff --git a/QSB/Utility/Popcron.Gizmos/Drawers/PolygonDrawer.cs b/QSB/Utility/Popcron.Gizmos/Drawers/PolygonDrawer.cs index 2238221b..7a29425b 100644 --- a/QSB/Utility/Popcron.Gizmos/Drawers/PolygonDrawer.cs +++ b/QSB/Utility/Popcron.Gizmos/Drawers/PolygonDrawer.cs @@ -22,12 +22,12 @@ namespace Popcron for (var i = 0; i < points; i++) { - var cx = Mathf.Cos(Mathf.Deg2Rad * step * i + offset) * radius; - var cy = Mathf.Sin(Mathf.Deg2Rad * step * i + offset) * radius; + var cx = Mathf.Cos((Mathf.Deg2Rad * step * i) + offset) * radius; + var cy = Mathf.Sin((Mathf.Deg2Rad * step * i) + offset) * radius; var current = new Vector3(cx, cy); - var nx = Mathf.Cos(Mathf.Deg2Rad * step * (i + 1) + offset) * radius; - var ny = Mathf.Sin(Mathf.Deg2Rad * step * (i + 1) + offset) * radius; + var nx = Mathf.Cos((Mathf.Deg2Rad * step * (i + 1)) + offset) * radius; + var ny = Mathf.Sin((Mathf.Deg2Rad * step * (i + 1)) + offset) * radius; var next = new Vector3(nx, ny); buffer[i * 2] = position + (rotation * current); diff --git a/QSB/Utility/RepeatingManager.cs b/QSB/Utility/RepeatingManager.cs index b79e21cf..54703c8e 100644 --- a/QSB/Utility/RepeatingManager.cs +++ b/QSB/Utility/RepeatingManager.cs @@ -5,7 +5,7 @@ namespace QSB.Utility { internal class RepeatingManager : MonoBehaviour { - public static List Repeatings = new List(); + public static List Repeatings = new(); private const float TimeInterval = 0.4f; private float _checkTimer = TimeInterval; diff --git a/QSB/Utility/ZOverride.cs b/QSB/Utility/ZOverride.cs index 7109dbc4..19c93bb0 100644 --- a/QSB/Utility/ZOverride.cs +++ b/QSB/Utility/ZOverride.cs @@ -9,7 +9,7 @@ namespace QSB.Utility private const string shaderTestMode = "unity_GUIZTestMode"; private readonly UnityEngine.Rendering.CompareFunction desiredUIComparison = UnityEngine.Rendering.CompareFunction.Always; private Graphic[] uiElementsToApplyTo; - private readonly Dictionary materialMappings = new Dictionary(); + private readonly Dictionary materialMappings = new(); protected virtual void Start() { diff --git a/QSB/WorldSync/QSBWorldSync.cs b/QSB/WorldSync/QSBWorldSync.cs index fc4ffbbf..7f28ddb5 100644 --- a/QSB/WorldSync/QSBWorldSync.cs +++ b/QSB/WorldSync/QSBWorldSync.cs @@ -16,8 +16,8 @@ namespace QSB.WorldSync public static Dictionary DialogueConditions { get; } = new Dictionary(); public static List ShipLogFacts { get; } = new List(); - private static readonly List WorldObjects = new List(); - private static readonly Dictionary WorldObjectsToUnityObjects = new Dictionary(); + private static readonly List WorldObjects = new(); + private static readonly Dictionary WorldObjectsToUnityObjects = new(); public static IEnumerable GetWorldObjects() => WorldObjects.OfType(); diff --git a/QSB/WorldSync/WorldObjectManager.cs b/QSB/WorldSync/WorldObjectManager.cs index 8bb38da7..66614e8c 100644 --- a/QSB/WorldSync/WorldObjectManager.cs +++ b/QSB/WorldSync/WorldObjectManager.cs @@ -8,7 +8,7 @@ namespace QSB.WorldSync { public abstract class WorldObjectManager : MonoBehaviour { - private static readonly List _managers = new List(); + private static readonly List _managers = new(); public static bool AllReady { get; private set; }