41 lines
1.6 KiB
C#
41 lines
1.6 KiB
C#
namespace Harmony.ElectricWireControllerPatches
|
|
{
|
|
[HarmonyPatch(typeof(ElectricWireController))]
|
|
[HarmonyPatch("touched")]
|
|
public class touchedPatches
|
|
{
|
|
public static bool Prefix(ElectricWireController __instance, Collider collider)
|
|
{
|
|
if (__instance.TileEntityParent == null || __instance.TileEntityChild == null || __instance.WireNode == null || collider == null)
|
|
{
|
|
return false;
|
|
}
|
|
if (__instance.TileEntityParent.IsPowered && __instance.TileEntityChild.IsPowered && collider.transform != null)
|
|
{
|
|
global::EntityAlive entityAlive = collider.transform.GetComponent<global::EntityAlive>();
|
|
if (entityAlive == null)
|
|
{
|
|
entityAlive = collider.transform.GetComponentInParent<global::EntityAlive>();
|
|
}
|
|
if (entityAlive == null && collider.transform.parent != null)
|
|
{
|
|
entityAlive = collider.transform.parent.GetComponentInChildren<global::EntityAlive>();
|
|
}
|
|
if (entityAlive == null)
|
|
{
|
|
entityAlive = collider.transform.GetComponentInChildren<global::EntityAlive>();
|
|
}
|
|
if (entityAlive != null && entityAlive.IsAlive())
|
|
{
|
|
if (entityAlive.Buffs.HasBuff("FuriousRamsayResistShock"))
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
}
|