57 lines
1.9 KiB
C#
Raw Normal View History

2022-05-31 15:31:12 +01:00
using HarmonyLib;
using QSB.Patches;
using UnityEngine;
namespace QSB.Player.Patches;
2023-07-28 19:30:57 +01:00
public class VolumePatches : QSBPatch
2022-05-31 15:31:12 +01:00
{
public override QSBPatchTypes Type => QSBPatchTypes.OnClientConnect;
[HarmonyPostfix]
[HarmonyPatch(typeof(FluidVolume), nameof(FluidVolume.OnEffectVolumeEnter))]
public static void OnEffectVolumeEnter(FluidVolume __instance, GameObject hitObj)
{
var comp = hitObj.GetComponent<RemotePlayerFluidDetector>();
if (comp != null)
{
comp.AddVolume(__instance);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(FluidVolume), nameof(FluidVolume.OnEffectVolumeExit))]
public static void OnEffectVolumeExit(FluidVolume __instance, GameObject hitObj)
{
var comp = hitObj.GetComponent<RemotePlayerFluidDetector>();
if (comp != null)
{
comp.RemoveVolume(__instance);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(RingRiverFluidVolume), nameof(RingRiverFluidVolume.OnEffectVolumeEnter))]
public static void OnEffectVolumeEnter(RingRiverFluidVolume __instance, GameObject hitObj)
{
var comp = hitObj.GetComponent<RemotePlayerFluidDetector>();
if (comp != null)
{
comp.AddVolume(__instance);
}
}
2022-08-09 23:50:27 +01:00
[HarmonyPrefix]
[HarmonyPatch(typeof(ElectricityVolume), nameof(ElectricityVolume.OnEffectVolumeEnter))]
[HarmonyPatch(typeof(DreamWarpVolume), nameof(DreamWarpVolume.OnEnterTriggerVolume))]
[HarmonyPatch(typeof(NomaiWarpPlatform), nameof(NomaiWarpPlatform.OnEntry))]
[HarmonyPatch(typeof(NomaiWarpReceiver), nameof(NomaiWarpReceiver.OnEntry))]
2022-10-04 23:45:20 -07:00
public static bool PreventRemotePlayerEnter(object __instance, GameObject hitObj)
2023-11-13 12:11:03 +00:00
=> hitObj.name is not ("REMOTE_PlayerDetector" or "REMOTE_CameraDetector" or "REMOTE_ProbeDetector");
[HarmonyPrefix]
[HarmonyPatch(typeof(VanishVolume), nameof(VanishVolume.OnTriggerEnter))]
public static bool PreventRemotePlayerEnter(object __instance, Collider hitCollider)
2023-11-13 12:11:03 +00:00
=> hitCollider.name is not ("REMOTE_PlayerDetector" or "REMOTE_CameraDetector" or "REMOTE_ProbeDetector");
2022-05-31 15:31:12 +01:00
}