Upload from upload_mods.ps1
This commit is contained in:
40
Harmony/Harmony_ElectricWireController.cs
Normal file
40
Harmony/Harmony_ElectricWireController.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user