Files
BepInEx/Projects/Quasimorph/Quasimorph/ProjectilePatch.cs

23 lines
727 B
C#

using System;
using HarmonyLib;
namespace Quasimorph {
[HarmonyPatch]
public class ProjectilePatch {
[HarmonyPrefix]
[HarmonyPatch(typeof(Projectile), "StickToObjectWithVisuals")]
static void Prefix(Projectile __instance) {
if (Main.debug.Value)
Console.WriteLine("Projectile created");
var trav = Traverse.Create(__instance);
var explodeOnStick = trav.Field("m_ExplodeOnStick");
if (!explodeOnStick.GetValue<bool>()) {
if (Main.debug.Value)
Console.WriteLine("Exploding on stick");
explodeOnStick.SetValue(Main.projectileExplodeOnStick.Value);
}
}
}
}