Repository for the saturn_moon_dimension mod.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

init.lua 4.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. --SKY--
  2. --Version 0.2
  3. pos = {x=0, y=0, z=0}
  4. local space = 2000 --value for space, change the value to however you like.
  5. --The skybox for space, feel free to change it to however you like.
  6. local spaceskybox = {
  7. "sky_pos_y.png^[transform3",
  8. "sky_neg_y.png^[transform1",
  9. "sky_pos_z.png",
  10. "sky_neg_z.png",
  11. "sky_neg_x.png",
  12. "sky_pos_x.png",
  13. }
  14. local time = 0
  15. minetest.register_globalstep(function(dtime)
  16. time = time + dtime
  17. if time > 1 then for _, player in ipairs(minetest.get_connected_players()) do
  18. time = 0
  19. local name = player:get_player_name()
  20. local pos = player:getpos()
  21. --If the player has reached Space
  22. if minetest.get_player_by_name(name) and pos.y >= space then
  23. --player:set_physics_override(1, 0.6, 0.2) -- speed, jump, gravity
  24. --player:set_sky({}, "skybox", spaceskybox) -- Sets skybox
  25. player:set_clouds({density = 0})
  26. --If the player is on Earth
  27. elseif minetest.get_player_by_name(name) and pos.y < space then
  28. --player:set_physics_override(1, 1, 1) -- speed, jump, gravity [default]
  29. --player:set_sky({}, "regular", {}) -- Sets skybox, in this case it sets the skybox to it's default setting if and only if the player's Y value is less than the value of space.
  30. player:set_clouds({density = 0.4})
  31. end
  32. end
  33. end
  34. end)
  35. minetest.register_on_leaveplayer(function(player)
  36. local name = player:get_player_name()
  37. if name then
  38. player:set_sky({}, "regular", {})
  39. end
  40. end)
  41. --MAPGEN--
  42. local ores={
  43. ["default:stone_with_coal"]=200,
  44. ["default:stone_with_iron"]=400,
  45. ["default:stone_with_copper"]=500,
  46. ["default:stone_with_gold"]=2000,
  47. ["default:stone_with_mese"]=10000,
  48. ["default:stone_with_diamond"]=20000,
  49. ["default:mese"]=40000,
  50. ["default:gravel"]={chance=3000,chunk=2,}
  51. }
  52. multidimensions.clear_dimensions() -- clear all dimensions
  53. multidimensions.register_dimension("saturn_moon",{
  54. ground_ores = {--[[
  55. ["default:tree"] = 1000, -- (chance) ... spawns on ground, used by trees, grass, flowers...
  56. ["default:stone"] = {chance=1000}, -- same as above
  57. ["default:dirt_with_snow"] = { -- names will be remade to content_id
  58. chance=5000, -- chance
  59. min_heat=10, -- min heat
  60. max_heat=40, -- max heat
  61. chunk=3, -- chunk size
  62. },
  63. ]]},
  64. stone_ores = table.copy(ores), -- works as above, but in stone
  65. dirt_ores = table.copy(ores),
  66. grass_ores = {},
  67. air_ores = {},
  68. water_ores = {},
  69. sand_ores = {},
  70. self = {}, -- can contain everything, var like dirt="default:dirt" will be remade to dirt=content_id
  71. dim_y = 2000, -- dimension start (don't change if you don't know what you're doing)
  72. dim_height = 1000, -- dimension height
  73. dirt_start = 501, -- when dirt begins to appear (default is 501)
  74. dirt_depth = 1, -- dirt depth
  75. ground_limit = 530, -- ground y limit (ground ends here)
  76. water_depth = 8, -- depth fron ground and down
  77. enable_water = nil, -- (nil = true)
  78. terrain_density = 0.4, -- or ground density
  79. flatland = nil, -- (nil = false)
  80. teleporter = false, -- (nil = true) dimension teleporter
  81. gravity = 1, -- (1 = default) dimension gravity
  82. stone = "default:stone",
  83. dirt = "default:stone",
  84. grass = "default:gravel",
  85. air = "vacuum:vacuum",
  86. water = "vacuum:vacuum",
  87. sand = "default:gravel",
  88. bedrock = "multidimensions:bedrock", -- at dimension edges
  89. map = {
  90. offset = 0,
  91. scale = 1,
  92. spread = {x=100,y=18,z=100},
  93. seeddiff = 24,
  94. octaves = 5,
  95. persist = 0.7,
  96. lacunarity = 1,
  97. flags = "absvalue",
  98. },
  99. --[[
  100. craft = { -- teleport craft recipe
  101. {"default:obsidianbrick", "default:steel_ingot", "default:obsidianbrick"},
  102. {"default:wood","default:mese","default:wood",},
  103. {"default:obsidianbrick", "default:steel_ingot", "default:obsidianbrick"},
  104. },
  105. ]]
  106. --[[
  107. on_generate=function(self,data,id,area,x,y,z)
  108. if y <= self.dirt_start+5 then
  109. data[id] = self.air
  110. else
  111. return
  112. end
  113. return data -- to return changes
  114. end,
  115. ]]
  116. -- data: active generating area (VoxelArea)
  117. -- index: data index
  118. -- self: {dim_start, dim_end, dim_height, ground_limit, heat, humidity, dirt, stone, grass, air, water, sand, bedrock ... and your inputs
  119. ----area: (VoxelArea:new({MinEd...})
  120. --sky = {{r=219, g=168, b=117},"plain",{}}, -- same as:set_sky()
  121. sky = {{}, "skybox", spaceskybox}, -- same as:set_sky()
  122. on_enter=function(player) --on enter dimension
  123. end,
  124. on_leave=function(player) --on leave dimension
  125. end,
  126. })