mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-30 12:32:55 +00:00
update patches, use publicized assembly
This commit is contained in:
parent
d4505b0fb3
commit
565f0b7f8e
@ -1,4 +1,5 @@
|
||||
using OWML.Common;
|
||||
using HarmonyLib;
|
||||
using OWML.Common;
|
||||
using QSB.Animation.NPC.WorldObjects;
|
||||
using QSB.ConversationSync;
|
||||
using QSB.Events;
|
||||
@ -12,22 +13,14 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.Animation.NPC.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class CharacterAnimationPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(CharacterAnimController_OnAnimatorIK));
|
||||
Prefix(nameof(CharacterAnimController_OnZoneEntry));
|
||||
Prefix(nameof(CharacterAnimController_OnZoneExit));
|
||||
Prefix(nameof(FacePlayerWhenTalking_OnStartConversation));
|
||||
Prefix(nameof(CharacterDialogueTree_StartConversation));
|
||||
Prefix(nameof(CharacterDialogueTree_EndConversation));
|
||||
Prefix(nameof(KidRockController_Update));
|
||||
}
|
||||
|
||||
public static bool CharacterAnimController_OnAnimatorIK(
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CharacterAnimController), nameof(CharacterAnimController.OnAnimatorIK))]
|
||||
public static bool AnimatorIKReplacement(
|
||||
CharacterAnimController __instance,
|
||||
float ___headTrackingWeight,
|
||||
bool ___lookOnlyWhenTalking,
|
||||
@ -103,21 +96,27 @@ namespace QSB.Animation.NPC.Patches
|
||||
|
||||
}
|
||||
|
||||
public static bool CharacterAnimController_OnZoneExit(CharacterAnimController __instance)
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CharacterAnimController), nameof(CharacterAnimController.OnZoneExit))]
|
||||
public static bool HeadZoneExit(CharacterAnimController __instance)
|
||||
{
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBCharacterAnimController, CharacterAnimController>(__instance);
|
||||
QSBEventManager.FireEvent(EventNames.QSBExitHeadZone, qsbObj.ObjectId);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool CharacterAnimController_OnZoneEntry(CharacterAnimController __instance)
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CharacterAnimController), nameof(CharacterAnimController.OnZoneEntry))]
|
||||
public static bool HeadZoneEntry(CharacterAnimController __instance)
|
||||
{
|
||||
var qsbObj = QSBWorldSync.GetWorldFromUnity<QSBCharacterAnimController, CharacterAnimController>(__instance);
|
||||
QSBEventManager.FireEvent(EventNames.QSBEnterHeadZone, qsbObj.ObjectId);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool FacePlayerWhenTalking_OnStartConversation(
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(FacePlayerWhenTalking), nameof(FacePlayerWhenTalking.OnStartConversation))]
|
||||
public static bool OnStartConversation(
|
||||
FacePlayerWhenTalking __instance,
|
||||
CharacterDialogueTree ____dialogueTree)
|
||||
{
|
||||
@ -140,7 +139,9 @@ namespace QSB.Animation.NPC.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool CharacterDialogueTree_StartConversation(CharacterDialogueTree __instance)
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.StartConversation))]
|
||||
public static bool StartConversation(CharacterDialogueTree __instance)
|
||||
{
|
||||
var allNpcAnimControllers = QSBWorldSync.GetWorldObjects<INpcAnimController>();
|
||||
var ownerOfThis = allNpcAnimControllers.FirstOrDefault(x => x.GetDialogueTree() == __instance);
|
||||
@ -154,7 +155,9 @@ namespace QSB.Animation.NPC.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CharacterDialogueTree_EndConversation(CharacterDialogueTree __instance)
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.EndConversation))]
|
||||
public static bool EndConversation(CharacterDialogueTree __instance)
|
||||
{
|
||||
var allNpcAnimControllers = QSBWorldSync.GetWorldObjects<INpcAnimController>();
|
||||
var ownerOfThis = allNpcAnimControllers.FirstOrDefault(x => x.GetDialogueTree() == __instance);
|
||||
@ -168,7 +171,9 @@ namespace QSB.Animation.NPC.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool KidRockController_Update(
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(KidRockController), nameof(KidRockController.Update))]
|
||||
public static bool UpdateReplacement(
|
||||
KidRockController __instance,
|
||||
bool ____throwingRock,
|
||||
CharacterDialogueTree ____dialogueTree,
|
||||
|
@ -1,4 +1,5 @@
|
||||
using QSB.Events;
|
||||
using HarmonyLib;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
@ -6,14 +7,14 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.Animation.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class PlayerAnimationPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
=> Prefix(nameof(PlayerAnimController_LateUpdate));
|
||||
|
||||
public static bool PlayerAnimController_LateUpdate(
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PlayerAnimController), nameof(PlayerAnimController.LateUpdate))]
|
||||
public static bool LateUpdateReplacement(
|
||||
PlayerAnimController __instance,
|
||||
PlayerCharacterController ____playerController,
|
||||
ThrusterModel ____playerJetpack,
|
||||
|
@ -1,20 +1,22 @@
|
||||
using QSB.CampfireSync.WorldObjects;
|
||||
using HarmonyLib;
|
||||
using QSB.CampfireSync.WorldObjects;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.CampfireSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class CampfirePatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches() => Prefix(nameof(Campfire_OnPressInteract));
|
||||
|
||||
public static bool Campfire_OnPressInteract(Campfire __instance, Campfire.State ____state)
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(Campfire), nameof(Campfire.OnPressInteract))]
|
||||
public static bool LightCampfireEvent(Campfire __instance)
|
||||
{
|
||||
var qsbCampfire = QSBWorldSync.GetWorldFromUnity<QSBCampfire, Campfire>(__instance);
|
||||
if (____state == Campfire.State.LIT)
|
||||
if (__instance._state == Campfire.State.LIT)
|
||||
{
|
||||
qsbCampfire.StartRoasting();
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using OWML.Common;
|
||||
using HarmonyLib;
|
||||
using OWML.Common;
|
||||
using QSB.Patches;
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
@ -7,18 +8,13 @@ using System.Collections.Generic;
|
||||
|
||||
namespace QSB.ConversationSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class ConversationPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Postfix(nameof(DialogueNode_GetNextPage));
|
||||
Prefix(nameof(CharacterDialogueTree_InputDialogueOption));
|
||||
Prefix(nameof(CharacterDialogueTree_StartConversation));
|
||||
Prefix(nameof(CharacterDialogueTree_EndConversation));
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.StartConversation))]
|
||||
public static void CharacterDialogueTree_StartConversation(CharacterDialogueTree __instance)
|
||||
{
|
||||
var index = QSBWorldSync.OldDialogueTrees.FindIndex(x => x == __instance);
|
||||
@ -31,6 +27,8 @@ namespace QSB.ConversationSync.Patches
|
||||
ConversationManager.Instance.SendConvState(index, true);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.EndConversation))]
|
||||
public static bool CharacterDialogueTree_EndConversation(CharacterDialogueTree __instance)
|
||||
{
|
||||
if (!__instance.enabled)
|
||||
@ -51,6 +49,8 @@ namespace QSB.ConversationSync.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(CharacterDialogueTree), nameof(CharacterDialogueTree.InputDialogueOption))]
|
||||
public static bool CharacterDialogueTree_InputDialogueOption(int optionIndex, DialogueBoxVer2 ____currentDialogueBox)
|
||||
{
|
||||
if (optionIndex < 0)
|
||||
@ -65,6 +65,8 @@ namespace QSB.ConversationSync.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(DialogueNode), nameof(DialogueNode.GetNextPage))]
|
||||
public static void DialogueNode_GetNextPage(string ____name, List<string> ____listPagesToDisplay, int ____currentPage)
|
||||
{
|
||||
var key = ____name + ____listPagesToDisplay[____currentPage];
|
||||
|
@ -11,35 +11,37 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.DeathSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class DeathPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(DeathManager_KillPlayer_Prefix));
|
||||
Postfix(nameof(DeathManager_KillPlayer_Postfix));
|
||||
Prefix(nameof(ShipDetachableLeg_Detach));
|
||||
Prefix(nameof(ShipDetachableModule_Detach));
|
||||
Empty("ShipEjectionSystem_OnPressInteract");
|
||||
Postfix(nameof(ShipDamageController_Awake));
|
||||
Prefix(nameof(DestructionVolume_VanishShip));
|
||||
Prefix(nameof(HighSpeedImpactSensor_FixedUpdate));
|
||||
Prefix(nameof(PlayerResources_OnImpact));
|
||||
}
|
||||
// TODO : Remove with future functionality.
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ShipEjectionSystem), nameof(ShipEjectionSystem.OnPressInteract))]
|
||||
public static bool DisableEjection()
|
||||
=> false;
|
||||
|
||||
// TODO : Remove with future functionality.
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ShipDetachableLeg), nameof(ShipDetachableLeg.Detach))]
|
||||
public static bool ShipDetachableLeg_Detach(ref OWRigidbody __result)
|
||||
{
|
||||
__result = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
// TODO : Remove with future functionality.
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ShipDetachableModule), nameof(ShipDetachableModule.Detach))]
|
||||
public static bool ShipDetachableModule_Detach(ref OWRigidbody __result)
|
||||
{
|
||||
__result = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PlayerResources), nameof(PlayerResources.OnImpact))]
|
||||
public static bool PlayerResources_OnImpact(ImpactData impact, PlayerResources __instance, float ____currentHealth)
|
||||
{
|
||||
if (PlayerState.IsInsideShip())
|
||||
@ -65,6 +67,8 @@ namespace QSB.DeathSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(HighSpeedImpactSensor), nameof(HighSpeedImpactSensor.FixedUpdate))]
|
||||
public static bool HighSpeedImpactSensor_FixedUpdate(
|
||||
HighSpeedImpactSensor __instance,
|
||||
bool ____isPlayer,
|
||||
@ -185,6 +189,8 @@ namespace QSB.DeathSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DeathManager), nameof(DeathManager.KillPlayer))]
|
||||
public static bool DeathManager_KillPlayer_Prefix(DeathType deathType)
|
||||
{
|
||||
if (RespawnOnDeath.Instance == null)
|
||||
@ -203,20 +209,20 @@ namespace QSB.DeathSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(DeathManager), nameof(DeathManager.KillPlayer))]
|
||||
public static void DeathManager_KillPlayer_Postfix(DeathType deathType)
|
||||
{
|
||||
QSBEventManager.FireEvent(EventNames.QSBPlayerDeath, deathType);
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ShipDamageController), nameof(ShipDamageController.Awake))]
|
||||
public static void ShipDamageController_Awake(ref bool ____exploded)
|
||||
=> ____exploded = true;
|
||||
|
||||
public static IEnumerable<CodeInstruction> ReturnNull(IEnumerable<CodeInstruction> instructions) => new List<CodeInstruction>
|
||||
{
|
||||
new CodeInstruction(OpCodes.Ldnull),
|
||||
new CodeInstruction(OpCodes.Ret)
|
||||
};
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(DestructionVolume), nameof(DestructionVolume.VanishShip))]
|
||||
public static bool DestructionVolume_VanishShip(DeathType ____deathType)
|
||||
{
|
||||
if (RespawnOnDeath.Instance == null)
|
||||
|
@ -7,11 +7,11 @@ namespace QSB.DeathSync.Patches
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.RespawnTime;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(MapController_LateUpdate));
|
||||
Prefix(nameof(MapController_EnterMapView));
|
||||
}
|
||||
//public override void DoPatches()
|
||||
//{
|
||||
// Prefix<MapController>(nameof(MapController.LateUpdate), nameof(MapController_LateUpdate));
|
||||
// Prefix<MapController>(nameof(MapController.EnterMapView), nameof(MapController_EnterMapView));
|
||||
//}
|
||||
|
||||
public static bool MapController_EnterMapView(
|
||||
MapController __instance,
|
||||
|
@ -1,18 +1,22 @@
|
||||
using OWML.Utils;
|
||||
using HarmonyLib;
|
||||
using OWML.Utils;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.DeathSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class RespawnPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(PlayerRecoveryPoint_OnGainFocus));
|
||||
Prefix(nameof(PlayerRecoveryPoint_OnPressInteract));
|
||||
}
|
||||
//public override void DoPatches()
|
||||
//{
|
||||
// Prefix<PlayerRecoveryPoint>(nameof(PlayerRecoveryPoint.OnGainFocus), nameof(PlayerRecoveryPoint_OnGainFocus));
|
||||
// Prefix<PlayerRecoveryPoint>(nameof(PlayerRecoveryPoint.OnPressInteract), nameof(PlayerRecoveryPoint_OnPressInteract));
|
||||
//}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PlayerRecoveryPoint), nameof(PlayerRecoveryPoint.OnGainFocus))]
|
||||
public static bool PlayerRecoveryPoint_OnGainFocus(
|
||||
PlayerResources ____playerResources,
|
||||
bool ____refuelsPlayer,
|
||||
@ -100,6 +104,8 @@ namespace QSB.DeathSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PlayerRecoveryPoint), nameof(PlayerRecoveryPoint.OnPressInteract))]
|
||||
public static bool PlayerRecoveryPoint_OnPressInteract(
|
||||
PlayerRecoveryPoint __instance,
|
||||
PlayerResources ____playerResources,
|
||||
|
@ -1,4 +1,5 @@
|
||||
using OWML.Utils;
|
||||
using HarmonyLib;
|
||||
using OWML.Utils;
|
||||
using QSB.ElevatorSync.WorldObjects;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
@ -6,18 +7,18 @@ using QSB.WorldSync;
|
||||
|
||||
namespace QSB.ElevatorSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class ElevatorPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(Elevator), nameof(Elevator.StartLift))]
|
||||
public static void Elevator_StartLift(Elevator __instance)
|
||||
{
|
||||
var isGoingUp = __instance.GetValue<bool>("_goingToTheEnd");
|
||||
var id = QSBWorldSync.GetIdFromUnity<QSBElevator, Elevator>(__instance);
|
||||
QSBEventManager.FireEvent(EventNames.QSBStartLift, id, isGoingUp);
|
||||
}
|
||||
|
||||
public override void DoPatches()
|
||||
=> Postfix(nameof(Elevator_StartLift));
|
||||
}
|
||||
}
|
@ -1,22 +1,22 @@
|
||||
using QSB.Events;
|
||||
using HarmonyLib;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.FrequencySync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class FrequencyPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Postfix(nameof(AudioSignal_IdentifyFrequency));
|
||||
Postfix(nameof(AudioSignal_IdentifySignal));
|
||||
}
|
||||
|
||||
public static void AudioSignal_IdentifyFrequency(SignalFrequency ____frequency)
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(AudioSignal), nameof(AudioSignal.IdentifyFrequency))]
|
||||
static void IdentifyFrequencyEvent(SignalFrequency ____frequency)
|
||||
=> QSBEventManager.FireEvent(EventNames.QSBIdentifyFrequency, ____frequency);
|
||||
|
||||
public static void AudioSignal_IdentifySignal(SignalName ____name)
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(AudioSignal), nameof(AudioSignal.IdentifySignal))]
|
||||
static void IdentifySignalEvent(SignalName ____name)
|
||||
=> QSBEventManager.FireEvent(EventNames.QSBIdentifySignal, ____name);
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,16 @@
|
||||
using QSB.Patches;
|
||||
using HarmonyLib;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.GeyserSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class GeyserPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnNonServerClientConnect;
|
||||
|
||||
public override void DoPatches() => Empty("GeyserController_Update");
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(GeyserController), nameof(GeyserController.Update))]
|
||||
public static bool Empty()
|
||||
=> false;
|
||||
}
|
||||
}
|
||||
|
@ -1,14 +1,15 @@
|
||||
using QSB.Patches;
|
||||
using HarmonyLib;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.Inputs.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class InputPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
=> Prefix(nameof(OWInput_Update));
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(OWInput), nameof(OWInput.Update))]
|
||||
public static bool OWInput_Update()
|
||||
=> QSBInputManager.Instance.InputsEnabled;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using OWML.Common;
|
||||
using HarmonyLib;
|
||||
using OWML.Common;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
using QSB.Utility;
|
||||
@ -7,19 +8,13 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.ItemSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class ItemPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(ItemTool_MoveItemToCarrySocket));
|
||||
Prefix(nameof(ItemTool_SocketItem));
|
||||
Prefix(nameof(ItemTool_StartUnsocketItem));
|
||||
Prefix(nameof(ItemTool_CompleteUnsocketItem));
|
||||
Prefix(nameof(ItemTool_DropItem));
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ItemTool), nameof(ItemTool.MoveItemToCarrySocket))]
|
||||
public static bool ItemTool_MoveItemToCarrySocket(OWItem item)
|
||||
{
|
||||
var itemId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(item));
|
||||
@ -27,6 +22,8 @@ namespace QSB.ItemSync.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ItemTool), nameof(ItemTool.SocketItem))]
|
||||
public static bool ItemTool_SocketItem(OWItem ____heldItem, OWItemSocket socket)
|
||||
{
|
||||
var socketId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(socket));
|
||||
@ -35,6 +32,8 @@ namespace QSB.ItemSync.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ItemTool), nameof(ItemTool.StartUnsocketItem))]
|
||||
public static bool ItemTool_StartUnsocketItem(OWItemSocket socket)
|
||||
{
|
||||
var socketId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(socket));
|
||||
@ -42,6 +41,8 @@ namespace QSB.ItemSync.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ItemTool), nameof(ItemTool.CompleteUnsocketItem))]
|
||||
public static bool ItemTool_CompleteUnsocketItem(OWItem ____heldItem)
|
||||
{
|
||||
var itemId = QSBWorldSync.GetIdFromTypeSubset(ItemManager.GetObject(____heldItem));
|
||||
@ -49,6 +50,8 @@ namespace QSB.ItemSync.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ItemTool), nameof(ItemTool.DropItem))]
|
||||
public static bool ItemTool_DropItem(RaycastHit hit, OWRigidbody targetRigidbody, IItemDropTarget customDropTarget, ref OWItem ____heldItem)
|
||||
{
|
||||
Locator.GetPlayerAudioController().PlayDropItem(____heldItem.GetItemType());
|
||||
|
@ -1,12 +1,16 @@
|
||||
using QSB.Events;
|
||||
using HarmonyLib;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.LogSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class LogPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ShipLogManager), nameof(ShipLogManager.RevealFact))]
|
||||
public static void ShipLogManager_RevealFact(string id, bool saveGame, bool showNotification, bool __result)
|
||||
{
|
||||
if (!__result)
|
||||
@ -16,7 +20,5 @@ namespace QSB.LogSync.Patches
|
||||
|
||||
QSBEventManager.FireEvent(EventNames.QSBRevealFact, id, saveGame, showNotification);
|
||||
}
|
||||
|
||||
public override void DoPatches() => Postfix(nameof(ShipLogManager_RevealFact));
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using QSB.Events;
|
||||
using HarmonyLib;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
using QSB.Utility;
|
||||
using QSB.WorldSync;
|
||||
@ -6,10 +7,13 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.OrbSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class OrbPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(NomaiInterfaceOrb), nameof(NomaiInterfaceOrb.StartDragFromPosition))]
|
||||
public static void NomaiInterfaceOrb_StartDragFromPosition(bool __result, NomaiInterfaceOrb __instance)
|
||||
{
|
||||
if (__result)
|
||||
@ -18,6 +22,8 @@ namespace QSB.OrbSync.Patches
|
||||
}
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiInterfaceSlot), nameof(NomaiInterfaceSlot.CheckOrbCollision))]
|
||||
public static bool NomaiInterfaceSlot_CheckOrbCollision(ref bool __result, NomaiInterfaceSlot __instance, NomaiInterfaceOrb orb,
|
||||
bool ____ignoreDraggedOrbs, float ____radius, float ____exitRadius, ref NomaiInterfaceOrb ____occupyingOrb)
|
||||
{
|
||||
@ -60,11 +66,5 @@ namespace QSB.OrbSync.Patches
|
||||
__result = true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Postfix(nameof(NomaiInterfaceOrb_StartDragFromPosition));
|
||||
Prefix(nameof(NomaiInterfaceSlot_CheckOrbCollision));
|
||||
}
|
||||
}
|
||||
}
|
@ -1,147 +1,24 @@
|
||||
using OWML.Common;
|
||||
using QSB.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using QSB.Utility;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
|
||||
namespace QSB.Patches
|
||||
{
|
||||
public abstract class QSBPatch
|
||||
{
|
||||
public abstract QSBPatchTypes Type { get; }
|
||||
public abstract void DoPatches();
|
||||
|
||||
public virtual void DoPatches()
|
||||
{
|
||||
var oldMethods = QSBPatchManager.HarmonyInstance.GetPatchedMethods();
|
||||
QSBPatchManager.HarmonyInstance.PatchAll(GetType());
|
||||
foreach (var method in QSBPatchManager.HarmonyInstance.GetPatchedMethods().Except(oldMethods))
|
||||
{
|
||||
DebugLog.DebugWrite($"- Patching {method.DeclaringType}.{method.Name}");
|
||||
}
|
||||
}
|
||||
|
||||
public void DoUnpatches()
|
||||
{
|
||||
foreach (var item in _patchedMethods)
|
||||
{
|
||||
//DebugLog.DebugWrite($"[Unpatch] {item.DeclaringType}.{item.Name}", MessageType.Info);
|
||||
Unpatch(item);
|
||||
}
|
||||
|
||||
_patchedMethods.Clear();
|
||||
}
|
||||
|
||||
private List<MethodInfo> _patchedMethods = new List<MethodInfo>();
|
||||
|
||||
public void Empty(string patchName)
|
||||
{
|
||||
//DebugLog.DebugWrite($"[Empty] {patchName}", MessageType.Success);
|
||||
var method = GetMethodInfo(patchName);
|
||||
QSBCore.Helper.HarmonyHelper.EmptyMethod(method);
|
||||
_patchedMethods.Add(method);
|
||||
}
|
||||
|
||||
public void Prefix(string patchName, params Type[] args)
|
||||
=> DoPrefixPostfix(true, patchName, args);
|
||||
|
||||
public void Postfix(string patchName, params Type[] args)
|
||||
=> DoPrefixPostfix(false, patchName, args);
|
||||
|
||||
private void DoPrefixPostfix(bool isPrefix, string patchName, params Type[] args)
|
||||
{
|
||||
var method = GetMethodInfo(patchName, args);
|
||||
|
||||
if (method != null)
|
||||
{
|
||||
if (isPrefix)
|
||||
{
|
||||
QSBCore.Helper.HarmonyHelper.AddPrefix(method, GetType(), patchName);
|
||||
}
|
||||
else
|
||||
{
|
||||
QSBCore.Helper.HarmonyHelper.AddPostfix(method, GetType(), patchName);
|
||||
}
|
||||
|
||||
_patchedMethods.Add(method);
|
||||
}
|
||||
|
||||
//DebugLog.DebugWrite($"{(isPrefix ? "[Prefix]" : "[Postfix]")} {patchName}", method == null ? MessageType.Error : MessageType.Success);
|
||||
}
|
||||
|
||||
private MethodInfo GetMethodInfo(string patchName, params Type[] args)
|
||||
{
|
||||
var splitName = patchName.Split('_');
|
||||
var typeName = splitName[0];
|
||||
var methodName = splitName[1];
|
||||
|
||||
var type = GetFirstTypeByName(typeName);
|
||||
if (type == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Couldn't find type for patch name {patchName}!", MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
var allMethodsOfName = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.FlattenHierarchy).Where(x => x.Name == methodName);
|
||||
|
||||
if (allMethodsOfName.Count() == 0)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Could not find method {methodName} in type {typeName}.", MessageType.Error);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (allMethodsOfName.Count() == 1)
|
||||
{
|
||||
return allMethodsOfName.First();
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite($"More than one method found with name {methodName} in type {typeName}");
|
||||
|
||||
foreach (var method in allMethodsOfName)
|
||||
{
|
||||
DebugLog.DebugWrite($"checking {method.Name}");
|
||||
var paramList = method.GetParameters().Select(x => x.ParameterType);
|
||||
if (Enumerable.SequenceEqual(args, paramList))
|
||||
{
|
||||
DebugLog.DebugWrite($"match!");
|
||||
return method;
|
||||
}
|
||||
}
|
||||
|
||||
DebugLog.DebugWrite($"nothing found");
|
||||
|
||||
DebugLog.ToConsole($"Error - Could not find method {methodName} in type {typeName} with parameter list of {string.Join(", ", args.Select(x => x.FullName).ToArray())}", MessageType.Error);
|
||||
foreach (var method in allMethodsOfName)
|
||||
{
|
||||
var paramList = method.GetParameters().Select(x => x.ParameterType);
|
||||
DebugLog.ToConsole($"- Found {method.Name}, but with params {string.Join(", ", paramList.Select(x => x.FullName).ToArray())}", MessageType.Error);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Type GetFirstTypeByName(string typeName)
|
||||
{
|
||||
var a = typeof(OWRigidbody).Assembly;
|
||||
var assemblyTypes = a.GetTypes();
|
||||
for (var j = 0; j < assemblyTypes.Length; j++)
|
||||
{
|
||||
if (assemblyTypes[j].Name == typeName)
|
||||
{
|
||||
return assemblyTypes[j];
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private void Unpatch(MethodInfo method)
|
||||
{
|
||||
/*
|
||||
var dictionary = typeof(HarmonySharedState).Invoke<Dictionary<MethodBase, byte[]>>("GetState", new object[0]);
|
||||
var methodBase = dictionary.Keys.First(m =>
|
||||
m.DeclaringType == method.DeclaringType
|
||||
&& m.Name == method.Name);
|
||||
|
||||
var patchInfo = PatchInfoSerialization.Deserialize(dictionary.GetValueSafe(methodBase));
|
||||
patchInfo.RemovePostfix(QSBCore.Helper.Manifest.UniqueName);
|
||||
patchInfo.RemovePrefix(QSBCore.Helper.Manifest.UniqueName);
|
||||
patchInfo.RemoveTranspiler(QSBCore.Helper.Manifest.UniqueName);
|
||||
|
||||
PatchFunctions.UpdateWrapper(methodBase, patchInfo, QSBCore.Helper.Manifest.UniqueName);
|
||||
dictionary[methodBase] = patchInfo.Serialize();
|
||||
*/
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
using OWML.Common;
|
||||
using HarmonyLib;
|
||||
using OWML.Common;
|
||||
using OWML.Utils;
|
||||
using QSB.Animation.NPC.Patches;
|
||||
using QSB.Animation.Patches;
|
||||
using QSB.CampfireSync.Patches;
|
||||
@ -34,6 +36,8 @@ namespace QSB.Patches
|
||||
|
||||
private static List<QSBPatch> _patchList = new List<QSBPatch>();
|
||||
|
||||
public static Harmony HarmonyInstance;
|
||||
|
||||
public static void Init()
|
||||
{
|
||||
_patchList = new List<QSBPatch>
|
||||
@ -66,27 +70,36 @@ namespace QSB.Patches
|
||||
new LauncherPatches()
|
||||
};
|
||||
|
||||
HarmonyInstance = QSBCore.Helper.HarmonyHelper.GetValue<Harmony>("_harmony");
|
||||
|
||||
DebugLog.DebugWrite("Patch Manager ready.", MessageType.Success);
|
||||
}
|
||||
|
||||
public static void DoPatchType(QSBPatchTypes type)
|
||||
{
|
||||
OnPatchType?.SafeInvoke(type);
|
||||
//DebugLog.DebugWrite($"Patch block {Enum.GetName(typeof(QSBPatchTypes), type)}", MessageType.Info);
|
||||
DebugLog.DebugWrite($"Patch block {Enum.GetName(typeof(QSBPatchTypes), type)}", MessageType.Info);
|
||||
foreach (var patch in _patchList.Where(x => x.Type == type))
|
||||
{
|
||||
//DebugLog.DebugWrite($" - Patching in {patch.GetType().Name}", MessageType.Info);
|
||||
DebugLog.DebugWrite($" - Patching in {patch.GetType().Name}", MessageType.Info);
|
||||
try
|
||||
{
|
||||
patch.DoPatches();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
DebugLog.DebugWrite($"Error while patching {patch.GetType().Name} :\r\n{ex}", MessageType.Error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void DoUnpatchType(QSBPatchTypes type)
|
||||
{
|
||||
OnUnpatchType?.SafeInvoke(type);
|
||||
//DebugLog.DebugWrite($"Unpatch block {Enum.GetName(typeof(QSBPatchTypes), type)}", MessageType.Info);
|
||||
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);
|
||||
DebugLog.DebugWrite($" - Unpatching in {patch.GetType().Name}", MessageType.Info);
|
||||
patch.DoUnpatches();
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,15 @@
|
||||
using QSB.Patches;
|
||||
using HarmonyLib;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.Player.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class PlayerPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(PlayerCrushedController_CrushPlayer));
|
||||
Prefix(nameof(PauseMenuManager_OnExitToMainMenu));
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PlayerCrushedController), nameof(PlayerCrushedController.CrushPlayer))]
|
||||
public static bool PlayerCrushedController_CrushPlayer()
|
||||
{
|
||||
// #CrushIt https://www.twitch.tv/videos/846916781?t=00h03m51s
|
||||
@ -20,6 +18,9 @@ namespace QSB.Player.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void PauseMenuManager_OnExitToMainMenu() => QSBPlayerManager.LocalPlayer.PlayerStates.IsReady = false;
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PauseMenuManager), nameof(PauseMenuManager.OnExitToMainMenu))]
|
||||
public static void PauseMenuManager_OnExitToMainMenu()
|
||||
=> QSBPlayerManager.LocalPlayer.PlayerStates.IsReady = false;
|
||||
}
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ namespace QSB.Player
|
||||
private bool _needsInitializing;
|
||||
private bool _isReady;
|
||||
|
||||
protected override void InitCanvasMarker()
|
||||
public override void InitCanvasMarker()
|
||||
{
|
||||
_markerRadius = 2f;
|
||||
|
||||
|
@ -13,7 +13,7 @@ namespace QSB.PoolSync
|
||||
private NomaiRemoteCameraStreaming _oldStreaming;
|
||||
private bool _hasLoadedAssets;
|
||||
|
||||
protected override void Awake()
|
||||
public override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
_oldStreaming = GetComponent<NomaiRemoteCameraStreaming>();
|
||||
@ -48,7 +48,7 @@ namespace QSB.PoolSync
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnSectorOccupantAdded(SectorDetector sectorDetector)
|
||||
public override void OnSectorOccupantAdded(SectorDetector sectorDetector)
|
||||
{
|
||||
if (sectorDetector.GetOccupantType() == DynamicOccupant.Player && StreamingManager.isStreamingEnabled)
|
||||
{
|
||||
@ -56,7 +56,7 @@ namespace QSB.PoolSync
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnSectorOccupantRemoved(SectorDetector sectorDetector)
|
||||
public override void OnSectorOccupantRemoved(SectorDetector sectorDetector)
|
||||
{
|
||||
if (sectorDetector.GetOccupantType() == DynamicOccupant.Player)
|
||||
{
|
||||
|
@ -1,34 +1,51 @@
|
||||
using QSB.Patches;
|
||||
using HarmonyLib;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.PoolSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class PoolPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(NomaiRemoteCameraPlatform_Awake));
|
||||
Prefix(nameof(NomaiRemoteCameraPlatform_Update));
|
||||
Prefix(nameof(NomaiRemoteCameraPlatform_OnSocketableRemoved));
|
||||
Prefix(nameof(NomaiRemoteCameraPlatform_OnSocketableDonePlacing));
|
||||
Prefix(nameof(NomaiRemoteCameraPlatform_OnPedestalContact));
|
||||
Prefix(nameof(NomaiRemoteCameraStreaming_FixedUpdate));
|
||||
Prefix(nameof(NomaiRemoteCameraStreaming_OnSectorOccupantAdded));
|
||||
Prefix(nameof(NomaiRemoteCameraStreaming_OnSectorOccupantRemoved));
|
||||
Prefix(nameof(NomaiRemoteCameraStreaming_OnEntry));
|
||||
Prefix(nameof(NomaiRemoteCameraStreaming_OnExit));
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiRemoteCameraPlatform), nameof(NomaiRemoteCameraPlatform.Awake))]
|
||||
public static bool NomaiRemoteCameraPlatform_Awake() => false;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiRemoteCameraPlatform), nameof(NomaiRemoteCameraPlatform.Update))]
|
||||
public static bool NomaiRemoteCameraPlatform_Update() => false;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiRemoteCameraPlatform), nameof(NomaiRemoteCameraPlatform.OnSocketableRemoved))]
|
||||
public static bool NomaiRemoteCameraPlatform_OnSocketableRemoved() => false;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiRemoteCameraPlatform), nameof(NomaiRemoteCameraPlatform.OnSocketableDonePlacing))]
|
||||
public static bool NomaiRemoteCameraPlatform_OnSocketableDonePlacing() => false;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiRemoteCameraPlatform), nameof(NomaiRemoteCameraPlatform.OnPedestalContact))]
|
||||
public static bool NomaiRemoteCameraPlatform_OnPedestalContact() => false;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiRemoteCameraStreaming), nameof(NomaiRemoteCameraStreaming.FixedUpdate))]
|
||||
public static bool NomaiRemoteCameraStreaming_FixedUpdate() => false;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiRemoteCameraStreaming), nameof(NomaiRemoteCameraStreaming.OnSectorOccupantAdded))]
|
||||
public static bool NomaiRemoteCameraStreaming_OnSectorOccupantAdded() => false;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiRemoteCameraStreaming), nameof(NomaiRemoteCameraStreaming.OnSectorOccupantRemoved))]
|
||||
public static bool NomaiRemoteCameraStreaming_OnSectorOccupantRemoved() => false;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiRemoteCameraStreaming), nameof(NomaiRemoteCameraStreaming.OnEntry))]
|
||||
public static bool NomaiRemoteCameraStreaming_OnEntry() => false;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiRemoteCameraStreaming), nameof(NomaiRemoteCameraStreaming.OnExit))]
|
||||
public static bool NomaiRemoteCameraStreaming_OnExit() => false;
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@ -339,69 +340,69 @@
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Assembly-CSharp">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||
<Reference Include="Assembly-CSharp_publicized">
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\publicized_assemblies\Assembly-CSharp_publicized.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Assembly-CSharp-firstpass">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="netstandard">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\netstandard.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\netstandard.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\System.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Unity.InputSystem, Version=1.0.2.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\Unity.InputSystem.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\Unity.InputSystem.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AnimationModule">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.AnimationModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.AnimationModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AssetBundleModule">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.AssetBundleModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AudioModule">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.AudioModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.AudioModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.IMGUIModule">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.InputLegacyModule">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.InputModule">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.InputModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.InputModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.Networking">
|
||||
<HintPath>D:\EpicGames\OuterWilds\OuterWilds_Data\Managed\UnityEngine.Networking.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.Networking.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.ParticleSystemModule">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.ParticleSystemModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.ParticleSystemModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.PhysicsModule">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.PhysicsModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.TextCoreModule">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.TextCoreModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.TextCoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.TextRenderingModule">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UI">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.UI.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.UI.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UIModule">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.UIModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.UIModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.UNETModule">
|
||||
<HintPath>D:\SteamLibrary\steamapps\common\Outer Wilds\OuterWilds_Data\Managed\UnityEngine.UNETModule.dll</HintPath>
|
||||
<HintPath>$(GameDir)\OuterWilds_Data\Managed\UnityEngine.UNETModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -69,7 +69,7 @@ namespace QSB
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
var instance = TextTranslation.Get().GetValue<TextTranslation.TranslationTable>("m_table");
|
||||
var instance = TextTranslation.Get().m_table;
|
||||
instance.theUITable[(int)UITextType.PleaseUseController] =
|
||||
"<color=orange>Quantum Space Buddies</color> is best experienced with friends...";
|
||||
}
|
||||
|
@ -1,21 +1,21 @@
|
||||
using QSB.Patches;
|
||||
using HarmonyLib;
|
||||
using QSB.Patches;
|
||||
using System.Reflection;
|
||||
|
||||
namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class ClientQuantumPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnNonServerClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(QuantumMoon_ChangeQuantumState));
|
||||
Postfix(nameof(QuantumMoon_Start));
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(QuantumMoon), nameof(QuantumMoon.Start))]
|
||||
public static void QuantumMoon_Start(QuantumMoon __instance)
|
||||
=> __instance.GetType().GetMethod("SetSurfaceState", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(__instance, new object[] { -1 });
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(QuantumMoon), nameof(QuantumMoon.ChangeQuantumState))]
|
||||
public static bool QuantumMoon_ChangeQuantumState()
|
||||
=> false;
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using OWML.Common;
|
||||
using HarmonyLib;
|
||||
using OWML.Common;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
using QSB.Player;
|
||||
@ -12,26 +13,13 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class QuantumPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(SocketedQuantumObject_ChangeQuantumState));
|
||||
Postfix(nameof(SocketedQuantumObject_MoveToSocket));
|
||||
Prefix(nameof(QuantumShuffleObject_ChangeQuantumState));
|
||||
Prefix(nameof(MultiStateQuantumObject_ChangeQuantumState));
|
||||
Postfix(nameof(QuantumState_SetVisible));
|
||||
Prefix(nameof(QuantumShrine_IsPlayerInDarkness));
|
||||
Prefix(nameof(QuantumShrine_ChangeQuantumState));
|
||||
Prefix(nameof(QuantumShrine_OnEntry));
|
||||
Prefix(nameof(QuantumShrine_OnExit));
|
||||
Prefix(nameof(QuantumMoon_CheckPlayerFogProximity));
|
||||
Prefix(nameof(QuantumObject_IsLockedByPlayerContact));
|
||||
Prefix(nameof(MultiStateQuantumObject_Start));
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(QuantumObject), nameof(QuantumObject.IsLockedByPlayerContact))]
|
||||
public static bool QuantumObject_IsLockedByPlayerContact(ref bool __result, QuantumObject __instance)
|
||||
{
|
||||
var playersEntangled = QuantumManager.GetEntangledPlayers(__instance);
|
||||
@ -39,6 +27,8 @@ namespace QSB.QuantumSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(SocketedQuantumObject), nameof(SocketedQuantumObject.ChangeQuantumState))]
|
||||
public static bool SocketedQuantumObject_ChangeQuantumState(
|
||||
SocketedQuantumObject __instance,
|
||||
ref bool __result,
|
||||
@ -149,6 +139,8 @@ namespace QSB.QuantumSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(SocketedQuantumObject), nameof(SocketedQuantumObject.MoveToSocket))]
|
||||
public static void SocketedQuantumObject_MoveToSocket(SocketedQuantumObject __instance, QuantumSocket socket)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
@ -183,6 +175,8 @@ namespace QSB.QuantumSync.Patches
|
||||
__instance.transform.localRotation);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(QuantumShuffleObject), nameof(QuantumShuffleObject.ChangeQuantumState))]
|
||||
public static bool QuantumShuffleObject_ChangeQuantumState(
|
||||
QuantumShuffleObject __instance,
|
||||
ref List<int> ____indexList,
|
||||
@ -227,6 +221,8 @@ namespace QSB.QuantumSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(MultiStateQuantumObject), nameof(MultiStateQuantumObject.Start))]
|
||||
public static bool MultiStateQuantumObject_Start(MultiStateQuantumObject __instance, Sector ____sector, bool ____collapseOnStart)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
@ -261,6 +257,8 @@ namespace QSB.QuantumSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(MultiStateQuantumObject), nameof(MultiStateQuantumObject.ChangeQuantumState))]
|
||||
public static bool MultiStateQuantumObject_ChangeQuantumState(MultiStateQuantumObject __instance)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
@ -278,6 +276,8 @@ namespace QSB.QuantumSync.Patches
|
||||
return isInControl;
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(QuantumState), nameof(QuantumState.SetVisible))]
|
||||
public static void QuantumState_SetVisible(QuantumState __instance, bool visible)
|
||||
{
|
||||
if (!WorldObjectManager.AllReady)
|
||||
@ -305,6 +305,8 @@ namespace QSB.QuantumSync.Patches
|
||||
stateIndex);
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(QuantumShrine), nameof(QuantumShrine.IsPlayerInDarkness))]
|
||||
public static bool QuantumShrine_IsPlayerInDarkness(ref bool __result, Light[] ____lamps, float ____fadeFraction, bool ____isProbeInside, NomaiGateway ____gate)
|
||||
{
|
||||
foreach (var lamp in ____lamps)
|
||||
@ -351,6 +353,8 @@ namespace QSB.QuantumSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(QuantumShrine), nameof(QuantumShrine.ChangeQuantumState))]
|
||||
public static bool QuantumShrine_ChangeQuantumState(QuantumShrine __instance)
|
||||
{
|
||||
var shrineWorldObject = QSBWorldSync.GetWorldFromUnity<QSBSocketedQuantumObject, SocketedQuantumObject>(__instance);
|
||||
@ -358,6 +362,8 @@ namespace QSB.QuantumSync.Patches
|
||||
return isInControl;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(QuantumShrine), nameof(QuantumShrine.OnEntry))]
|
||||
public static bool QuantumShrine_OnEntry(
|
||||
GameObject hitObj,
|
||||
ref bool ____isPlayerInside,
|
||||
@ -380,6 +386,8 @@ namespace QSB.QuantumSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(QuantumShrine), nameof(QuantumShrine.OnExit))]
|
||||
public static bool QuantumShrine_OnExit(
|
||||
GameObject hitObj,
|
||||
ref bool ____isPlayerInside,
|
||||
@ -402,6 +410,8 @@ namespace QSB.QuantumSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(QuantumMoon), nameof(QuantumMoon.CheckPlayerFogProximity))]
|
||||
public static bool QuantumMoon_CheckPlayerFogProximity(
|
||||
QuantumMoon __instance,
|
||||
int ____stateIndex,
|
||||
|
@ -1,4 +1,5 @@
|
||||
using QSB.Patches;
|
||||
using HarmonyLib;
|
||||
using QSB.Patches;
|
||||
using QSB.Player;
|
||||
using QSB.Utility;
|
||||
using System.Linq;
|
||||
@ -7,34 +8,33 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class QuantumVisibilityPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(ShapeVisibilityTracker_IsVisibleUsingCameraFrustum));
|
||||
Prefix(nameof(ShapeVisibilityTracker_IsVisible));
|
||||
Prefix(nameof(RendererVisibilityTracker_IsVisibleUsingCameraFrustum));
|
||||
Prefix(nameof(VisibilityObject_CheckIllumination));
|
||||
Postfix(nameof(Shape_OnEnable));
|
||||
Postfix(nameof(Shape_OnDisable));
|
||||
}
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(Shape), nameof(Shape.OnEnable))]
|
||||
public static void Shape_OnEnable(Shape __instance)
|
||||
=> __instance.RaiseEvent("OnShapeActivated", __instance);
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(Shape), nameof(Shape.OnDisable))]
|
||||
public static void Shape_OnDisable(Shape __instance)
|
||||
=> __instance.RaiseEvent("OnShapeDeactivated", __instance);
|
||||
|
||||
// ShapeVisibilityTracker patches
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ShapeVisibilityTracker), nameof(ShapeVisibilityTracker.IsVisibleUsingCameraFrustum))]
|
||||
public static bool ShapeVisibilityTracker_IsVisibleUsingCameraFrustum(ShapeVisibilityTracker __instance, ref bool __result)
|
||||
{
|
||||
__result = QuantumManager.IsVisibleUsingCameraFrustum(__instance, false).Item1;
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ShapeVisibilityTracker), nameof(ShapeVisibilityTracker.IsVisible))]
|
||||
public static bool ShapeVisibilityTracker_IsVisible(ShapeVisibilityTracker __instance, ref bool __result)
|
||||
{
|
||||
__result = QuantumManager.IsVisible(__instance, false);
|
||||
@ -43,6 +43,8 @@ namespace QSB.QuantumSync.Patches
|
||||
|
||||
// RendererVisibilityTracker patches - probably not needed as i don't think RendererVisibilityTracker is ever used?
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(RendererVisibilityTracker), nameof(RendererVisibilityTracker.IsVisibleUsingCameraFrustum))]
|
||||
public static bool RendererVisibilityTracker_IsVisibleUsingCameraFrustum(RendererVisibilityTracker __instance, ref bool __result, Renderer ____renderer, bool ____checkFrustumOcclusion)
|
||||
{
|
||||
__result = QSBPlayerManager.GetPlayersWithCameras()
|
||||
@ -56,6 +58,8 @@ namespace QSB.QuantumSync.Patches
|
||||
|
||||
// VisibilityObject
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(VisibilityObject), nameof(VisibilityObject.CheckIllumination))]
|
||||
public static bool VisibilityObject_CheckIllumination(VisibilityObject __instance, ref bool __result, bool ____checkIllumination, Vector3 ____localIlluminationOffset, float ____illuminationRadius, Light[] ____lightSources)
|
||||
{
|
||||
if (!____checkIllumination)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using OWML.Common;
|
||||
using HarmonyLib;
|
||||
using OWML.Common;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
using QSB.Player;
|
||||
@ -9,13 +10,13 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.QuantumSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
public class ServerQuantumPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnServerClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
=> Prefix(nameof(QuantumMoon_ChangeQuantumState));
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(QuantumMoon), nameof(QuantumMoon.ChangeQuantumState))]
|
||||
public static bool QuantumMoon_ChangeQuantumState(
|
||||
QuantumMoon __instance,
|
||||
ref bool __result,
|
||||
|
@ -1,28 +1,34 @@
|
||||
using QSB.Events;
|
||||
using HarmonyLib;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.RoastingSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class RoastingPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(RoastingStickController_UpdateMarshmallowInput));
|
||||
Prefix(nameof(Marshmallow_Burn));
|
||||
Prefix(nameof(Marshmallow_Shrivel));
|
||||
Prefix(nameof(Marshmallow_RemoveMallow));
|
||||
Prefix(nameof(Marshmallow_SpawnMallow));
|
||||
}
|
||||
//public override void DoPatches()
|
||||
//{
|
||||
// Prefix<RoastingStickController>(nameof(RoastingStickController.UpdateMarshmallowInput), nameof(RoastingStickController_UpdateMarshmallowInput));
|
||||
// Prefix<Marshmallow>(nameof(Marshmallow.Burn), nameof(Marshmallow_Burn));
|
||||
// Prefix<Marshmallow>(nameof(Marshmallow.Shrivel), nameof(Marshmallow_Shrivel));
|
||||
// Prefix<Marshmallow>(nameof(Marshmallow.RemoveMallow), nameof(Marshmallow_RemoveMallow));
|
||||
// Prefix<Marshmallow>(nameof(Marshmallow.SpawnMallow), nameof(Marshmallow_SpawnMallow));
|
||||
//}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(Marshmallow), nameof(Marshmallow.SpawnMallow))]
|
||||
public static bool Marshmallow_SpawnMallow()
|
||||
{
|
||||
QSBEventManager.FireEvent(EventNames.QSBMarshmallowEvent, MarshmallowEventType.Replace);
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(Marshmallow), nameof(Marshmallow.Burn))]
|
||||
public static bool Marshmallow_Burn(
|
||||
ref Marshmallow.MallowState ____mallowState,
|
||||
MeshRenderer ____fireRenderer,
|
||||
@ -43,6 +49,8 @@ namespace QSB.RoastingSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(Marshmallow), nameof(Marshmallow.Shrivel))]
|
||||
public static bool Marshmallow_Shrivel(
|
||||
ref Marshmallow.MallowState ____mallowState,
|
||||
ref float ____initShrivelTime)
|
||||
@ -57,6 +65,8 @@ namespace QSB.RoastingSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(Marshmallow), nameof(Marshmallow.RemoveMallow))]
|
||||
public static bool Marshmallow_RemoveMallow(
|
||||
ParticleSystem ____smokeParticles,
|
||||
MeshRenderer ____fireRenderer,
|
||||
@ -73,6 +83,8 @@ namespace QSB.RoastingSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(RoastingStickController), nameof(RoastingStickController.UpdateMarshmallowInput))]
|
||||
public static bool RoastingStickController_UpdateMarshmallowInput(
|
||||
float ____extendFraction,
|
||||
Marshmallow ____marshmallow,
|
||||
|
@ -4,6 +4,6 @@
|
||||
{
|
||||
public Sector AttachedSector;
|
||||
|
||||
protected override void Awake() { }
|
||||
public override void Awake() { }
|
||||
}
|
||||
}
|
||||
|
@ -1,30 +1,22 @@
|
||||
using OWML.Utils;
|
||||
using HarmonyLib;
|
||||
using OWML.Utils;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
using QSB.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection.Emit;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.ShipSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class ShipPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(HatchController_OnPressInteract));
|
||||
Prefix(nameof(HatchController_OnEntry));
|
||||
Prefix(nameof(ShipTractorBeamSwitch_OnTriggerExit));
|
||||
Prefix(nameof(InteractZone_UpdateInteractVolume));
|
||||
Prefix(nameof(ShipElectricalComponent_OnEnterShip));
|
||||
Prefix(nameof(ShipElectricalComponent_OnExitShip));
|
||||
Prefix(nameof(ShipComponent_SetDamaged));
|
||||
Prefix(nameof(ShipHull_FixedUpdate));
|
||||
Prefix(nameof(ShipDamageController_OnImpact));
|
||||
Postfix(nameof(ShipComponent_RepairTick));
|
||||
Prefix(nameof(ShipHull_RepairTick));
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(HatchController), nameof(HatchController.OnPressInteract))]
|
||||
public static bool HatchController_OnPressInteract()
|
||||
{
|
||||
if (!PlayerState.IsInsideShip())
|
||||
@ -37,6 +29,8 @@ namespace QSB.ShipSync.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(HatchController), nameof(HatchController.OnEntry))]
|
||||
public static bool HatchController_OnEntry(GameObject hitObj)
|
||||
{
|
||||
if (hitObj.CompareTag("PlayerDetector"))
|
||||
@ -47,9 +41,11 @@ namespace QSB.ShipSync.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool ShipTractorBeamSwitch_OnTriggerExit(Collider hitCollider, bool ____isPlayerInShip, bool ____functional)
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ShipTractorBeamSwitch), nameof(ShipTractorBeamSwitch.OnTriggerExit))]
|
||||
public static bool ShipTractorBeamSwitch_OnTriggerExit(ShipTractorBeamSwitch __instance, Collider hitCollider)
|
||||
{
|
||||
if (!____isPlayerInShip && ____functional && hitCollider.CompareTag("PlayerDetector") && !ShipManager.Instance.HatchController.GetValue<GameObject>("_hatchObject").activeSelf)
|
||||
if (!__instance._isPlayerInShip && __instance._functional && hitCollider.CompareTag("PlayerDetector") && !ShipManager.Instance.HatchController._hatchObject.activeSelf)
|
||||
{
|
||||
ShipManager.Instance.HatchController.Invoke("CloseHatch");
|
||||
ShipManager.Instance.ShipTractorBeam.DeactivateTractorBeam();
|
||||
@ -59,7 +55,16 @@ namespace QSB.ShipSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool InteractZone_UpdateInteractVolume(InteractZone __instance, OWCamera ____playerCam, ref bool ____focused)
|
||||
[HarmonyReversePatch]
|
||||
[HarmonyPatch(typeof(SingleInteractionVolume), nameof(SingleInteractionVolume.UpdateInteractVolume))]
|
||||
public static void SingleInteractionVolume_UpdateInteractVolume_Stub(object instance)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(InteractZone), nameof(InteractZone.UpdateInteractVolume))]
|
||||
public static bool InteractZone_UpdateInteractVolume(InteractZone __instance)
|
||||
{
|
||||
/* Angle for interaction with the ship hatch
|
||||
*
|
||||
@ -78,64 +83,86 @@ namespace QSB.ShipSync.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
var angle = 2f * Vector3.Angle(____playerCam.transform.forward, __instance.transform.forward);
|
||||
var angle = 2f * Vector3.Angle(__instance._playerCam.transform.forward, __instance.transform.forward);
|
||||
|
||||
____focused = PlayerState.IsInsideShip()
|
||||
__instance._focused = PlayerState.IsInsideShip()
|
||||
? angle <= 80
|
||||
: angle >= 280;
|
||||
|
||||
__instance.CallBase<InteractZone, SingleInteractionVolume>("UpdateInteractVolume");
|
||||
SingleInteractionVolume_UpdateInteractVolume_Stub(__instance as SingleInteractionVolume);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool ShipElectricalComponent_OnEnterShip(ShipElectricalComponent __instance, bool ____damaged, ElectricalSystem ____electricalSystem)
|
||||
[HarmonyReversePatch]
|
||||
[HarmonyPatch(typeof(ShipComponent), nameof(ShipComponent.OnEnterShip))]
|
||||
public static void ShipComponent_OnEnterShip_Stub(object instance)
|
||||
{
|
||||
__instance.CallBase<ShipElectricalComponent, ShipComponent>("OnEnterShip");
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ShipElectricalComponent), nameof(ShipElectricalComponent.OnEnterShip))]
|
||||
public static bool ShipElectricalComponent_OnEnterShip(ShipElectricalComponent __instance)
|
||||
{
|
||||
ShipComponent_OnEnterShip_Stub(__instance as ShipComponent);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool ShipElectricalComponent_OnExitShip(ShipElectricalComponent __instance, bool ____damaged, ElectricalSystem ____electricalSystem)
|
||||
[HarmonyReversePatch]
|
||||
[HarmonyPatch(typeof(ShipComponent), nameof(ShipComponent.OnExitShip))]
|
||||
public static void ShipComponent_OnExitShip_Stub(object instance)
|
||||
{
|
||||
__instance.CallBase<ShipElectricalComponent, ShipComponent>("OnExitShip");
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ShipElectricalComponent), nameof(ShipElectricalComponent.OnExitShip))]
|
||||
public static bool ShipElectricalComponent_OnExitShip(ShipElectricalComponent __instance)
|
||||
{
|
||||
ShipComponent_OnExitShip_Stub(__instance as ShipComponent);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static bool ShipComponent_SetDamaged(ShipComponent __instance, bool damaged, ref bool ____damaged, ref float ____repairFraction, DamageEffect ____damageEffect)
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ShipComponent), nameof(ShipComponent.SetDamaged))]
|
||||
public static bool ShipComponent_SetDamaged(ShipComponent __instance, bool damaged)
|
||||
{
|
||||
if (____damaged == damaged)
|
||||
if (__instance._damaged == damaged)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (damaged)
|
||||
{
|
||||
____damaged = true;
|
||||
____repairFraction = 0f;
|
||||
__instance._damaged = true;
|
||||
__instance._repairFraction = 0f;
|
||||
__instance.GetType().GetAnyMethod("OnComponentDamaged").Invoke(__instance, null);
|
||||
__instance.RaiseEvent("OnDamaged", __instance);
|
||||
QSBEventManager.FireEvent(EventNames.QSBComponentDamaged, __instance);
|
||||
}
|
||||
else
|
||||
{
|
||||
____damaged = false;
|
||||
____repairFraction = 1f;
|
||||
__instance._damaged = false;
|
||||
__instance._repairFraction = 1f;
|
||||
__instance.GetType().GetAnyMethod("OnComponentRepaired").Invoke(__instance, null);
|
||||
__instance.RaiseEvent("OnRepaired", __instance);
|
||||
QSBEventManager.FireEvent(EventNames.QSBComponentRepaired, __instance);
|
||||
}
|
||||
|
||||
__instance.GetType().GetAnyMethod("UpdateColliderState").Invoke(__instance, null);
|
||||
if (____damageEffect)
|
||||
if (__instance._damageEffect)
|
||||
{
|
||||
____damageEffect.SetEffectBlend(1f - ____repairFraction);
|
||||
__instance._damageEffect.SetEffectBlend(1f - __instance._repairFraction);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ShipHull), nameof(ShipHull.FixedUpdate))]
|
||||
public static bool ShipHull_FixedUpdate(ShipHull __instance, ref ImpactData ____dominantImpact, ref float ____integrity, ref bool ____damaged, DamageEffect ____damageEffect, ShipComponent[] ____components)
|
||||
{
|
||||
if (____dominantImpact != null)
|
||||
@ -186,15 +213,21 @@ namespace QSB.ShipSync.Patches
|
||||
return false;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ShipDamageController), nameof(ShipDamageController.OnImpact))]
|
||||
public static bool ShipDamageController_OnImpact()
|
||||
=> ShipManager.Instance.HasAuthority;
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ShipComponent), nameof(ShipComponent.RepairTick))]
|
||||
public static void ShipComponent_RepairTick(ShipComponent __instance, float ____repairFraction)
|
||||
{
|
||||
QSBEventManager.FireEvent(EventNames.QSBComponentRepairTick, __instance, ____repairFraction);
|
||||
return;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ShipHull), nameof(ShipHull.RepairTick))]
|
||||
public static bool ShipHull_RepairTick(ShipHull __instance, ref float ____integrity, ref bool ____damaged, DamageEffect ____damageEffect, float ____repairTime)
|
||||
{
|
||||
if (!____damaged)
|
||||
|
@ -1,17 +1,18 @@
|
||||
using QSB.Events;
|
||||
using HarmonyLib;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
using QSB.Player;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.StatueSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class StatuePatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
=> Prefix(nameof(MemoryUplinkTrigger_Update));
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(MemoryUplinkTrigger), nameof(MemoryUplinkTrigger.Update))]
|
||||
public static bool MemoryUplinkTrigger_Update(bool ____waitForPlayerGrounded)
|
||||
{
|
||||
if (StatueManager.Instance.HasStartedStatueLocally)
|
||||
|
@ -1,19 +1,26 @@
|
||||
using QSB.Patches;
|
||||
using HarmonyLib;
|
||||
using QSB.Patches;
|
||||
|
||||
namespace QSB.TimeSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class TimePatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(PlayerCameraEffectController_OnStartOfTimeLoop));
|
||||
Empty("OWTime_Pause");
|
||||
Empty("SubmitActionSkipToNextLoop_AdvanceToNextLoop"); // TODO : remove this, remove meditation button instead
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(PlayerCameraEffectController), nameof(PlayerCameraEffectController.OnStartOfTimeLoop))]
|
||||
public static bool PlayerCameraEffectController_OnStartOfTimeLoop()
|
||||
=> false;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(OWTime), nameof(OWTime.Pause))]
|
||||
public static bool StopPausing()
|
||||
=> false;
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(SubmitActionSkipToNextLoop), nameof(SubmitActionSkipToNextLoop.AdvanceToNewTimeLoop))]
|
||||
public static bool StopMeditation()
|
||||
=> false;
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using QSB.Events;
|
||||
using HarmonyLib;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
using QSB.Player;
|
||||
using QSB.Tools.ProbeLauncherTool.WorldObjects;
|
||||
@ -7,17 +8,13 @@ using UnityEngine;
|
||||
|
||||
namespace QSB.Tools.ProbeLauncherTool.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class LauncherPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(ProbeLauncher_RetrieveProbe));
|
||||
Postfix(nameof(ProbeLauncherEffects_PlayRetrievalClip));
|
||||
Postfix(nameof(ProbeLauncherEffects_PlayLaunchClip));
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(ProbeLauncher), nameof(ProbeLauncher.RetrieveProbe))]
|
||||
public static bool ProbeLauncher_RetrieveProbe(
|
||||
ProbeLauncher __instance,
|
||||
bool playEffects,
|
||||
@ -74,8 +71,12 @@ namespace QSB.Tools.ProbeLauncherTool.Patches
|
||||
// TODO : ehhhh idk about this. maybe copy each sound source so we have a 2d version (for local) and a 3d version (for remote)?
|
||||
// this would probably be a whole qsb version on it's own
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ProbeLauncherEffects), nameof(ProbeLauncherEffects.PlayRetrievalClip))]
|
||||
public static void ProbeLauncherEffects_PlayRetrievalClip(OWAudioSource ____owAudioSource) => ____owAudioSource.GetAudioSource().spatialBlend = 1f;
|
||||
|
||||
[HarmonyPostfix]
|
||||
[HarmonyPatch(typeof(ProbeLauncherEffects), nameof(ProbeLauncherEffects.PlayLaunchClip))]
|
||||
public static void ProbeLauncherEffects_PlayLaunchClip(OWAudioSource ____owAudioSource) => ____owAudioSource.GetAudioSource().spatialBlend = 1f;
|
||||
}
|
||||
}
|
||||
|
@ -1,21 +1,18 @@
|
||||
using QSB.Events;
|
||||
using HarmonyLib;
|
||||
using QSB.Events;
|
||||
using QSB.Patches;
|
||||
using QSB.TranslationSync.WorldObjects;
|
||||
using QSB.WorldSync;
|
||||
|
||||
namespace QSB.TranslationSync.Patches
|
||||
{
|
||||
[HarmonyPatch]
|
||||
internal class SpiralPatches : QSBPatch
|
||||
{
|
||||
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
|
||||
|
||||
public override void DoPatches()
|
||||
{
|
||||
Prefix(nameof(NomaiWallText_SetAsTranslated));
|
||||
Prefix(nameof(NomaiComputer_SetAsTranslated));
|
||||
Prefix(nameof(NomaiVesselComputer_SetAsTranslated));
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiWallText), nameof(NomaiWallText.SetAsTranslated))]
|
||||
public static bool NomaiWallText_SetAsTranslated(NomaiWallText __instance, int id)
|
||||
{
|
||||
if (__instance.IsTranslated(id))
|
||||
@ -31,6 +28,8 @@ namespace QSB.TranslationSync.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiComputer), nameof(NomaiWallText.SetAsTranslated))]
|
||||
public static bool NomaiComputer_SetAsTranslated(NomaiComputer __instance, int id)
|
||||
{
|
||||
if (__instance.IsTranslated(id))
|
||||
@ -46,6 +45,8 @@ namespace QSB.TranslationSync.Patches
|
||||
return true;
|
||||
}
|
||||
|
||||
[HarmonyPrefix]
|
||||
[HarmonyPatch(typeof(NomaiVesselComputer), nameof(NomaiWallText.SetAsTranslated))]
|
||||
public static bool NomaiVesselComputer_SetAsTranslated(NomaiVesselComputer __instance, int id)
|
||||
{
|
||||
if (__instance.IsTranslated(id))
|
||||
|
@ -129,27 +129,6 @@ namespace QSB.Utility
|
||||
multiDelegate.GetInvocationList().ToList().ForEach(dl => dl.DynamicInvoke(args));
|
||||
}
|
||||
|
||||
public static void CallBase<ThisType, BaseType>(this ThisType obj, string methodName)
|
||||
where ThisType : BaseType
|
||||
{
|
||||
var method = typeof(BaseType).GetAnyMethod(methodName);
|
||||
if (method == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Couldn't find method {methodName} in {typeof(BaseType).FullName}!", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var functionPointer = method.MethodHandle.GetFunctionPointer();
|
||||
if (functionPointer == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Error - Function pointer for {methodName} in {typeof(BaseType).FullName} is null!", MessageType.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var methodAction = (Action)Activator.CreateInstance(typeof(Action), obj, functionPointer);
|
||||
methodAction();
|
||||
}
|
||||
|
||||
// OW
|
||||
|
||||
public static Vector3 GetRelativeAngularVelocity(this OWRigidbody baseBody, OWRigidbody relativeBody)
|
||||
|
@ -10,32 +10,32 @@ namespace QSBTests
|
||||
[TestClass]
|
||||
public class PatchTests
|
||||
{
|
||||
[TestMethod]
|
||||
public void CheckUnreferencedPatches()
|
||||
{
|
||||
var qsbAssembly = Assembly.Load("QSB");
|
||||
var allPatchTypes = qsbAssembly
|
||||
.GetTypes()
|
||||
.Where(x => typeof(QSBPatch).IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract);
|
||||
//[TestMethod]
|
||||
//public void CheckUnreferencedPatches()
|
||||
//{
|
||||
// var qsbAssembly = Assembly.Load("QSB");
|
||||
// var allPatchTypes = qsbAssembly
|
||||
// .GetTypes()
|
||||
// .Where(x => typeof(QSBPatch).IsAssignableFrom(x) && !x.IsInterface && !x.IsAbstract);
|
||||
|
||||
QSBPatchManager.Init();
|
||||
var patchInstances = (List<QSBPatch>)typeof(QSBPatchManager)
|
||||
.GetField("_patchList", BindingFlags.NonPublic | BindingFlags.Static)
|
||||
.GetValue(typeof(QSBPatchManager));
|
||||
// QSBPatchManager.Init();
|
||||
// var patchInstances = (List<QSBPatch>)typeof(QSBPatchManager)
|
||||
// .GetField("_patchList", BindingFlags.NonPublic | BindingFlags.Static)
|
||||
// .GetValue(typeof(QSBPatchManager));
|
||||
|
||||
var failedTypes = new List<Type>();
|
||||
foreach (var type in allPatchTypes)
|
||||
{
|
||||
if (!patchInstances.Any(x => x.GetType() == type))
|
||||
{
|
||||
failedTypes.Add(type);
|
||||
}
|
||||
}
|
||||
// var failedTypes = new List<Type>();
|
||||
// foreach (var type in allPatchTypes)
|
||||
// {
|
||||
// if (!patchInstances.Any(x => x.GetType() == type))
|
||||
// {
|
||||
// failedTypes.Add(type);
|
||||
// }
|
||||
// }
|
||||
|
||||
if (failedTypes.Count > 0)
|
||||
{
|
||||
Assert.Fail(string.Join(", ", failedTypes.Select(x => x.Name)));
|
||||
}
|
||||
}
|
||||
// if (failedTypes.Count > 0)
|
||||
// {
|
||||
// Assert.Fail(string.Join(", ", failedTypes.Select(x => x.Name)));
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user