Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
  • 0

Immersive Railroading Stop Program


I have a program that is supposed to stop the trains of IR, the problem is that the error is displayed to me when a train runs through the adapter that is connected to the augment

local component = require("component")
local event = require("event")
local sides = require("sides")

local rs = component.redstone

-- The address of the first controller, ahead of the big speed brakes.
local slowdown_ctl = component.proxy("c6a0f834-b756-4393-8880-449b53d88d66")

-- The address of the redstone IO that activates the big speed brakes.
local slowdown_rs = component.proxy("016d9978-9339-43fd-94c3-8098e560dc89")

-- The address of the second controller that stops the train at the end.
local stop_ctl = component.proxy("9edded78-88b4-4828-9016-db76f7df1868")

-- The address of the redstone IO that activates the secondary speed retarders.
local stop_rs = component.proxy("5c8909d6-ee19-4bc9-b196-c4ac8607242f")

while true do
  print("Waiting for train...")
  event_name, address, augment_type, stock_uuid = event.pull("ir_train_overhead")
  if augment_type == "LOCO_CONTROL" and address == slowdown_ctl.address then
    print("Enabling speed retarders, reducing throttle, and preparing stopping area.")
    -- Note: Depending on where you place your IO block, you may need a different side.
    slowdown_rs.setOutput(sides.north, 15)
    stop_rs.setOutput(sides.up, 15)
    print("Waiting 10 seconds for train to come to a complete stop.")
    print("Disabling speed retarders.")
    slowdown_rs.setOutput(sides.north, 0)
  elseif augment_type == "LOCO_CONTROL" and address == stop_ctl.address then
    print("Train has reached stopping point. Braking and setting throttle to 0.")
    -- Once again, you may need to specify a different side.
    stop_rs.setOutput(sides.up, 0)
    print("Waiting a few seconds for train to stop.")
    print("Disabling brakes.")
    print("Brakes disabled. Train is ready.")



Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use and Privacy Policy.