G2A Many GEOs
SHARE
TWEET

buildTest

kssr3951 Mar 2nd, 2015 (edited) 215 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- -------------------------------
  2. -- buildTest
  3. -- -------------------------------
  4. SLOT_COBBLESTONE = 1
  5. SLOT_HALFBLOCK   = 2
  6. SLOT_DIRT        = 3
  7. SLOT_TORCH       = 4
  8. SLOT_SAPLING     = 5
  9. SLOT_CHEST       = 6
  10. SLOT_WOOD        = 7
  11. SLOT_WORKBENCH   = 8
  12. SLOT_FURNACE     = 9
  13. -- -------------------------------
  14. -- utilities
  15. -- -------------------------------
  16. os.loadAPI("/apis/ut")
  17. -- -------------------------------
  18. -- my turtle
  19. -- -------------------------------
  20. os.loadAPI("/apis/myturtle")
  21. -- -------------------------------
  22. -- turtle construction modules
  23. -- -------------------------------
  24. os.loadAPI("/apis/tcmodules")
  25. -- -------------------------------
  26. -- builder
  27. -- -------------------------------
  28. os.loadAPI("/apis/builderapi")
  29. -- -------------------------------
  30. -- application data
  31. -- -------------------------------
  32. local buildData = {
  33.   modDef = { T = tcmodules.MODS.treeUnit,
  34.              U = tcmodules.MODS.treeUnit3,
  35.              B = tcmodules.MODS.miningBase2,
  36.              C = tcmodules.MODS.charcoalHut,
  37.              S = tcmodules.MODS.treeUnitStart },
  38.   dimension = 3,
  39.   meshSize = { x = 8, z = 8, y = 12 },
  40.   size = { x = 5, z = 3, y = 6 },
  41.   map = {{"- C<T^T^T^", "- - T^T^T^", "- - T^T^T^", "- - T^T^T^", "- - T^T^T^", "- - T^T^T^" },
  42.          {"B<B^T^T^T^", "- - T^T^T^", "- - T^T^T^", "- - T^T^T^", "- - T^T^T^", "- - T^T^T^" },
  43.          {"BvB>U^T^T^", "- - S^T^T^", "- - U^T^T^", "- - U^T^T^", "- - U^T^T^", "- - U^T^T^" }}
  44. }
  45. local LOCATION_FUEL               = { x = 0, z = -2, y = 1 }
  46. local LOCATION_BUILDING_MATERIALS = { x = 2, z = -2, y = 1 }
  47. -- -------------------------------
  48. -- event handler builder api
  49. -- -------------------------------
  50. local function reloadBuildingMaterials(myT)
  51.   local myT2 = myturtle.MyTurtle.copy(myT)
  52.   local locBM = LOCATION_BUILDING_MATERIALS
  53.   myT2:moveTo(locBM.x, locBM.z)
  54.   myT2:adjustY(locBM.y)
  55.   myturtle.refuelPrompt()
  56.   myT2:adjustY(myT.turtleY)
  57.   myT2:moveTo(myT.turtleX, myT.turtleZ)
  58.   myT2:turnTo(myT.turtleDir)
  59.   return true
  60. end
  61. local function checkFuelLevelAndRefuel(myT)
  62.   -- mataasita
  63.   return true
  64. end
  65. -- -------------------------------
  66. -- main
  67. -- -------------------------------
  68. ut.debug("==========================================")
  69. ut.debug("== buildTest.lua begin !!")
  70. ut.debug("==========================================")
  71. local slotMap = { }
  72. slotMap[tcmodules.RES.cobblestone] = SLOT_COBBLESTONE
  73. slotMap[tcmodules.RES.halfBlock]   = SLOT_HALFBLOCK
  74. slotMap[tcmodules.RES.dirt]        = SLOT_DIRT
  75. slotMap[tcmodules.RES.torch]       = SLOT_TORCH
  76. slotMap[tcmodules.RES.sapling]     = SLOT_SAPLING
  77. slotMap[tcmodules.RES.chest]       = SLOT_CHEST
  78. slotMap[tcmodules.RES.woodPlank]   = SLOT_WOOD
  79. slotMap[tcmodules.RES.workbench]   = SLOT_WORKBENCH
  80. slotMap[tcmodules.RES.furnace]     = SLOT_FURNACE
  81. local bldr = builderapi.Builder.new()
  82. bldr.event.lackOfBuildingMaterialFunction = reloadBuildingMaterials
  83. bldr.event.checkFuelLevelFunction = checkFuelLevelAndRefuel
  84. bldr:build(buildData, slotMap)
  85.  
  86.  
  87.  
  88. -- gomi
  89. --[[
  90. local buildData = {
  91.   modDef = { C = tcmodules.MODS.chestsL, D = tcmodules.MODS.chestsR,
  92.              F = tcmodules.MODS.furnace, L = tcmodules.MODS.gateL,
  93.              R = tcmodules.MODS.gateR,   M = tcmodules.MODS.milestone },
  94.   dimension = 2,
  95.   map = {
  96.     "C<D>",
  97.     "C<D>",
  98.     "F<F>",
  99.     "L^R^" } -- "L^R^M^"
  100. }
  101. local buildData = {
  102.   modDef = { T = tcmodules.MODS.test },
  103.   dimension = 2,
  104.   meshSize = { x = 2, z = 2, y = 2 },
  105.   map = { "T<T^",
  106.           "TvT>" }
  107. --  map = { "T>Tv",
  108. --          "T^T<" }
  109. }
  110. local buildData = {
  111.   modDef = { T = tcmodules.MODS.treeUnit },
  112.   dimension = 2,
  113.   meshSize = { x = 8, z = 8, y = 12 },
  114. --  map = { "T<T^",
  115. --          "TvT>" }
  116. --  map = { "T>Tv",
  117. --          "T^T<" }
  118.   map = { "T^T^",
  119.           "T^T^",
  120.           "T^T^",
  121.           "T^T^" }
  122. }
  123. local buildData = {
  124.   size = { x = 2, z = 2, y = 2 },
  125.   modDef = { T = tcmodules.MODS.test },
  126.   dimension = 3,
  127.   meshSize = { x = 2, z = 2, y = 2 },
  128.   map = {{ "T<T^", "T>Tv" },
  129.          { "TvT>", "T^T<" }}
  130. }
  131. local buildData = {
  132.   size = { x = 2, z = 2, y = 2 },
  133.   modDef = { T = tcmodules.MODS.treeUnit2 },
  134.   dimension = 3,
  135.   meshSize = { x = 8, z = 8, y = 12 },
  136. --  map = { "T<T^",
  137. --          "TvT>" }
  138. --  map = { "T>Tv",
  139. --          "T^T<" }
  140.   map = {{ "T^T^", "T^T^" },
  141.          { "T^T^", "T^T^" }}
  142. }
  143. local buildData = {
  144.   size = { x = 1, z = 1, y = 4 },
  145.   modDef = { T = tcmodules.MODS.treeUnit3 },
  146.   dimension = 3,
  147.   meshSize = { x = 8, z = 8, y = 12 },
  148.   map = {{ "T^", "T^", "T^", "T^" }}
  149. }
  150. local buildData = {
  151.   size = { x = 1, z = 1, y = 1 },
  152.   modDef = { M = tcmodules.MODS.chestsM },
  153.   dimension = 3,
  154.   meshSize = { x = 2, z = 2, y = 4 },
  155.   map = {{ "M^" }}
  156. }
  157. local buildData = {
  158.   modDef = { T = tcmodules.MODS.treeUnit, U = tcmodules.MODS.treeUnit3 },
  159.   dimension = 3,
  160.   meshSize = { x = 8, z = 8, y = 12 },
  161. -- [ [
  162.   size = { x = 4, z = 4, y = 8 },
  163.   map = {{ "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^" },
  164.          { "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^" },
  165.          { "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^", "T^T^T^T^" },
  166.          { "U^T^T^T^", "U^T^T^T^", "U^T^T^T^", "U^T^T^T^", "U^T^T^T^", "U^T^T^T^", "U^T^T^T^", "U^T^T^T^" }}
  167.   size = { x = 1, z = 1, y = 1 },
  168.   map = {{"T^"}}        
  169. -- ] ]
  170.   size = { x = 3, z = 3, y = 4 },
  171.   map = {{"T^T^T^", "T^T^T^", "T^T^T^", "T^T^T^" },
  172.          {"T^T^T^", "T^T^T^", "T^T^T^", "T^T^T^" },
  173.          {"U^T^T^", "U^T^T^", "U^T^T^", "U^T^T^" }}
  174. }
  175. local LOCATION_FUEL               = { x = 0, z = -2, y = 1 }
  176. local LOCATION_BUILDING_MATERIALS = { x = 2, z = -2, y = 1 }
  177. -- -------------------------------
  178. -- event handler builder api
  179. -- -------------------------------
  180. local function reloadBuildingMaterials(myT)
  181.   local myT2 = myturtle.MyTurtle.copy(myT)
  182.   local locBM = LOCATION_BUILDING_MATERIALS
  183.   myT2:moveTo(locBM.x, locBM.z)
  184.   myT2:adjustY(locBM.y)
  185.   myturtle.refuelPrompt()
  186.   myT2:adjustY(myT.turtleY)
  187.   myT2:moveTo(myT.turtleX, myT.turtleZ)
  188.   myT2:turnTo(myT.turtleDir)
  189.   return true
  190. end
  191. local function checkFuelLevelAndRefuel(myT)
  192.   -- mataasita
  193.   return true
  194. end
  195.  
  196. local reloadBuildingMaterials = function(myT)
  197. if nil == myT then error("here1") end
  198.   local myT2 = myturtle.MyTurtle.copy(myT)
  199.   local locBM = LOCATION_BUILDING_MATERIALS
  200.   myT2:moveTo(locBM.x, locBM.z)
  201.   myT2:adjustY(locBM.y)
  202.   myturtle.refuelPrompt()
  203.   myT2:adjustY(myT.turtleY)
  204.   myT2:moveTo(myT.turtleX, myT.turtleZ)
  205.   return true
  206. end
  207. local checkFuelLevelAndRefuel = function(myT)
  208. if nil == myT then error("here2") end
  209.   -- mataasita
  210.   return true
  211. end
  212. --]]
RAW Paste Data
Ledger Nano X - The secure hardware wallet
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top