Move main mapgen code into new mod

This commit is contained in:
Wuzzy 2017-02-17 00:09:05 +01:00
parent 24a6a1edf0
commit 425ec6774d
5 changed files with 11 additions and 8 deletions

View File

@ -1,6 +1,8 @@
# MineClone 2 # MineClone 2
A Minecraft-like game for Minetest. Forked from MineClone by daredevils. A Minecraft-like game for Minetest. Forked from MineClone by daredevils.
Version: 0.10.0
### Gameplay ### Gameplay
You start in a randomly-generated world made entirely of cubes. You can explore You start in a randomly-generated world made entirely of cubes. You can explore
the world and dig and build almost every block in the world to create new the world and dig and build almost every block in the world to create new

View File

@ -25,4 +25,3 @@ dofile(minetest.get_modpath("mcl_core").."/nodes.lua")
dofile(minetest.get_modpath("mcl_core").."/tools.lua") dofile(minetest.get_modpath("mcl_core").."/tools.lua")
dofile(minetest.get_modpath("mcl_core").."/craftitems.lua") dofile(minetest.get_modpath("mcl_core").."/craftitems.lua")
dofile(minetest.get_modpath("mcl_core").."/crafting.lua") dofile(minetest.get_modpath("mcl_core").."/crafting.lua")
dofile(minetest.get_modpath("mcl_core").."/mapgen.lua")

View File

@ -0,0 +1 @@
mcl_core

View File

@ -1,9 +1,9 @@
-- mods/default/mapgen.lua
-- --
-- Aliases for map generator outputs -- Aliases for map generator outputs
-- --
mcl_mapgen_core = {}
minetest.register_alias("mapgen_air", "air") minetest.register_alias("mapgen_air", "air")
minetest.register_alias("mapgen_stone", "mcl_core:stone") minetest.register_alias("mapgen_stone", "mcl_core:stone")
minetest.register_alias("mapgen_tree", "mcl_core:tree") minetest.register_alias("mapgen_tree", "mcl_core:tree")
@ -259,7 +259,7 @@ minetest.register_ore({
y_max = -50, y_max = -50,
}) })
function mcl_core.generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, y_min, y_max) function mcl_mapgen_core.generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, y_min, y_max)
minetest.log('action', "WARNING: mcl_core.generate_ore is deprecated") minetest.log('action', "WARNING: mcl_core.generate_ore is deprecated")
if maxp.y < y_min or minp.y > y_max then if maxp.y < y_min or minp.y > y_max then
@ -301,7 +301,7 @@ function mcl_core.generate_ore(name, wherein, minp, maxp, seed, chunks_per_volum
--print("generate_ore done") --print("generate_ore done")
end end
function mcl_core.make_reeds(pos, size) function mcl_mapgen_core.make_reeds(pos, size)
for y=0,size-1 do for y=0,size-1 do
local p = {x=pos.x, y=pos.y+y, z=pos.z} local p = {x=pos.x, y=pos.y+y, z=pos.z}
local nn = minetest.get_node(p).name local nn = minetest.get_node(p).name
@ -314,7 +314,7 @@ function mcl_core.make_reeds(pos, size)
end end
end end
function mcl_core.make_cactus(pos, size) function mcl_mapgen_core.make_cactus(pos, size)
for y=0,size-1 do for y=0,size-1 do
local p = {x=pos.x, y=pos.y+y, z=pos.z} local p = {x=pos.x, y=pos.y+y, z=pos.z}
local nn = minetest.get_node(p).name local nn = minetest.get_node(p).name
@ -385,7 +385,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
local z = pr:next(z0, z1) local z = pr:next(z0, z1)
if minetest.get_node({x=x,y=1,z=z}).name == "mcl_core:dirt_with_grass" and if minetest.get_node({x=x,y=1,z=z}).name == "mcl_core:dirt_with_grass" and
minetest.find_node_near({x=x,y=1,z=z}, 1, "mcl_core:water_source") then minetest.find_node_near({x=x,y=1,z=z}, 1, "mcl_core:water_source") then
mcl_core.make_reeds({x=x,y=2,z=z}, pr:next(2, 4)) mcl_mapgen_core.make_reeds({x=x,y=2,z=z}, pr:next(2, 4))
end end
local p = {x=x,y=1,z=z} local p = {x=x,y=1,z=z}
if minetest.get_node(p).name == "mcl_core:sand" then if minetest.get_node(p).name == "mcl_core:sand" then
@ -426,7 +426,7 @@ minetest.register_on_generated(function(minp, maxp, seed)
end end
-- If sand, make cactus -- If sand, make cactus
if ground_y and minetest.get_node({x=x,y=ground_y,z=z}).name == "mcl_core:sand" then if ground_y and minetest.get_node({x=x,y=ground_y,z=z}).name == "mcl_core:sand" then
mcl_core.make_cactus({x=x,y=ground_y+1,z=z}, pr:next(3, 4)) mcl_mapgen_core.make_cactus({x=x,y=ground_y+1,z=z}, pr:next(3, 4))
end end
end end
end end

View File

@ -0,0 +1 @@
name = mcl_mapgen_core