Advertisement
DoddyLeSel

PortiqueBois

Feb 25th, 2025 (edited)
339
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.42 KB | Gaming | 0 0
  1. rednet.open("right")
  2.  
  3. station = peripheral.wrap("left")
  4. relay = peripheral.wrap("redstone_relay_2")
  5.  
  6. local function gantry(gantry_bool)
  7.     relay.setOutput("back", gantry_bool)
  8. end
  9.  
  10. local function gearshift(gearshift_bool)
  11.     relay.setOutput("front", gearshift_bool)
  12. end
  13.  
  14. local function clutch(clutch_bool)
  15.     relay.setOutput("left", clutch_bool)
  16. end
  17.  
  18. local function sequenced_impulse()
  19.     relay.setOutput("right", true)
  20.     sleep(0.1)
  21.     relay.setOutput("right", false)
  22. end
  23.  
  24. local function grab()
  25.     --attrape le wagon et le remonte
  26.     clutch(true)
  27.     gantry(true)
  28.     gearshift(false)
  29.     clutch(false)
  30.     sleep(2)
  31.     gearshift(true)
  32.     sleep(2)
  33.     clutch(true)
  34. end
  35.  
  36. local function put()
  37.     --pose le wagon
  38.     clutch(true)
  39.     gantry(true)
  40.     gearshift(false)
  41.     clutch(false)
  42.     sleep(2)
  43.     rednet.send(rednet.lookup("Portique", "PortiquePulleyTurtle"), "dig", "Portique")
  44.     clutch(true)
  45. end
  46.  
  47. local function move(sens_bool)
  48.     --déplace la poulie
  49.     gantry(false)
  50.     gearshift(not sens_bool)
  51.     sequenced_impulse()
  52.     sleep(2)
  53. end
  54.  
  55. local function bois()
  56.     grab()
  57.     move(true)
  58.     move(true)
  59.     --put()
  60. end
  61.    
  62. while true do  
  63.     if station.isTrainPresent() then
  64.         train_name = station.getTrainName()
  65.            
  66.         if train_name == "Bois" then
  67.             sleep(1)
  68.             station.disassemble()
  69.             bois()
  70.         end
  71.     end
  72.     sleep(0.5)
  73. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement