60 lines
1.5 KiB
C#
60 lines
1.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
using HarmonyLib;
|
|
using OdinSerializer;
|
|
|
|
namespace ScarletMansion.GamePatch {
|
|
[HarmonyPatch(typeof(EnemyVent))]
|
|
public class EnemyVentPatch {
|
|
|
|
/*
|
|
[HarmonyPostfix]
|
|
[HarmonyPatch("BeginVentSFX")]
|
|
public static void BeginVentSFXPatch(ref EnemyVent __instance){
|
|
var comp = __instance.GetComponent<ScarletVent>();
|
|
if (comp) {
|
|
comp.BeginVentSFX();
|
|
}
|
|
}
|
|
*/
|
|
|
|
public static bool setActive = false;
|
|
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch("OpenVentClientRpc")]
|
|
public static void OpenVentClientRpcPatchPre(ref EnemyVent __instance){
|
|
setActive = true;
|
|
}
|
|
|
|
|
|
[HarmonyPostfix]
|
|
[HarmonyPatch("OpenVentClientRpc")]
|
|
public static void OpenVentClientRpcPatchPost(ref EnemyVent __instance){
|
|
if (setActive == false) return;
|
|
|
|
var scarlet = __instance as ScarletVent;
|
|
if (scarlet && (scarlet.enemyType != scarlet.ignoreEnemyType || !KnightSpawnManager.WillSpawnOnSpawnPoint())) {
|
|
Plugin.logger.LogDebug("Doing scalet open vent");
|
|
scarlet.OpenVent();
|
|
}
|
|
|
|
setActive = false;
|
|
}
|
|
|
|
[HarmonyPrefix]
|
|
[HarmonyPatch("Update")]
|
|
public static bool UpdatePrePatch(ref EnemyVent __instance){
|
|
var scarlet = __instance as ScarletVent;
|
|
if (scarlet != null) {
|
|
scarlet.ScarletUpdate();
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
}
|
|
}
|