mirror of
https://github.com/MightyPirates/OpenComputers.git
synced 2025-09-19 04:06:43 -04:00
Maked redstone i/o block properly wake computers. Closes #1007.
This commit is contained in:
parent
681f1f0543
commit
02b9c48603
@ -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)
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user