From ade00d97dcfae8a13a80ec33e30e3bb0674a9592 Mon Sep 17 00:00:00 2001 From: Robert S Date: Mon, 14 Apr 2014 19:38:59 -0400 Subject: [PATCH] Wire electrocution now drains 100j per damage done --- .../electrical/wire/PartAdvancedWire.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/electrical/src/main/scala/resonantinduction/electrical/wire/PartAdvancedWire.java b/electrical/src/main/scala/resonantinduction/electrical/wire/PartAdvancedWire.java index 9c3baa64..d0853ec4 100644 --- a/electrical/src/main/scala/resonantinduction/electrical/wire/PartAdvancedWire.java +++ b/electrical/src/main/scala/resonantinduction/electrical/wire/PartAdvancedWire.java @@ -89,17 +89,18 @@ public abstract class PartAdvancedWire extends PartConductor @Override public void onEntityCollision(Entity entity) { - if (!this.isInsulated()) + if (!this.isInsulated() && this.getNetwork() instanceof IElectricalNetwork) { float damage = 0; - if (this.getNetwork() instanceof IElectricalNetwork && this.getNetwork().getRequest() > 0) - { + if (this.getNetwork().getRequest() > 0) damage = ((IElectricalNetwork) this.getNetwork()).getVoltage() / UniversalElectricity.DEFAULT_VOLTAGE; - } if (damage > 0) + { entity.attackEntityFrom(CustomDamageSource.electrocution, Math.min(damage, 10)); + this.getNetwork().setBuffer((long) Math.max(0, this.getNetwork().getBuffer() - damage * 100)); + } } }