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 ### 1.5.3
- Fixed Solderer crashing (raoulvdberge) - Fixed Solderer crashing (raoulvdberge)
- The Portable Grid now exposes an inventory for interaction with other mods or vanilla (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 ### 1.5.2
- Fixed a bug where loading nodes would abort when a single node has an error while reading (raoulvdberge) - 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); return redstoneMode.isEnabled(world, pos);
} }
protected int getUpdateThrottleInactiveToActive() {
return 20;
}
protected int getUpdateThrottleActiveToInactive() {
return 4;
}
@Override @Override
public void update() { public void update() {
++ticks; ++ticks;
@@ -98,9 +106,7 @@ public abstract class NetworkNode implements INetworkNode, INetworkNodeVisitor,
if (couldUpdate != canUpdate) { if (couldUpdate != canUpdate) {
++ticksSinceUpdateChanged; ++ticksSinceUpdateChanged;
// If we go from inactive to active, throttle for 20 ticks if (canUpdate ? (ticksSinceUpdateChanged > getUpdateThrottleActiveToInactive()) : (ticksSinceUpdateChanged > getUpdateThrottleActiveToInactive())) {
// If we go from active to inactive, throttle for 4 ticks
if (canUpdate ? (ticksSinceUpdateChanged > 20) : (ticksSinceUpdateChanged > 4)) {
ticksSinceUpdateChanged = 0; ticksSinceUpdateChanged = 0;
couldUpdate = canUpdate; couldUpdate = canUpdate;

View File

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