Fixed #374 - Changed mechanical resistance equation

This commit is contained in:
Calclavia 2014-03-05 19:50:27 +08:00
parent 61aec43d44
commit 171d8bb1ee
3 changed files with 29 additions and 22 deletions

View file

@ -78,11 +78,11 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
switch (tier)
{
default:
return 0.4;
return 0.8;
case 1:
return 0.3;
return 0.6;
case 2:
return 0.2;
return 0.4;
}
}
@ -93,11 +93,11 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
switch (tier)
{
default:
return 0.3;
return 0.6;
case 1:
return 0.4;
return 0.8;
case 2:
return 0.2;
return 0.4;
}
}
@ -344,7 +344,7 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
{
if (manualCrankTime > 0)
{
node.apply(isClockwiseCrank ? 4 : -4, isClockwiseCrank ? 0.03f : -0.03f);
node.apply(isClockwiseCrank ? 2 : -2, isClockwiseCrank ? 0.02f : -0.02f);
manualCrankTime--;
}
@ -363,9 +363,6 @@ public class PartGear extends PartMechanical implements IMultiBlockStructure<Par
@Override
public boolean activate(EntityPlayer player, MovingObjectPosition hit, ItemStack itemStack)
{
if (!world().isRemote)
System.out.println(node.getGrid());
if (itemStack != null && itemStack.getItem() instanceof ItemHandCrank)
{
if (!world().isRemote && ControlKeyModifer.isControlDown(player))

View file

@ -61,11 +61,11 @@ public class PartGearShaft extends PartMechanical
switch (tier)
{
default:
return 0.04;
return 0.08;
case 1:
return 0.03;
return 0.06;
case 2:
return 0.02;
return 0.04;
}
}
@ -76,11 +76,11 @@ public class PartGearShaft extends PartMechanical
switch (tier)
{
default:
return 0.03;
return 0.06;
case 1:
return 0.04;
return 0.08;
case 2:
return 0.02;
return 0.04;
}
}

View file

@ -66,8 +66,6 @@ public class MechanicalNode extends EnergyNode
@Override
public void update(float deltaTime)
{
power = getEnergy() / deltaTime;
prevAngularVelocity = angularVelocity;
onUpdate();
@ -80,16 +78,28 @@ public class MechanicalNode extends EnergyNode
angle = angle % (Math.PI * 2);
}
// TODO: Remove upon split.
if (world() != null && !world().isRemote)
{
double acceleration = this.acceleration * deltaTime;
/**
* Loss energy
* Energy loss
*/
torque -= getTorque() * getTorqueLoad() * deltaTime;
angularVelocity -= getAngularVelocity() * getAngularVelocityLoad() * deltaTime;
double torqueLoss = Math.min(Math.abs(getAngularVelocity()), (Math.abs(getTorque() * getTorqueLoad()) + getTorqueLoad() / 10) * deltaTime);
if (torque > 0)
torque -= torqueLoss;
else
torque += torqueLoss;
double velocityLoss = Math.min(Math.abs(getAngularVelocity()), (Math.abs(getAngularVelocity() * getAngularVelocityLoad()) + getAngularVelocityLoad() / 10) * deltaTime);
if (angularVelocity > 0)
angularVelocity -= velocityLoss;
else
angularVelocity += velocityLoss;
power = getEnergy() / deltaTime;
synchronized (connections)
{