Maked redstone i/o block properly wake computers. Closes #1007.

This commit is contained in:
Florian Nücke 2015-04-02 23:02:32 +02:00
parent 681f1f0543
commit 02b9c48603
2 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,7 @@ class Redstone extends Environment with BundledRedstoneAware {
new component.Redstone.Bundled(this)
else
new component.Redstone.Vanilla(this)
instance.wakeNeighborsOnly = false
val node = instance.node
val dummyNode = if (node != null) {
node.setVisibility(Visibility.Network)

View File

@ -15,6 +15,8 @@ trait RedstoneSignaller extends prefab.ManagedEnvironment {
var wakeThreshold = 0
var wakeNeighborsOnly = true
// ----------------------------------------------------------------------- //
@Callback(direct = true, doc = """function():number -- Get the current wake-up threshold.""")
@ -32,7 +34,10 @@ trait RedstoneSignaller extends prefab.ManagedEnvironment {
def onRedstoneChanged(side: AnyRef, oldMaxValue: Int, newMaxValue: Int): Unit = {
node.sendToReachable("computer.signal", "redstone_changed", side, int2Integer(oldMaxValue), int2Integer(newMaxValue))
if (oldMaxValue < wakeThreshold && newMaxValue >= wakeThreshold) {
node.sendToNeighbors("computer.start")
if (wakeNeighborsOnly)
node.sendToNeighbors("computer.start")
else
node.sendToReachable("computer.start")
}
}