The Relay now reacts instantly to a redstone signal again, removed throttling for it, fixes #1314

This commit is contained in:
raoulvdberge
2017-06-21 19:28:24 +02:00
parent aaa75992f4
commit aada492d5e
3 changed files with 20 additions and 3 deletions

View File

@@ -3,6 +3,7 @@
### 1.5.3
- Fixed Solderer crashing (raoulvdberge)
- The Portable Grid now exposes an inventory for interaction with other mods or vanilla (raoulvdberge)
- The Relay now reacts instantly to a redstone signal again, removed throttling for it (raoulvdberge)
### 1.5.2
- Fixed a bug where loading nodes would abort when a single node has an error while reading (raoulvdberge)

View File

@@ -89,6 +89,14 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor,
return redstoneMode.isEnabled(world, pos);
}
protected int getUpdateThrottleInactiveToActive() {
return 20;
}
protected int getUpdateThrottleActiveToInactive() {
return 4;
}
@Override
public void update() {
++ticks;
@@ -98,9 +106,7 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor,
if (couldUpdate != canUpdate) {
++ticksSinceUpdateChanged;
// If we go from inactive to active, throttle for 20 ticks
// If we go from active to inactive, throttle for 4 ticks
if (canUpdate ? (ticksSinceUpdateChanged > 20) : (ticksSinceUpdateChanged > 4)) {
if (canUpdate ? (ticksSinceUpdateChanged > getUpdateThrottleActiveToInactive()) : (ticksSinceUpdateChanged > getUpdateThrottleActiveToInactive())) {
ticksSinceUpdateChanged = 0;
couldUpdate = canUpdate;

View File

@@ -17,6 +17,16 @@ public class NetworkNodeRelay extends NetworkNode {
this.redstoneMode = RedstoneMode.LOW;
}
@Override
protected int getUpdateThrottleInactiveToActive() {
return 0;
}
@Override
protected int getUpdateThrottleActiveToInactive() {
return 0;
}
@Override
public int getEnergyUsage() {
return getRedstoneMode() == RedstoneMode.IGNORE ? 0 : RS.INSTANCE.config.relayUsage;