Kulgan_Starkk

smelteryController

Apr 1st, 2014
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. -- arg1=basin/table, arg2=(1)numberOfPulsesPerHarvest, arg3=(1)numberOfHarvests
  2. -- (#)=defaultValue
  3. tArgs = {...}
  4.  
  5. -- setting the variables to the value of the argument passed, or 1 if no argument passed.
  6. pulses = tArgs[2] or 1
  7. harvests = tArgs[3] or 1
  8.  
  9. -- function which pulses redstone with a delay appropriate to the depth of the cast, 5 seconds base time for pouring and cooling and extracting one unit, an additional 1.11 seconds for each unit to be poured
  10. local function castTable(depth)
  11. for i=1,pulses do
  12. redstone.setOutput("bottom", true)
  13. sleep(2)
  14. redstone.setOutput("bottom", false)
  15. if depth < 2 then
  16. sleep(5)
  17. else
  18. sleep(5+(1.11*depth))
  19. end
  20. end
  21.  
  22. -- function which pulses redstone with a delay appropriate to the depth of the basin (9 units)
  23. local function castBasin()
  24. for i=1,pulses do
  25. redstone.setOutput("bottom", true)
  26. sleep(2)
  27. redstone.setoutput("bottom", false)
  28. sleep(15)
  29. end
  30. end
  31.  
  32. -- loop which calls the appropriate function as many times as requested by the parameter
  33. for i=1, harvests do
  34. if tArgs[1] == 't' then
  35. castTable()
  36. elseif tArgs[1] == 'b' then
  37. castBasin()
  38. else
  39. print("Invalid First Parameter")
  40. end
  41. end
Advertisement
Add Comment
Please, Sign In to add comment