OpenComputers II

OpenComputers II

27.1k Downloads

Redstone interface receiving functionality always returns zero.

IpsumCapra opened this issue · 8 comments

commented

The issue

Using the getRedstoneInput(Side side) of a redstone device always returns zero.

Terminal output
2022-03-28_22 22 55

Setup
2022-03-28_22 22 59

How to reproduce

  • Get a preconfigured computer, attach a Redstone Interface (Card).
  • Give the computer power, (i.e. attach an infinite energy source).
  • Create a redstone signal on top of PC. In the example images it's a fully powered redstone cross.
  • Login with the root account.
  • Open the Lua console. (lua command)
  • Enter: require("devices"):find("redstone"):getRedstoneInput("up").
  • It returns 0.0. Expected output is 15.0.

Expected behavior

When running the getRedstoneInput(Side side) function, the correct signal strength on the given side should be returned.

commented

Does this also happen with a redstone block sitting on top? Might be a quirk of redstone. Do redstone lamps light up when in the place of the computer in this setup?

commented

I wonder what causes it, I checked the code, The detecting function is there. It seems to always return 0 because of some cases, perhaps something is triggering those...

commented

AFAICT this seems to happen with redstone interface blocks, too, not just the cards.

commented

I had noticed as much. That's why i put 'card' in parentheses.

commented

Ah OK, I wasn’t sure whether that was meant to be the “also” use of parentheses (i.e. happens with both) or the “clarifying” use of parentheses (i.e. happens only with the card).

commented

I actually forked oc2 to try and fix this problem, would you mind if i took it on @fnuecke?

commented

I have also tested it with redstone blocks, thought it might be the problem, that's why i switched to a redstone cross.

commented

The code seems to be stopping at this block. (I made it log from where it gets the value.)

if (!level.hasChunk(chunkPos.x, chunkPos.z)) {
    Main.logger.info("Stop 3");
    return 0;
}