Advertisement
Inksaver

MobSoftenerSetup

Jun 25th, 2023 (edited)
809
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.00 KB | Source Code | 0 0
  1. version = 20230625.1400
  2. --[[
  3. https://pastebin.com/AbYQMD5H
  4. MobSoftenerSetup
  5. Designed for use with MobSoftenerStartup
  6. and dungeon spawners
  7.  ]]
  8. kb = require "lib.menu"
  9.  
  10. local messages =
  11. {
  12. [[              Setup page 1 of 2:
  13.  
  14. Mob lava softener using 2 sticky pistons
  15.  
  16. Note your layout (Left or Right)
  17.  
  18. Dispenser on RIGHT       or       LEFT of Computer
  19.  
  20. | | |*| |*| |   P = Sticky Piston   | |*| |*| | |
  21. | |P|S| |*| |   S = Slab            | |*| |S|P| |
  22. | |C|D| |*| |   C = Computer        | |*| |D|C| |
  23. | |P|S| |*| |   D = Dispenser       | |*| |S|P| |
  24. | | | | |*| |   * = Stone           | |*| | | | |
  25. | | | |H| | |   H = Hopper          | | |H| | | |
  26. | | | |p| | |   p = Pressure Plate  | | |p| | | |
  27.  
  28.  
  29. Press Enter to see next page...]],
  30. [[              Setup page 2 of 2:
  31.  
  32. Mob lava softener using 4 normal pistons
  33.  
  34. Note your layout (Left or Right)
  35.  
  36. Dispenser on RIGHT       or       LEFT of Computer
  37.  
  38. | | |*| |*| |   P = Regular Piston  | |*| |*| | |
  39. | |P|S| |P| |   S = Slab            | |P| |S|P| |
  40. | |C|D| |C| |   C = Computer        | |C| |D|C| |
  41. | |P|S| |P| |   D = Dispenser       | |P| |S|P| |
  42. | | | | |*| |   * = Stone           | |*| | | | |
  43. | | | |H| | |   H = Hopper          | | |H| | | |
  44. | | | |p| | |   p = Pressure Plate  | | |p| | | |
  45.  
  46.  
  47. Press Enter to Continue]]
  48. }
  49.  
  50. local function intro()
  51.     kb.clear()
  52.     kb.colourPrint(messages[1])
  53.     read()
  54.     kb.clear()
  55.     kb.colourPrint(messages[2])
  56.     read()
  57. end
  58.  
  59. local function getPistonType()
  60.     choice = kb.menu("Piston Type?", {"2 Sticky  pistons with 1 computer", "4 Regular pistons with 2 computers"})
  61.     return choice
  62. end
  63.  
  64. local function getLayout()
  65.     choice = kb.menu("Computer / Dispenser layout?", {"Lava Dispenser on right side of computer", "Lava Dispenser on left side of computer"})
  66.     return choice
  67. end
  68.  
  69. local function getComputerType()
  70.     --kb.clear()
  71.     choice = kb.menu("What computer am I...?", {"pressure plate activated server", "passive client"})
  72.     return choice
  73. end
  74.  
  75. local function writeConfig(computerType, layout, pistonType)
  76.     kb.clear()
  77.     local h = fs.open("config.txt", "w")
  78.     h.writeLine(computerType)   -- "single, "server", "client"
  79.     print("Computer     "..computerType)
  80.     h.writeLine(layout)
  81.     print("Layout       "..layout)
  82.     h.writeLine(pistonType)     -- 1 = sticky, 2 = normal
  83.     print("Piston       "..pistonType)
  84.     h.close()
  85.     print("Config.txt file written")
  86. end
  87.  
  88. local function main()
  89.     local pistonTypes = {"sticky", "regular"}
  90.     local computerTypes = {"single", "server", "client"}
  91.     local layouts = {"right", "left"}
  92.     local computerType = computerTypes[1] -- default for use with 2 sticky pistons "single"
  93.    
  94.     intro()                         -- display Left and Right layouts
  95.     local pistonType = pistonTypes[getPistonType()]     -- "sticky", "regular"
  96.     local layout = layouts[getLayout()]                 -- "left", "right"
  97.    
  98.     if pistonType == "regular" then         -- normal piston x 4, 2 computer
  99.         computerType = computerTypes[getComputerType() + 1]
  100.     end
  101.     writeConfig(computerType, layout, pistonType) -- eg "single", "left", "sticky"
  102. end
  103.  
  104. main()
  105.  
  106.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement