Advertisement
Kulgan_Starkk

smelteryController

Apr 1st, 2014
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. end
  22.  
  23. -- function which pulses redstone with a delay appropriate to the depth of the basin (9 units)
  24. local function castBasin()
  25. for i=1,pulses do
  26. redstone.setOutput("bottom", true)
  27. sleep(2)
  28. redstone.setOutput("bottom", false)
  29. sleep(15)
  30. end
  31. end
  32.  
  33. -- loop which calls the appropriate function as many times as requested by the parameter
  34. for i=1, harvests do
  35. if tArgs[1] == 't' then
  36. castTable()
  37. elseif tArgs[1] == 'b' then
  38. castBasin()
  39. else
  40. print("Invalid Parameters")
  41. print("arg1=basin/table, arg2=(1)numberOfPulsesPerHarvest, arg3=(1)numberOfHarvests")
  42. end
  43. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement