mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-03-10 07:14:27 +00:00
unpatching, stuff
This commit is contained in:
parent
8f7b0b8a53
commit
ae871fff33
@ -102,5 +102,15 @@ namespace QSB.ConversationSync.Patches
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<CharacterAnimController>("OnAnimatorIK", typeof(ConversationPatches), nameof(OnAnimatorIK));
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<CharacterAnimController>("OnZoneExit", typeof(ConversationPatches), nameof(OnZoneExit));
|
||||
}
|
||||
|
||||
public override void DoUnpatches()
|
||||
{
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<DialogueNode>("GetNextPage");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<CharacterDialogueTree>("InputDialogueOption");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<CharacterDialogueTree>("StartConversation");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<CharacterDialogueTree>("EndConversation");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<CharacterAnimController>("OnAnimatorIK");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<CharacterAnimController>("OnZoneExit");
|
||||
}
|
||||
}
|
||||
}
|
@ -22,6 +22,16 @@ namespace QSB.DeathSync.Patches
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<DestructionVolume>("VanishShip", typeof(DeathPatches), nameof(DestructionVolume_VanishShip));
|
||||
}
|
||||
|
||||
public override void DoUnpatches()
|
||||
{
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<DeathManager>("KillPlayer");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<ShipDetachableLeg>("Detach");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<ShipDetachableModule>("Detach");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<ShipEjectionSystem>("OnPressInteract");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<ShipDamageController>("Awake");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<DestructionVolume>("VanishShip");
|
||||
}
|
||||
|
||||
public static bool PreFinishDeathSequence(DeathType deathType)
|
||||
{
|
||||
if (RespawnOnDeath.Instance == null)
|
||||
|
@ -16,5 +16,7 @@ namespace QSB.ElevatorSync.Patches
|
||||
}
|
||||
|
||||
public override void DoPatches() => QSBCore.Helper.HarmonyHelper.AddPostfix<Elevator>("StartLift", typeof(ElevatorPatches), nameof(StartLift));
|
||||
|
||||
public override void DoUnpatches() => QSBCore.Helper.HarmonyHelper.Unpatch<Elevator>("StartLift");
|
||||
}
|
||||
}
|
@ -13,6 +13,12 @@ namespace QSB.FrequencySync.Patches
|
||||
QSBCore.Helper.HarmonyHelper.AddPostfix<AudioSignal>("IdentifySignal", typeof(FrequencyPatches), nameof(IdentifySignal));
|
||||
}
|
||||
|
||||
public override void DoUnpatches()
|
||||
{
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<AudioSignal>("IdentifyFrequency");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<AudioSignal>("IdentifySignal");
|
||||
}
|
||||
|
||||
public static void IdentifyFrequency(SignalFrequency ____frequency)
|
||||
=> GlobalMessenger<SignalFrequency>.FireEvent(EventNames.QSBIdentifyFrequency, ____frequency);
|
||||
|
||||
|
@ -17,5 +17,7 @@ namespace QSB.LogSync.Patches
|
||||
}
|
||||
|
||||
public override void DoPatches() => QSBCore.Helper.HarmonyHelper.AddPostfix<ShipLogManager>("RevealFact", typeof(LogPatches), nameof(RevealFact));
|
||||
|
||||
public override void DoUnpatches() => QSBCore.Helper.HarmonyHelper.Unpatch<ShipLogManager>("RevealFact");
|
||||
}
|
||||
}
|
@ -60,5 +60,11 @@ namespace QSB.OrbSync.Patches
|
||||
QSBCore.Helper.HarmonyHelper.AddPostfix<NomaiInterfaceOrb>("StartDragFromPosition", typeof(OrbPatches), nameof(StartDragCallEvent));
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<NomaiInterfaceSlot>("CheckOrbCollision", typeof(OrbPatches), nameof(CheckOrbCollision));
|
||||
}
|
||||
|
||||
public override void DoUnpatches()
|
||||
{
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<NomaiInterfaceOrb>("StartDragFromPosition");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<NomaiInterfaceSlot>("CheckOrbCollision");
|
||||
}
|
||||
}
|
||||
}
|
@ -4,5 +4,6 @@
|
||||
{
|
||||
public abstract QSBPatchTypes Type { get; }
|
||||
public abstract void DoPatches();
|
||||
public abstract void DoUnpatches();
|
||||
}
|
||||
}
|
@ -18,6 +18,7 @@ namespace QSB.Patches
|
||||
public static class QSBPatchManager
|
||||
{
|
||||
public static event Action<QSBPatchTypes> OnPatchType;
|
||||
public static event Action<QSBPatchTypes> OnUnpatchType;
|
||||
|
||||
private static List<QSBPatch> _patchList = new List<QSBPatch>();
|
||||
|
||||
@ -52,5 +53,16 @@ namespace QSB.Patches
|
||||
patch.DoPatches();
|
||||
}
|
||||
}
|
||||
|
||||
public static void DoUnpatchType(QSBPatchTypes type)
|
||||
{
|
||||
OnUnpatchType?.SafeInvoke(type);
|
||||
DebugLog.DebugWrite($"Unpatch block {Enum.GetName(typeof(QSBPatchTypes), type)}", MessageType.Info);
|
||||
foreach (var patch in _patchList.Where(x => x.Type == type))
|
||||
{
|
||||
DebugLog.DebugWrite($" - Unpatching in {patch.GetType().Name}", MessageType.Info);
|
||||
patch.DoUnpatches();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -3,7 +3,9 @@ using QSB.Player.Events;
|
||||
using QSB.Tools;
|
||||
using QSB.TransformSync;
|
||||
using QSB.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
|
||||
namespace QSB.Player
|
||||
@ -18,6 +20,13 @@ namespace QSB.Player
|
||||
|
||||
public static PlayerInfo GetPlayer(uint id)
|
||||
{
|
||||
if (!QSBNetworkManager.Instance.IsReady)
|
||||
{
|
||||
var method = new StackTrace().GetFrame(1).GetMethod();
|
||||
DebugLog.DebugWrite($"Warning - GetPlayer() (id<{id}>) called when Network Manager not ready! Is a Player Sync Object still active? " +
|
||||
$"{Environment.NewLine} Called from {method.DeclaringType.Name}.{method.Name}", MessageType.Warning);
|
||||
}
|
||||
|
||||
if (id == uint.MaxValue || id == 0U)
|
||||
{
|
||||
return default;
|
||||
@ -27,7 +36,8 @@ namespace QSB.Player
|
||||
{
|
||||
return player;
|
||||
}
|
||||
DebugLog.DebugWrite($"Create Player : id<{id}>", MessageType.Info);
|
||||
var trace = new StackTrace().GetFrame(1).GetMethod();
|
||||
DebugLog.DebugWrite($"Create Player : id<{id}> (Called from {trace.DeclaringType.Name}.{trace.Name})", MessageType.Info);
|
||||
player = new PlayerInfo(id);
|
||||
PlayerList.Add(player);
|
||||
return player;
|
||||
@ -35,7 +45,8 @@ namespace QSB.Player
|
||||
|
||||
public static void RemovePlayer(uint id)
|
||||
{
|
||||
DebugLog.DebugWrite($"Remove Player : id<{id}>", MessageType.Info);
|
||||
var trace = new StackTrace().GetFrame(1).GetMethod();
|
||||
DebugLog.DebugWrite($"Remove Player : id<{id}> (Called from {trace.DeclaringType.Name}.{trace.Name})", MessageType.Info);
|
||||
PlayerList.Remove(GetPlayer(id));
|
||||
}
|
||||
|
||||
|
@ -215,7 +215,13 @@ namespace QSB
|
||||
QSBWorldSync.OrbSyncList.Clear();
|
||||
QSBWorldSync.OldDialogueTrees.Clear();
|
||||
|
||||
var specificType = QNetworkServer.active ? QSBPatchTypes.OnServerClientConnect : QSBPatchTypes.OnNonServerClientConnect;
|
||||
QSBPatchManager.DoUnpatchType(specificType);
|
||||
QSBPatchManager.DoUnpatchType(QSBPatchTypes.OnClientConnect);
|
||||
|
||||
_lobby.CanEditName = true;
|
||||
|
||||
IsReady = false;
|
||||
}
|
||||
|
||||
public override void OnServerDisconnect(QNetworkConnection connection) // Called on the server when any client disconnects
|
||||
|
@ -7,6 +7,7 @@ namespace QSB.QuantumSync.Patches
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnNonServerClientConnect;
|
||||
|
||||
public override void DoPatches() => QSBCore.Helper.HarmonyHelper.AddPrefix<QuantumMoon>("ChangeQuantumState", typeof(ClientQuantumPatches), nameof(ReturnFalsePatch));
|
||||
public override void DoUnpatches() => QSBCore.Helper.HarmonyHelper.Unpatch<QuantumMoon>("ChangeQuantumState");
|
||||
|
||||
public static bool ReturnFalsePatch() => false;
|
||||
}
|
||||
|
@ -19,18 +19,28 @@ namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<SocketedQuantumObject>("ChangeQuantumState", typeof(QuantumPatches), nameof(Socketed_ChangeQuantumState));
|
||||
QSBCore.Helper.HarmonyHelper.AddPostfix<SocketedQuantumObject>("MoveToSocket", typeof(QuantumPatches), nameof(Socketed_MoveToSocket));
|
||||
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<QuantumShuffleObject>("ChangeQuantumState", typeof(QuantumPatches), nameof(Shuffle_ChangeQuantumState));
|
||||
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<MultiStateQuantumObject>("ChangeQuantumState", typeof(QuantumPatches), nameof(MultiState_ChangeQuantumState));
|
||||
QSBCore.Helper.HarmonyHelper.AddPostfix<QuantumState>("SetVisible", typeof(QuantumPatches), nameof(QuantumState_SetVisible));
|
||||
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<QuantumShrine>("IsPlayerInDarkness", typeof(QuantumPatches), nameof(Shrine_IsPlayerInDarkness));
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<QuantumShrine>("ChangeQuantumState", typeof(QuantumPatches), nameof(Shrine_ChangeQuantumState));
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<QuantumShrine>("OnEntry", typeof(QuantumPatches), nameof(Shrine_OnEntry));
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<QuantumShrine>("OnExit", typeof(QuantumPatches), nameof(Shrine_OnExit));
|
||||
}
|
||||
|
||||
public override void DoUnpatches()
|
||||
{
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<SocketedQuantumObject>("ChangeQuantumState");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<SocketedQuantumObject>("MoveToSocket");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<QuantumShuffleObject>("ChangeQuantumState");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<MultiStateQuantumObject>("ChangeQuantumState");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<QuantumState>("SetVisible");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<QuantumShrine>("IsPlayerInDarkness");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<QuantumShrine>("ChangeQuantumState");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<QuantumShrine>("OnEntry");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<QuantumShrine>("OnExit");
|
||||
}
|
||||
|
||||
public static bool Socketed_ChangeQuantumState(SocketedQuantumObject __instance)
|
||||
=> QSBWorldSync.GetWorldObject<QSBSocketedQuantumObject>(QuantumManager.Instance.GetId(__instance)).ControllingPlayer == QSBPlayerManager.LocalPlayerId;
|
||||
|
||||
|
@ -18,6 +18,14 @@ namespace QSB.QuantumSync.Patches
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<VisibilityObject>("CheckIllumination", typeof(QuantumVisibilityPatches), nameof(CheckIllumination));
|
||||
}
|
||||
|
||||
public override void DoUnpatches()
|
||||
{
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<ShapeVisibilityTracker>("IsVisibleUsingCameraFrustum");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<ShapeVisibilityTracker>("IsVisible");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<RendererVisibilityTracker>("IsVisibleUsingCameraFrustum");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<VisibilityObject>("CheckIllumination");
|
||||
}
|
||||
|
||||
// ShapeVisibilityTracker patches
|
||||
|
||||
public static bool ShapeIsVisibleUsingCameraFrustum(ShapeVisibilityTracker __instance, ref bool __result)
|
||||
|
@ -18,6 +18,12 @@ namespace QSB.QuantumSync.Patches
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<QuantumMoon>("CheckPlayerFogProximity", typeof(ServerQuantumPatches), nameof(Moon_CheckPlayerFogProximity));
|
||||
}
|
||||
|
||||
public override void DoUnpatches()
|
||||
{
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<QuantumMoon>("ChangeQuantumState");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<QuantumMoon>("CheckPlayerFogProximity");
|
||||
}
|
||||
|
||||
public static bool Moon_ChangeQuantumState(
|
||||
QuantumMoon __instance,
|
||||
ref bool __result,
|
||||
|
@ -17,5 +17,7 @@ namespace QSB.TimeSync.Patches
|
||||
}
|
||||
|
||||
public override void DoPatches() => QSBCore.Helper.HarmonyHelper.AddPrefix<PlayerCameraEffectController>("OnStartOfTimeLoop", typeof(WakeUpPatches), nameof(OnStartOfTimeLoopPrefix));
|
||||
|
||||
public override void DoUnpatches() => QSBCore.Helper.HarmonyHelper.Unpatch<PlayerCameraEffectController>("OnStartOfTimeLoop");
|
||||
}
|
||||
}
|
@ -14,6 +14,13 @@ namespace QSB.TranslationSync.Patches
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix<NomaiVesselComputer>("SetAsTranslated", typeof(SpiralPatches), nameof(VesselComputer_SetAsTranslated));
|
||||
}
|
||||
|
||||
public override void DoUnpatches()
|
||||
{
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<NomaiWallText>("SetAsTranslated");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<NomaiComputer>("SetAsTranslated");
|
||||
QSBCore.Helper.HarmonyHelper.Unpatch<NomaiVesselComputer>("SetAsTranslated");
|
||||
}
|
||||
|
||||
public static bool Wall_SetAsTranslated(NomaiWallText __instance, int id)
|
||||
{
|
||||
if (__instance.IsTranslated(id))
|
||||
|
@ -353,8 +353,8 @@ namespace QuantumUNET.Components
|
||||
public void StopHost()
|
||||
{
|
||||
OnStopHost();
|
||||
StopServer();
|
||||
StopClient();
|
||||
StopServer();
|
||||
}
|
||||
|
||||
public void StopServer()
|
||||
|
Loading…
x
Reference in New Issue
Block a user