Kulgan_Starkk

smelteryController

Apr 3rd, 2014
56
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.  
  4. -- Global Configuration Variables...
  5.  
  6. -- Side of the Computer to which the faucet is adjacent
  7. fSide = "bottom"
  8.  
  9. tArgs = {...}
  10.  
  11. -- setting the variables to the value of the argument passed, or 1 if no argument passed.
  12. pulses = tArgs[2] or 1
  13. harvests = tArgs[3] or 1
  14.  
  15. -- 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
  16. local function castTable(depth)
  17. for i=1,pulses do
  18. redstone.setOutput(fSide, true)
  19. sleep(2)
  20. redstone.setOutput(fSide, false)
  21. if depth < 2 then
  22. sleep(5)
  23. else
  24. sleep(5+(1.11*depth))
  25. end
  26. end
  27. end
  28.  
  29. -- function which pulses redstone with a delay appropriate to the depth of the basin (9 units)
  30. local function castBasin()
  31. for i=1,pulses do
  32. redstone.setOutput(fSide, true)
  33. sleep(2)
  34. redstone.setOutput(fSide, false)
  35. sleep(15)
  36. end
  37. end
  38.  
  39. -- loop which calls the appropriate function as many times as requested by the parameter
  40. for i=1, harvests do
  41. if tArgs[1] == 't' then
  42. castTable()
  43. elseif tArgs[1] == 'b' then
  44. castBasin()
  45. else
  46. print("Invalid Parameters")
  47. print("arg1=basin/table, arg2=(1)numberOfPulsesPerHarvest, arg3=(1)numberOfHarvests")
  48. end
  49. end
Advertisement
Add Comment
Please, Sign In to add comment