This commit is contained in:
Mister_Nebula 2021-10-29 23:00:13 +01:00
parent 34601740ed
commit 256830e557
20 changed files with 32 additions and 61 deletions

View File

@ -8,7 +8,6 @@ using QSB.Player;
using QSB.Utility;
using QSB.WorldSync;
using System.Linq;
using System.Reflection;
using UnityEngine;
namespace QSB.Animation.NPC.Patches
@ -108,7 +107,7 @@ namespace QSB.Animation.NPC.Patches
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBSolanumAnimController, SolanumAnimController>(__instance);
var playersInHeadZone = qsbObj.GetPlayersInHeadZone();
Transform targetCamera = playersInHeadZone == null || playersInHeadZone.Count == 0
var targetCamera = playersInHeadZone == null || playersInHeadZone.Count == 0
? __instance._playerCameraTransform
: QSBPlayerManager.GetClosestPlayerToWorldPoint(playersInHeadZone, __instance.transform.position).CameraBody.transform;

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
namespace QSB.Animation.NPC.WorldObjects
{
class QSBSolanumAnimController : WorldObject<SolanumAnimController>
internal class QSBSolanumAnimController : WorldObject<SolanumAnimController>
{
private readonly List<PlayerInfo> _playersInHeadZone = new List<PlayerInfo>();

View File

@ -1,6 +1,4 @@
using OWML.Utils;
namespace QSB.Animation.NPC.WorldObjects
namespace QSB.Animation.NPC.WorldObjects
{
internal class QSBTravelerController : NpcAnimController<TravelerController>
{

View File

@ -22,7 +22,7 @@ public class CameraFacingBillboard : MonoBehaviour
UpdateRotation();
}
void LateUpdate()
private void LateUpdate()
=> UpdateRotation();
private void UpdateRotation()

View File

@ -209,10 +209,7 @@ namespace QSB.DeathSync.Patches
[HarmonyPostfix]
[HarmonyPatch(typeof(DeathManager), nameof(DeathManager.KillPlayer))]
public static void DeathManager_KillPlayer_Postfix(DeathType deathType)
{
QSBEventManager.FireEvent(EventNames.QSBPlayerDeath, deathType);
}
public static void DeathManager_KillPlayer_Postfix(DeathType deathType) => QSBEventManager.FireEvent(EventNames.QSBPlayerDeath, deathType);
[HarmonyPostfix]
[HarmonyPatch(typeof(ShipDamageController), nameof(ShipDamageController.Awake))]

View File

@ -11,12 +11,12 @@ namespace QSB.FrequencySync.Patches
[HarmonyPostfix]
[HarmonyPatch(typeof(AudioSignal), nameof(AudioSignal.IdentifyFrequency))]
static void IdentifyFrequencyEvent(SignalFrequency ____frequency)
public static void IdentifyFrequencyEvent(SignalFrequency ____frequency)
=> QSBEventManager.FireEvent(EventNames.QSBIdentifyFrequency, ____frequency);
[HarmonyPostfix]
[HarmonyPatch(typeof(AudioSignal), nameof(AudioSignal.IdentifySignal))]
static void IdentifySignalEvent(SignalName ____name)
public static void IdentifySignalEvent(SignalName ____name)
=> QSBEventManager.FireEvent(EventNames.QSBIdentifySignal, ____name);
}
}

View File

@ -70,7 +70,7 @@ namespace QSB.ItemSync.Patches
sector = sectorGroup.GetSector();
if (sector == null && sectorGroup is SectorCullGroup)
{
SectorProxy controllingProxy = (sectorGroup as SectorCullGroup).GetControllingProxy();
var controllingProxy = (sectorGroup as SectorCullGroup).GetControllingProxy();
if (controllingProxy != null)
{
sector = controllingProxy.GetSector();

View File

@ -5,7 +5,7 @@ using UnityEngine.UI;
namespace QSB.Menus
{
class MenuManager : MonoBehaviour
internal class MenuManager : MonoBehaviour
{
public static MenuManager Instance;
@ -27,7 +27,7 @@ namespace QSB.Menus
QSBNetworkManager.Instance.OnClientErrorThrown += OnClientError;
}
void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool isUniverse)
private void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool isUniverse)
{
if (isUniverse)
{

View File

@ -6,9 +6,6 @@ namespace QSB.Patches
{
public abstract QSBPatchTypes Type { get; }
public void DoPatches(Harmony instance)
{
instance.PatchAll(GetType());
}
public void DoPatches(Harmony instance) => instance.PatchAll(GetType());
}
}

View File

@ -1,6 +1,5 @@
using HarmonyLib;
using OWML.Common;
using OWML.Utils;
using QSB.Animation.NPC.Patches;
using QSB.Animation.Patches;
using QSB.CampfireSync.Patches;

View File

@ -73,12 +73,12 @@ namespace QSB.QuantumSync.Patches
return false;
}
for (int i = 0; i < 10; i++)
for (var i = 0; i < 10; i++)
{
FindStateAndOrbit(__instance, out int stateIndex, out int orbitIndex);
FindStateAndOrbit(__instance, out var stateIndex, out var orbitIndex);
GetTargetPosition(__instance, stateIndex, orbitIndex, out var orbitRadius, out var bodyToOrbit, out var targetPosition, out var onUnitSphere);
GetTargetPosition(__instance, stateIndex, orbitIndex, out float orbitRadius, out OWRigidbody bodyToOrbit, out Vector3 targetPosition, out Vector3 onUnitSphere);
if (!Physics.CheckSphere(targetPosition, __instance._sphereCheckRadius, OWLayerMask.physicalMask) || __instance._collapseToIndex != -1)
{
__instance._visibilityTracker.transform.position = targetPosition;
@ -139,7 +139,7 @@ namespace QSB.QuantumSync.Patches
: __instance.GetRandomStateIndex();
orbitIndex = -1;
for (int j = 0; j < __instance._orbits.Length; j++)
for (var j = 0; j < __instance._orbits.Length; j++)
{
if (__instance._orbits[j].GetStateIndex() == stateIndex)
{
@ -163,11 +163,11 @@ namespace QSB.QuantumSync.Patches
}
__instance._visibilityTracker.transform.localPosition = Vector3.zero;
__instance._constantForceDetector.AddConstantVolume(bodyToOrbit.GetAttachedGravityVolume(), true, true);
Vector3 bodyVelocity = bodyToOrbit.GetVelocity();
var bodyVelocity = bodyToOrbit.GetVelocity();
if (__instance._useInitialMotion)
{
InitialMotion component = bodyToOrbit.GetComponent<InitialMotion>();
var component = bodyToOrbit.GetComponent<InitialMotion>();
bodyVelocity = (component != null)
? component.GetInitVelocity()
: Vector3.zero;
@ -182,7 +182,7 @@ namespace QSB.QuantumSync.Patches
__instance._collapseToIndex = -1;
foundNewPosition = true;
for (int k = 0; k < __instance._stateSkipCounts.Length; k++)
for (var k = 0; k < __instance._stateSkipCounts.Length; k++)
{
__instance._stateSkipCounts[k] = (k == __instance._stateIndex)
? 0
@ -207,7 +207,7 @@ namespace QSB.QuantumSync.Patches
__instance._referenceFrameVolume.gameObject.SetActive(__instance._stateIndex != 5);
__instance._moonBody.SetIsTargetable(__instance._stateIndex != 5);
for (int l = 0; l < __instance._deactivateAtEye.Length; l++)
for (var l = 0; l < __instance._deactivateAtEye.Length; l++)
{
__instance._deactivateAtEye[l].SetActive(__instance._stateIndex != 5);
}

View File

@ -1,5 +1,4 @@
using OWML.Utils;
using QSB.Utility;
using QSB.Utility;
using QSB.WorldSync;
using System.Collections.Generic;
using System.Linq;

View File

@ -55,10 +55,7 @@ namespace QSB.ShipSync.Patches
[HarmonyReversePatch]
[HarmonyPatch(typeof(SingleInteractionVolume), nameof(SingleInteractionVolume.UpdateInteractVolume))]
public static void SingleInteractionVolume_UpdateInteractVolume_Stub(object instance)
{
throw new NotImplementedException();
}
public static void SingleInteractionVolume_UpdateInteractVolume_Stub(object instance) => throw new NotImplementedException();
[HarmonyPrefix]
[HarmonyPatch(typeof(InteractZone), nameof(InteractZone.UpdateInteractVolume))]
@ -87,39 +84,33 @@ namespace QSB.ShipSync.Patches
? angle <= 80
: angle >= 280;
SingleInteractionVolume_UpdateInteractVolume_Stub(__instance as SingleInteractionVolume);
SingleInteractionVolume_UpdateInteractVolume_Stub(__instance);
return false;
}
[HarmonyReversePatch]
[HarmonyPatch(typeof(ShipComponent), nameof(ShipComponent.OnEnterShip))]
public static void ShipComponent_OnEnterShip_Stub(object instance)
{
throw new NotImplementedException();
}
public static void ShipComponent_OnEnterShip_Stub(object instance) => throw new NotImplementedException();
[HarmonyPrefix]
[HarmonyPatch(typeof(ShipElectricalComponent), nameof(ShipElectricalComponent.OnEnterShip))]
public static bool ShipElectricalComponent_OnEnterShip(ShipElectricalComponent __instance)
{
ShipComponent_OnEnterShip_Stub(__instance as ShipComponent);
ShipComponent_OnEnterShip_Stub(__instance);
return false;
}
[HarmonyReversePatch]
[HarmonyPatch(typeof(ShipComponent), nameof(ShipComponent.OnExitShip))]
public static void ShipComponent_OnExitShip_Stub(object instance)
{
throw new NotImplementedException();
}
public static void ShipComponent_OnExitShip_Stub(object instance) => throw new NotImplementedException();
[HarmonyPrefix]
[HarmonyPatch(typeof(ShipElectricalComponent), nameof(ShipElectricalComponent.OnExitShip))]
public static bool ShipElectricalComponent_OnExitShip(ShipElectricalComponent __instance)
{
ShipComponent_OnExitShip_Stub(__instance as ShipComponent);
ShipComponent_OnExitShip_Stub(__instance);
return false;
}

View File

@ -1,6 +1,5 @@
using OWML.Common;
using QSB.Utility;
using System;
using UnityEngine;
namespace QSB.Syncs

View File

@ -126,8 +126,8 @@ namespace QSB.Syncs.Sectored.Rigidbodies
return false;
}
Vector3 positionToSet = targetPos;
Quaternion rotationToSet = targetRot;
var positionToSet = targetPos;
var rotationToSet = targetRot;
if (UseInterpolation)
{

View File

@ -164,10 +164,7 @@ namespace QSB.Syncs
_isInitialized = true;
}
protected virtual void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool isInUniverse)
{
_isInitialized = false;
}
protected virtual void OnSceneLoaded(OWScene oldScene, OWScene newScene, bool isInUniverse) => _isInitialized = false;
public override void Update()
{

View File

@ -2,7 +2,6 @@
using QSB.ClientServerStateSync;
using QSB.OrbSync.TransformSync;
using QSB.Player;
using QSB.ProbeSync.TransformSync;
using QSB.Syncs;
using QSB.TimeSync;
using UnityEngine;

View File

@ -18,10 +18,7 @@ namespace QSB.Utility.Events
EnumValue = type
};
public override void OnReceiveLocal(bool isHost, EnumMessage<DebugEventEnum> message)
{
OnReceiveRemote(isHost, message);
}
public override void OnReceiveLocal(bool isHost, EnumMessage<DebugEventEnum> message) => OnReceiveRemote(isHost, message);
public override void OnReceiveRemote(bool isHost, EnumMessage<DebugEventEnum> message)
{

View File

@ -4,7 +4,6 @@ using QSB.OrbSync.WorldObjects;
using QSB.Utility;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using UnityEngine;

View File

@ -79,7 +79,7 @@ namespace QSB.WorldSync
worldObject.PostInit();
}
}
protected abstract void RebuildWorldObjects(OWScene scene);
}
}