mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2024-12-29 03:28:26 +00:00
Code Cleanup
This commit is contained in:
parent
038c6b20c1
commit
cd3a029c5c
@ -1898,7 +1898,7 @@ namespace QNetWeaver
|
||||
CheckForHookFunction(fd, out var methodDefinition2);
|
||||
if (methodDefinition2 != null)
|
||||
{
|
||||
|
||||
|
||||
ilprocessor.Append(ilprocessor.Create(OpCodes.Call, Weaver.NetworkServerGetLocalClientActive));
|
||||
ilprocessor.Append(ilprocessor.Create(OpCodes.Brfalse, noOperatorInstruction));
|
||||
ilprocessor.Append(ilprocessor.Create(OpCodes.Ldarg_0));
|
||||
|
@ -72,15 +72,15 @@ namespace QSB.Animation.NPC.Patches
|
||||
playerToUse = QSBPlayerManager.GetClosestPlayerToWorldPoint(__instance.transform.position, true);
|
||||
}
|
||||
|
||||
var localPosition = playerToUse != null
|
||||
? ____animator.transform.InverseTransformPoint(playerToUse.CameraBody.transform.position)
|
||||
var localPosition = playerToUse != null
|
||||
? ____animator.transform.InverseTransformPoint(playerToUse.CameraBody.transform.position)
|
||||
: Vector3.zero;
|
||||
|
||||
var targetWeight = ___headTrackingWeight;
|
||||
if (___lookOnlyWhenTalking)
|
||||
{
|
||||
if (!____inConversation
|
||||
|| qsbObj.GetPlayersInHeadZone().Count == 0
|
||||
if (!____inConversation
|
||||
|| qsbObj.GetPlayersInHeadZone().Count == 0
|
||||
|| !qsbObj.GetPlayersInHeadZone().Contains(playerToUse))
|
||||
{
|
||||
targetWeight *= 0;
|
||||
@ -88,7 +88,7 @@ namespace QSB.Animation.NPC.Patches
|
||||
}
|
||||
else
|
||||
{
|
||||
if (qsbObj.GetPlayersInHeadZone().Count == 0
|
||||
if (qsbObj.GetPlayersInHeadZone().Count == 0
|
||||
|| !qsbObj.GetPlayersInHeadZone().Contains(playerToUse))
|
||||
{
|
||||
targetWeight *= 0;
|
||||
|
@ -14,10 +14,10 @@ namespace QSB.Animation.NPC.WorldObjects
|
||||
|
||||
public abstract CharacterDialogueTree GetDialogueTree();
|
||||
|
||||
public virtual void StartConversation()
|
||||
public virtual void StartConversation()
|
||||
=> QSBWorldSync.RaiseEvent(GetDialogueTree(), "OnStartConversation");
|
||||
|
||||
public virtual void EndConversation()
|
||||
public virtual void EndConversation()
|
||||
=> QSBWorldSync.RaiseEvent(GetDialogueTree(), "OnEndConversation");
|
||||
|
||||
public abstract bool InConversation();
|
||||
|
@ -8,7 +8,7 @@ namespace QSB.Animation.NPC.WorldObjects
|
||||
{
|
||||
private readonly List<PlayerInfo> _playersInHeadZone = new List<PlayerInfo>();
|
||||
|
||||
public List<PlayerInfo> GetPlayersInHeadZone()
|
||||
public List<PlayerInfo> GetPlayersInHeadZone()
|
||||
=> _playersInHeadZone;
|
||||
|
||||
public void AddPlayerToHeadZone(PlayerInfo player)
|
||||
@ -18,7 +18,7 @@ namespace QSB.Animation.NPC.WorldObjects
|
||||
return;
|
||||
}
|
||||
|
||||
_playersInHeadZone.Add(player);
|
||||
_playersInHeadZone.Add(player);
|
||||
}
|
||||
|
||||
public void RemovePlayerFromHeadZone(PlayerInfo player)
|
||||
@ -31,10 +31,10 @@ namespace QSB.Animation.NPC.WorldObjects
|
||||
_playersInHeadZone.Remove(player);
|
||||
}
|
||||
|
||||
public override CharacterDialogueTree GetDialogueTree()
|
||||
public override CharacterDialogueTree GetDialogueTree()
|
||||
=> AttachedObject.GetValue<CharacterDialogueTree>("_dialogueTree");
|
||||
|
||||
public override bool InConversation()
|
||||
public override bool InConversation()
|
||||
=> AttachedObject.GetValue<bool>("_inConversation");
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ namespace QSB.Animation.Player.Thrusters
|
||||
public Vector3 LocalAcceleration => _localAcceleration;
|
||||
public bool IsThrusting => _isThrusting;
|
||||
|
||||
public void Init(ThrusterModel model)
|
||||
public void Init(ThrusterModel model)
|
||||
=> _thrusterModel = model;
|
||||
|
||||
public void Update()
|
||||
|
@ -17,7 +17,7 @@ namespace QSB.ElevatorSync.Patches
|
||||
QSBEventManager.FireEvent(EventNames.QSBStartLift, id, isGoingUp);
|
||||
}
|
||||
|
||||
public override void DoPatches()
|
||||
public override void DoPatches()
|
||||
=> Postfix(nameof(Elevator_StartLift));
|
||||
}
|
||||
}
|
@ -51,7 +51,7 @@ namespace QSB.Inputs
|
||||
|
||||
public static QSBInputManager Instance { get; private set; }
|
||||
|
||||
public void Start()
|
||||
public void Start()
|
||||
=> Instance = this;
|
||||
|
||||
public bool InputsEnabled { get; private set; } = true;
|
||||
|
@ -4,7 +4,6 @@ using OWML.Utils;
|
||||
using QSB.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace QSB.Patches
|
||||
@ -35,10 +34,10 @@ namespace QSB.Patches
|
||||
QSBCore.Helper.HarmonyHelper.EmptyMethod(method);
|
||||
}
|
||||
|
||||
public void Prefix(string patchName)
|
||||
public void Prefix(string patchName)
|
||||
=> DoPrefixPostfix(true, patchName);
|
||||
|
||||
public void Postfix(string patchName)
|
||||
public void Postfix(string patchName)
|
||||
=> DoPrefixPostfix(false, patchName);
|
||||
|
||||
private void DoPrefixPostfix(bool isPrefix, string patchName)
|
||||
|
@ -14,12 +14,9 @@ using QSB.Patches;
|
||||
using QSB.Player;
|
||||
using QSB.Player.TransformSync;
|
||||
using QSB.PoolSync;
|
||||
using QSB.ProbeSync.TransformSync;
|
||||
using QSB.QuantumSync;
|
||||
using QSB.QuantumSync.WorldObjects;
|
||||
using QSB.SectorSync;
|
||||
using QSB.ShipSync;
|
||||
using QSB.ShipSync.TransformSync;
|
||||
using QSB.StatueSync;
|
||||
using QSB.TimeSync;
|
||||
using QSB.TranslationSync;
|
||||
@ -27,9 +24,6 @@ using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
using QuantumUNET;
|
||||
using QuantumUNET.Components;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
|
||||
/*
|
||||
|
@ -16,7 +16,7 @@ namespace QSB.QuantumSync.Patches
|
||||
public static void QuantumMoon_Start(QuantumMoon __instance)
|
||||
=> __instance.GetType().GetMethod("SetSurfaceState", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { -1 });
|
||||
|
||||
public static bool QuantumMoon_ChangeQuantumState()
|
||||
public static bool QuantumMoon_ChangeQuantumState()
|
||||
=> false;
|
||||
}
|
||||
}
|
@ -87,7 +87,7 @@ namespace QSB.QuantumSync.Patches
|
||||
}
|
||||
|
||||
// If there are players in the shrine and the shrine is not lit
|
||||
if(inShrinePlayers.Count() != 0 && !shrineLit)
|
||||
if (inShrinePlayers.Count() != 0 && !shrineLit)
|
||||
{
|
||||
__result = false;
|
||||
return false;
|
||||
|
@ -31,8 +31,8 @@ namespace QSB.SectorSync
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((sync as QNetworkBehaviour).HasAuthority
|
||||
&& sync.AttachedObject.gameObject.activeInHierarchy
|
||||
if ((sync as QNetworkBehaviour).HasAuthority
|
||||
&& sync.AttachedObject.gameObject.activeInHierarchy
|
||||
&& sync.IsReady)
|
||||
{
|
||||
CheckTransformSyncSector(sync);
|
||||
|
@ -92,7 +92,7 @@ namespace QSB.SectorSync
|
||||
}
|
||||
|
||||
var numSectorsCurrentlyIn = SectorList.Count(x => x.ShouldSyncTo(_targetType));
|
||||
|
||||
|
||||
var listToCheck = numSectorsCurrentlyIn == 0
|
||||
? QSBWorldSync.GetWorldObjects<QSBSector>().Where(x => !x.IsFakeSector && x.Type != Sector.Name.Unnamed)
|
||||
: SectorList;
|
||||
@ -149,7 +149,7 @@ namespace QSB.SectorSync
|
||||
|
||||
return 0f;
|
||||
}
|
||||
|
||||
|
||||
public static float GetRelativeVelocity(QSBSector sector, OWRigidbody rigidbody)
|
||||
{
|
||||
var sectorRigidBody = sector.AttachedObject.GetOWRigidbody();
|
||||
|
@ -53,8 +53,8 @@ namespace QSB.ShipSync.Events
|
||||
|
||||
private void SetCurrentFlyer(bool isFlying, uint id)
|
||||
{
|
||||
ShipManager.Instance.CurrentFlyer = isFlying
|
||||
? id
|
||||
ShipManager.Instance.CurrentFlyer = isFlying
|
||||
? id
|
||||
: uint.MaxValue;
|
||||
|
||||
if (QSBCore.IsServer)
|
||||
|
@ -20,7 +20,7 @@ namespace QSB.ShipSync.Events
|
||||
AboutId = LocalPlayerId
|
||||
};
|
||||
|
||||
public override void OnReceiveRemote(bool server, PlayerMessage message)
|
||||
public override void OnReceiveRemote(bool server, PlayerMessage message)
|
||||
=> ShipManager.Instance.ShipTractorBeam.ActivateTractorBeam();
|
||||
}
|
||||
}
|
||||
|
@ -8,10 +8,10 @@ namespace QSB.ShipSync.Events
|
||||
{
|
||||
public override QSB.Events.EventType Type => QSB.Events.EventType.OpenHatch;
|
||||
|
||||
public override void SetupListener()
|
||||
public override void SetupListener()
|
||||
=> GlobalMessenger<bool>.AddListener(EventNames.QSBHatchState, Handler);
|
||||
|
||||
public override void CloseListener()
|
||||
public override void CloseListener()
|
||||
=> GlobalMessenger<bool>.RemoveListener(EventNames.QSBHatchState, Handler);
|
||||
|
||||
private void Handler(bool open) => SendEvent(CreateMessage(open));
|
||||
|
@ -73,8 +73,8 @@ namespace QSB.ShipSync.Patches
|
||||
|
||||
var angle = 2f * Vector3.Angle(____playerCam.transform.forward, __instance.transform.forward);
|
||||
|
||||
____focused = PlayerState.IsInsideShip()
|
||||
? angle <= 80
|
||||
____focused = PlayerState.IsInsideShip()
|
||||
? angle <= 80
|
||||
: angle >= 280;
|
||||
|
||||
__instance.CallBase<InteractZone, SingleInteractionVolume>("UpdateInteractVolume");
|
||||
|
@ -84,7 +84,7 @@ namespace QSB.ShipSync
|
||||
|
||||
private void PrintAll(Array array)
|
||||
{
|
||||
foreach(var item in array)
|
||||
foreach (var item in array)
|
||||
{
|
||||
DebugLog.DebugWrite($" - {(item as MonoBehaviour).name}");
|
||||
}
|
||||
|
@ -9,38 +9,38 @@ namespace QSB.Syncs
|
||||
private Transform _attachedTransform;
|
||||
private Transform _referenceTransform;
|
||||
|
||||
public IntermediaryTransform(Transform transform)
|
||||
public IntermediaryTransform(Transform transform)
|
||||
=> _attachedTransform = transform;
|
||||
|
||||
/// <summary>
|
||||
/// Get the world position of this INVISIBLE transform.
|
||||
/// </summary>
|
||||
public Vector3 GetPosition()
|
||||
public Vector3 GetPosition()
|
||||
=> _attachedTransform.position;
|
||||
|
||||
/// <summary>
|
||||
/// Set the world position of this INVISIBLE transform.
|
||||
/// </summary>
|
||||
public void SetPosition(Vector3 worldPos)
|
||||
public void SetPosition(Vector3 worldPos)
|
||||
=> _attachedTransform.position = worldPos;
|
||||
|
||||
/// <summary>
|
||||
/// Get the world rotation of this INVISIBLE transform.
|
||||
/// </summary>
|
||||
public Quaternion GetRotation()
|
||||
public Quaternion GetRotation()
|
||||
=> _attachedTransform.rotation;
|
||||
|
||||
/// <summary>
|
||||
/// Set the world rotation of this INVISIBLE transform.
|
||||
/// </summary>
|
||||
public void SetRotation(Quaternion worldRot)
|
||||
public void SetRotation(Quaternion worldRot)
|
||||
=> _attachedTransform.rotation = worldRot;
|
||||
|
||||
/// <summary>
|
||||
/// Sets the reference transform - what transform this transform is syncing to.
|
||||
/// </summary>
|
||||
/// <param name="sector">The new reference sector.</param>
|
||||
public void SetReferenceTransform(Transform transform)
|
||||
public void SetReferenceTransform(Transform transform)
|
||||
=> _referenceTransform = transform;
|
||||
|
||||
/// <summary>
|
||||
@ -54,7 +54,7 @@ namespace QSB.Syncs
|
||||
DebugLog.DebugWrite($"Error - _referenceTransform has not been set for {_attachedTransform.name}", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
SetPosition(_referenceTransform.InverseTransformPoint(worldPosition));
|
||||
}
|
||||
|
||||
|
@ -274,7 +274,7 @@ namespace QSB.Syncs.RigidbodySync
|
||||
return false;
|
||||
}
|
||||
|
||||
public float GetVelocityChangeMagnitude()
|
||||
public float GetVelocityChangeMagnitude()
|
||||
=> (_relativeVelocity - _prevVelocity).magnitude;
|
||||
|
||||
public Vector3 GetRelativeVelocity()
|
||||
@ -307,7 +307,7 @@ namespace QSB.Syncs.RigidbodySync
|
||||
if (!QSBCore.WorldObjectsReady
|
||||
|| !QSBCore.DebugMode
|
||||
|| !QSBCore.ShowLinesInDebug
|
||||
|| !IsReady
|
||||
|| !IsReady
|
||||
|| ReferenceTransform == null)
|
||||
{
|
||||
return;
|
||||
|
@ -40,8 +40,8 @@ namespace QSB.Syncs.TransformSync
|
||||
return uint.MaxValue;
|
||||
}
|
||||
|
||||
return NetIdentity.RootIdentity != null
|
||||
? NetIdentity.RootIdentity.NetId.Value
|
||||
return NetIdentity.RootIdentity != null
|
||||
? NetIdentity.RootIdentity.NetId.Value
|
||||
: AttachedNetId;
|
||||
}
|
||||
}
|
||||
@ -87,7 +87,7 @@ namespace QSB.Syncs.TransformSync
|
||||
QSBSceneManager.OnSceneLoaded -= OnSceneLoaded;
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(OWScene scene, bool isInUniverse)
|
||||
private void OnSceneLoaded(OWScene scene, bool isInUniverse)
|
||||
=> _isInitialized = false;
|
||||
|
||||
protected virtual void Init()
|
||||
@ -275,9 +275,9 @@ namespace QSB.Syncs.TransformSync
|
||||
|
||||
private void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.WorldObjectsReady
|
||||
if (!QSBCore.WorldObjectsReady
|
||||
|| !QSBCore.DebugMode
|
||||
|| !QSBCore.ShowLinesInDebug
|
||||
|| !QSBCore.ShowLinesInDebug
|
||||
|| !IsReady
|
||||
|| ReferenceTransform == null)
|
||||
{
|
||||
|
@ -230,10 +230,10 @@ namespace QSB.Syncs.TransformSync
|
||||
|
||||
private void OnRenderObject()
|
||||
{
|
||||
if (!QSBCore.WorldObjectsReady
|
||||
|| !QSBCore.DebugMode
|
||||
|| !QSBCore.ShowLinesInDebug
|
||||
|| !IsReady
|
||||
if (!QSBCore.WorldObjectsReady
|
||||
|| !QSBCore.DebugMode
|
||||
|| !QSBCore.ShowLinesInDebug
|
||||
|| !IsReady
|
||||
|| ReferenceTransform == null)
|
||||
{
|
||||
return;
|
||||
|
@ -6,10 +6,10 @@ namespace QSB.TimeSync.Patches
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
public override void DoPatches()
|
||||
=> Prefix(nameof(PlayerCameraEffectController_OnStartOfTimeLoop));
|
||||
|
||||
public static bool PlayerCameraEffectController_OnStartOfTimeLoop()
|
||||
public static bool PlayerCameraEffectController_OnStartOfTimeLoop()
|
||||
=> false;
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +107,7 @@ namespace QSB.TimeSync
|
||||
}
|
||||
}
|
||||
|
||||
private void SendServerTime()
|
||||
private void SendServerTime()
|
||||
=> QSBEventManager.FireEvent(EventNames.QSBServerTime, _serverTime, PlayerData.LoadLoopCount());
|
||||
|
||||
public void OnClientReceiveMessage(ServerTimeMessage message)
|
||||
@ -225,7 +225,7 @@ namespace QSB.TimeSync
|
||||
}
|
||||
}
|
||||
|
||||
private void WakeUp()
|
||||
private void WakeUp()
|
||||
=> Locator.GetPlayerCamera().GetComponent<PlayerCameraEffectController>().Invoke("WakeUp");
|
||||
|
||||
public void Update()
|
||||
|
@ -1,9 +1,9 @@
|
||||
using QSB.Player.TransformSync;
|
||||
using QSB.Player;
|
||||
using QSB.Player;
|
||||
using QSB.Player.TransformSync;
|
||||
using QSB.ProbeSync.TransformSync;
|
||||
using QSB.QuantumSync;
|
||||
using QSB.ShipSync.TransformSync;
|
||||
using QSB.ShipSync;
|
||||
using QSB.ShipSync.TransformSync;
|
||||
using QSB.TimeSync;
|
||||
using QSB.WorldSync;
|
||||
using System.Linq;
|
||||
|
@ -100,7 +100,7 @@ namespace QSB.Utility
|
||||
|
||||
// OW
|
||||
|
||||
public static Vector3 GetRelativeAngularVelocity(this OWRigidbody baseBody, OWRigidbody relativeBody)
|
||||
public static Vector3 GetRelativeAngularVelocity(this OWRigidbody baseBody, OWRigidbody relativeBody)
|
||||
=> baseBody.GetAngularVelocity() - relativeBody.GetAngularVelocity();
|
||||
}
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ namespace QSB.WorldSync
|
||||
_managers.Remove(this);
|
||||
}
|
||||
|
||||
private void OnSceneLoaded(OWScene scene, bool inUniverse)
|
||||
private void OnSceneLoaded(OWScene scene, bool inUniverse)
|
||||
=> AllReady = false;
|
||||
|
||||
public static void Rebuild(OWScene scene)
|
||||
|
@ -37,7 +37,7 @@ namespace QuantumUNET.Components
|
||||
set => m_LocalPlayerAuthority = value;
|
||||
}
|
||||
|
||||
public QNetworkBehaviour[] GetNetworkBehaviours()
|
||||
public QNetworkBehaviour[] GetNetworkBehaviours()
|
||||
=> m_NetworkBehaviours;
|
||||
|
||||
public void SetRootIdentity(QNetworkIdentity newRoot)
|
||||
|
@ -200,10 +200,10 @@ namespace QuantumUNET.Components
|
||||
return rotation;
|
||||
}
|
||||
|
||||
public override int GetNetworkChannel()
|
||||
public override int GetNetworkChannel()
|
||||
=> 1;
|
||||
|
||||
public override float GetNetworkSendInterval()
|
||||
public override float GetNetworkSendInterval()
|
||||
=> SendInterval;
|
||||
}
|
||||
}
|
@ -450,16 +450,16 @@ namespace QuantumUNET
|
||||
}
|
||||
}
|
||||
|
||||
Block_10:
|
||||
Block_10:
|
||||
GenerateConnectError(b);
|
||||
return;
|
||||
Block_11:
|
||||
Block_11:
|
||||
GenerateDataError(b);
|
||||
return;
|
||||
Block_17:
|
||||
Block_17:
|
||||
QLog.Log($"MaxEventsPerFrame hit ({500})");
|
||||
Block_19:
|
||||
IL_2C6:
|
||||
Block_19:
|
||||
IL_2C6:
|
||||
if (m_Connection != null && m_AsyncConnect == ConnectState.Connected)
|
||||
{
|
||||
m_Connection.FlushChannels();
|
||||
|
Loading…
Reference in New Issue
Block a user