Signals icon indicating copy to clipboard operation
Signals copied to clipboard

OpenComputers integration

Open Garagoth opened this issue 6 years ago • 2 comments

Hi!

Following discussion in #21:

I successfully managed to "program" cart destination using computer, redstone I/O card, transposer, and a chest and a dispenser next to transposer. So, 4 extra blocks + wiring for redstone. Transposer transfers ticket from specific slot from chest into dispenser then redstone I/O sends a pulse to dispenser.

So, a bit complicated and limited, but works - unless I mess up tickets order in a chest... but I do not have to worry about NBT changes.

To simplify that, please add OpenComputers support in station block so it appears as component (when placed on adapter). Would be nice if it could provide functions like:

  • getStation(): name, x, y, z, dimension -- return data about this station
  • getStations():table -- Would return list of stations available on this line as {{station_name, x, y, z, dimension}, ...}. Also I saw your plans in #4, maybe global list of stations could be available from there?
  • setCartDestination(names: table of strings):boolean -- sets station name as cart destination. Cart has to be next to station block of course.
  • getCartDestination():table -- gets current destinations of a cart
  • isCartPresent(): boolean -- is there is a cart next to station block
  • maybe a function to emit redstone pulse (for a configurable time), to start a cart with a nudge in proper direction (on powered rail maybe, next to station block?)
  • maybe functions to query inventory and passenger of a cart. While it is possible with OC it is a bit messy and requires another block to be placed on the other side of rail (could not place rail on it).
  • ability to send event when cart arrives at the station and leaves station, if possible.

In future maybe block signals could get some OC support as well (signal color, cart presence, events on passing carts, ...)

Regards, Garagoth.

Garagoth avatar Oct 25 '18 22:10 Garagoth

Reading some more of #4 and your comments there, I will provide some justification why it would be good to add station ability for detecting carts and reading inventories:

  • I cannot have a detector rail next to station if I want a cart to stop at the station, because for that I need unpowered golden rail.
  • Having station send events would greatly increase flexibility of system. Reacting on redstone from detector rail is possible, but redstone I/O block from OC has only 5 available sides to connect to (sixt is OC connection). Bundled cables from other mods (ProjectRed, MFR, ...) could help, but that needs another mod and a lot of wiring.

Also having more OC support (in block signals for example) would allow for station displays like: Current train leaving to: _____ Next train arriving in: ____ (estimate calculated by OC program, knowing that next cart is one or two signal blocks away)

Also, I failed in reading NBT tags from carts and tickets, looks like OC no longer exposes this data as those are private parts - a mod driver is required.

And now we only need cart chaining to form longer trains....

Garagoth avatar Oct 26 '18 11:10 Garagoth

You can enable NBT reading in the OC config.

brisingraerowing avatar Nov 12 '18 00:11 brisingraerowing