room.lua 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. local room = {"a","a","a","a","a","a","a","a","a",
  2. "a","c","a","c","a","c","a","c","a",
  3. "a","s","a","s","a","s","a","s","a",
  4. "a","a","a","a","a","a","a","a","a",
  5. "a","a","a","a","a","a","a","a","a",
  6. "a","a","a","a","a","a","a","a","a",
  7. "a","s","a","s","a","s","a","s","a",
  8. "a","c","a","c","a","c","a","c","a",
  9. "a","a","a","a","a","a","a","a","a"}
  10. local code = {}
  11. code["s"] = "ocean:prismarine_bricks"
  12. code["eye"] = "ocean:sea_lantern"
  13. code["men"] = "ocean:sea_lantern"
  14. code["sun"] = "ocean:sea_lantern"
  15. code["b"] = "ocean:prismarine"
  16. code["a"] = "water_source"
  17. code["c"] = "water_source"
  18. code["l"] = "sponge:sponge"
  19. code["t"] = "ocean:prismarine"
  20. local function replace(str,iy)
  21. if iy == 0 and str == "s" then str = "sun" end
  22. if iy == 3 and str == "s" then str = "men" end
  23. return code[str]
  24. end
  25. function ocean.make_room(pos)
  26. local loch = {x=pos.x+7,y=pos.y+5, z=pos.z+7}
  27. for iy=0,4,1 do
  28. for ix=0,8,1 do
  29. for iz=0,8,1 do
  30. local n_str = room[tonumber(ix*9+iz+1)]
  31. if n_str == "c" and iy > 2 then
  32. if iy == 4 then
  33. minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name="default:goldblock"})
  34. else
  35. minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name="ocean:dark_prismarine"})
  36. end
  37. else
  38. minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name=replace(n_str,iy)})
  39. if n_str == "a" and math.random(1,30) > 29 then
  40. minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name="sponge:soggy_sponge"})
  41. end
  42. end
  43. end
  44. end
  45. end
  46. end
  47. local pillars = {"x","x","x"," "," "," ","x","x","x"," "," "," ","x","x","x"," "," "," ","x","x","x"}
  48. function ocean.make_pillars(pos)
  49. for iy=1,24,1 do
  50. for ix=1,21,1 do
  51. for iz=1,21,1 do
  52. if pillars[ix] == "x" and pillars[iz] == "x" then
  53. minetest.set_node({x=pos.x+ix,y=pos.y-iy,z=pos.z+iz}, {name="ocean:prismarine_bricks"})
  54. end
  55. end
  56. end
  57. end
  58. end