Added check for inverseRotation in MechanicalGrid

This commit is contained in:
Calclavia 2014-11-09 14:59:41 +08:00
parent bdf458b84c
commit 9f3aad4d99
2 changed files with 4 additions and 10 deletions

View file

@ -78,14 +78,7 @@ class GearShaftNode(parent: PartGearShaft) extends MechanicalNode(parent)
return from == shaft.placementSide || from == shaft.placementSide.getOpposite
}
override def inverseRotation(dir: ForgeDirection): Boolean =
{
if (shaft.placementSide.offsetY != 0 || shaft.placementSide.offsetZ != 0)
{
return dir == shaft.placementSide.getOpposite
}
return dir == shaft.placementSide
}
override def inverseRotation(dir: ForgeDirection): Boolean = false
def shaft: PartGearShaft = getParent.asInstanceOf[PartGearShaft]
}

View file

@ -1,5 +1,6 @@
package resonantinduction.mechanical.mech.grid
import net.minecraftforge.common.util.ForgeDirection
import resonant.api.grid.IUpdate
import resonant.lib.grid.{GridNode, UpdateTicker}
@ -39,7 +40,7 @@ class MechanicalGrid extends GridNode[MechanicalNode](classOf[MechanicalNode]) w
override protected def populateNode(node: MechanicalNode, prev: MechanicalNode)
{
super.populateNode(node, prev)
spinMap += (node -> (if (prev != null) !spinMap(prev) else false))
spinMap += (node -> (if (prev != null) !spinMap(prev) && node.inverseRotation(ForgeDirection.UNKNOWN) && prev.inverseRotation(ForgeDirection.UNKNOWN) else false))
}
override def update(deltaTime: Double)
@ -68,7 +69,7 @@ class MechanicalGrid extends GridNode[MechanicalNode](classOf[MechanicalNode]) w
.foldLeft((0D, 0D))((b, a) => (a._1 + b._1, a._2 + b._2))
//Calculate the total change in torque and angular velocity
delta = (input._1 - input._1 * resistance._1, input._2 - input._2 * resistance._2)
delta = (input._1 - input._1 * resistance._1 / getNodes.size(), input._2 - input._2 * resistance._2 / getNodes.size())
}
//Calculate power