mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-02-09 09:39:57 +00:00
cleanup
This commit is contained in:
parent
b89cb67794
commit
85bb0f9716
@ -116,7 +116,7 @@ namespace QSB.Player
|
||||
public static void ShowAllPlayers()
|
||||
=> PlayerList.Where(x => x != LocalPlayer).ToList().ForEach(x => ChangePlayerVisibility(x.PlayerId, true));
|
||||
|
||||
public static void HideAllPlayers()
|
||||
public static void HideAllPlayers()
|
||||
=> PlayerList.Where(x => x != LocalPlayer).ToList().ForEach(x => ChangePlayerVisibility(x.PlayerId, false));
|
||||
|
||||
public static void ChangePlayerVisibility(uint playerId, bool visible)
|
||||
|
@ -31,10 +31,10 @@ namespace QSB.QuantumSync.Patches
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<Shape>("OnDisable");
|
||||
}
|
||||
|
||||
public static void Shape_OnEnable(Shape __instance)
|
||||
public static void Shape_OnEnable(Shape __instance)
|
||||
=> QSBWorldSync.RaiseEvent(__instance, "OnShapeActivated", __instance);
|
||||
|
||||
public static void Shape_OnDisable(Shape __instance)
|
||||
public static void Shape_OnDisable(Shape __instance)
|
||||
=> QSBWorldSync.RaiseEvent(__instance, "OnShapeDeactivated", __instance);
|
||||
|
||||
// ShapeVisibilityTracker patches
|
||||
|
@ -3,17 +3,17 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.StatueSync.Events
|
||||
{
|
||||
class StartStatueEvent : QSBEvent<StartStatueMessage>
|
||||
internal class StartStatueEvent : QSBEvent<StartStatueMessage>
|
||||
{
|
||||
public override QSB.Events.EventType Type => QSB.Events.EventType.StartStatue;
|
||||
|
||||
public override void SetupListener()
|
||||
public override void SetupListener()
|
||||
=> GlobalMessenger<Vector3, Quaternion, float>.AddListener(EventNames.QSBStartStatue, Handler);
|
||||
|
||||
public override void CloseListener()
|
||||
public override void CloseListener()
|
||||
=> GlobalMessenger<Vector3, Quaternion, float>.RemoveListener(EventNames.QSBStartStatue, Handler);
|
||||
|
||||
private void Handler(Vector3 position, Quaternion rotation, float degrees)
|
||||
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
|
||||
@ -24,7 +24,7 @@ namespace QSB.StatueSync.Events
|
||||
CameraDegrees = degrees
|
||||
};
|
||||
|
||||
public override void OnReceiveRemote(bool server, StartStatueMessage message)
|
||||
public override void OnReceiveRemote(bool server, StartStatueMessage message)
|
||||
=> StatueManager.Instance.BeginSequence(message.PlayerPosition, message.PlayerRotation, message.CameraDegrees);
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace QSB.StatueSync.Events
|
||||
base.Deserialize(reader);
|
||||
PlayerPosition = reader.ReadVector3();
|
||||
PlayerRotation = reader.ReadQuaternion();
|
||||
CameraDegrees = reader.ReadSingle();
|
||||
CameraDegrees = reader.ReadSingle();
|
||||
}
|
||||
|
||||
public override void Serialize(QNetworkWriter writer)
|
||||
|
@ -1,22 +1,18 @@
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
using QSB.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.StatueSync.Patches
|
||||
{
|
||||
class StatuePatches : QSBPatch
|
||||
internal class StatuePatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnServerClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
public override void DoPatches()
|
||||
=> QSBCore.Helper.HarmonyHelper.AddPrefix<MemoryUplinkTrigger>("Update", typeof(StatuePatches), nameof(Statue_Update));
|
||||
|
||||
public override void DoUnpatches()
|
||||
public override void DoUnpatches()
|
||||
=> QSBCore.Helper.HarmonyHelper.Unpatch<MemoryUplinkTrigger>("BeginUplinkSequence");
|
||||
|
||||
public static bool Statue_Update(bool ____waitForPlayerGrounded)
|
||||
@ -30,8 +26,8 @@ namespace QSB.StatueSync.Patches
|
||||
var timberHearth = Locator.GetAstroObject(AstroObject.Name.TimberHearth).transform;
|
||||
QSBEventManager.FireEvent(
|
||||
EventNames.QSBStartStatue,
|
||||
timberHearth.InverseTransformPoint(playerBody.position),
|
||||
Quaternion.Inverse(timberHearth.rotation) * playerBody.rotation,
|
||||
timberHearth.InverseTransformPoint(playerBody.position),
|
||||
Quaternion.Inverse(timberHearth.rotation) * playerBody.rotation,
|
||||
Locator.GetPlayerCamera().GetComponent<PlayerCameraController>().GetDegreesY());
|
||||
return true;
|
||||
}
|
||||
|
@ -1,18 +1,17 @@
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.StatueSync
|
||||
{
|
||||
class StatueManager : MonoBehaviour
|
||||
internal class StatueManager : MonoBehaviour
|
||||
{
|
||||
public static StatueManager Instance { get; private set; }
|
||||
|
||||
private void Awake()
|
||||
private void Awake()
|
||||
=> Instance = this;
|
||||
|
||||
public void BeginSequence(Vector3 position, Quaternion rotation, float cameraDegrees)
|
||||
public void BeginSequence(Vector3 position, Quaternion rotation, float cameraDegrees)
|
||||
=> StartCoroutine(BeginRemoteUplinkSequence(position, rotation, cameraDegrees));
|
||||
|
||||
private IEnumerator BeginRemoteUplinkSequence(Vector3 position, Quaternion rotation, float cameraDegrees)
|
||||
|
@ -195,8 +195,8 @@ namespace QSB.TimeSync
|
||||
DebugLog.DebugWrite($"enable input - stored:{_storedMode}");
|
||||
_isInputEnabled = true;
|
||||
OWInput.ChangeInputMode(
|
||||
_storedMode != InputMode.None
|
||||
? _storedMode
|
||||
_storedMode != InputMode.None
|
||||
? _storedMode
|
||||
: InputMode.Character);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user