Compare commits

..

17 Commits

Author SHA1 Message Date
kay27 30ab997358 Merge pull request 'Really move mcl_stairs_stone_slab_top.png into mcl_core' (#112) from djc/MineClone5:polished-stone into master
Reviewed-on: MineClone5/MineClone5#112
2022-01-07 23:09:21 +00:00
Daniel Cassidy d0d7ebe53b Really move mcl_stairs_stone_slab_top.png into mcl_core
This is a fix for #105 where I accidentally moved it to the wrong place.
Sorry.

mcl_core uses this texture for Polished Stone (mcl_core:stone_smooth),
which means mcl_core had an undeclared dependency on mcl_stairs.

Since mcl_stairs depends on mcl_core, it makes sense to move the texture
to mcl_core.
2022-01-07 21:56:37 +00:00
kay27 0693afe869 Merge pull request 'mcl_mapgen_core: Make most dependencies optional' (#109) from djc/MineClone5:optional-deps into master
Reviewed-on: MineClone5/MineClone5#109
2022-01-06 11:07:50 +00:00
Daniel Cassidy 978f23c70e mcl_mapgen_core: Rename cocoa to c_cocoas.
This is more consistent and should hopefully be clearer.
2022-01-06 02:56:51 +00:00
Daniel Cassidy 802d214d7b mcl_mapgen_core: Make mcl_nether an optional dependency.
mcl_nether was previously an undeclared dependency of mcl_mapgen_core.
Now it is both optional and declared.
2022-01-06 02:55:33 +00:00
Daniel Cassidy a0708abb9c mcl_mapgen_core: Make mcl_mushrooms an optional dependency.
mcl_mushrooms was previously an undeclared dependency of mcl_mapgen_core.
Now it is both optional and declared.
2022-01-06 02:46:02 +00:00
Daniel Cassidy 554f22b802 mcl_mapgen_core: Make mcl_farming an optional dependency.
mcl_farming was previously an undeclared dependency of mcl_mapgen_core.
Now it is both optional and declared.
2022-01-06 02:33:04 +00:00
Daniel Cassidy 1d03a3d150 mcl_mapgen_core: Make mcl_flowers an optional dependency.
mcl_flowers was previously an undeclared dependency of mcl_mapgen_core.
Now it is both optional and declared.
2022-01-06 02:30:24 +00:00
Daniel Cassidy 7c72ce1d0d mcl_mapgen_core: Fix check for wrong mod. 2022-01-06 02:11:06 +00:00
Daniel Cassidy 2bdaa77932 mcl_mapgen_core: Make mcl_structures an optional dependency. 2022-01-06 01:20:06 +00:00
Daniel Cassidy 5cad35dbfe mcl_mapgen_core: Make mcl_stairs an optional dependency.
The "mapgen_stair" aliases are only used by v6, and even then appear to
be optional in practice, so there's no reason for mcl_mapgen_core to
require mcl_stairs.
2022-01-06 01:20:06 +00:00
Daniel Cassidy 51cdc69b99 mcl_mapgen_core: Make mcl_monster_eggs an optional dependency.
The only purpose of this dependency appears to be to force
mcl_monster_eggs to load before mcl_mapgen_core. It is not actually
used in the code.

mcl_monster_eggs is an undeclared dependency of mobs_mc_gameconfig,
mcl_biomes, and mcl_structures, all of which are either transitive
or direct dependencies of mcl_mapgen_core.

It's not possible to add a dependency on mcl_monster_eggs directly
to mobs_mc_gameconfig, because that would lead to a circular
dependency. So it seems like a dependency on mcl_monster_eggs is
declared as a dependency of mcl_mapgen_core as a workaround to
ensure that mcl_monster_eggs at least gets loaded before
mcl_mapgen_core.

I've moved mcl_monster_eggs to the optional dependencies which
should achieve the same aim without complaining if mcl_monster_eggs
is missing, but this should probably be cleaned up in future to
remove the circular dependency.
2022-01-06 01:18:40 +00:00
Daniel Cassidy b73c0e8f2c mcl_mapgen_core: Make mcl_ocean an optional dependency. 2022-01-05 21:34:56 +00:00
Daniel Cassidy 012d0bd942 mcl_mapgen_core: Make mcl_sponges an optional dependency. 2022-01-05 20:52:53 +00:00
Daniel Cassidy c52f598e64 mcl_mapgen_core: Make mcl_cocoas an optional dependency. 2022-01-05 20:46:28 +00:00
kay27 fc3dc63f01 Merge pull request 'Move texture mcl_stairs_stone_slab_top to mcl_core.' (#105) from djc/MineClone5:polished-stone into master
Reviewed-on: MineClone5/MineClone5#105
2022-01-05 03:05:20 +00:00
Daniel Cassidy af03b030a0 Move texture mcl_stairs_stone_slab_top to mcl_core.
mcl_core uses this texture for Polished Stone (mcl_core:stone_smooth),
which means mcl_core has an undeclared dependency on mcl_stairs.

Since mcl_stairs depends on mcl_core, it makes sense to move the texture
to mcl_core.
2022-01-05 02:33:31 +00:00
5 changed files with 477 additions and 471 deletions

View File

@ -214,7 +214,6 @@ end
--a function used for despawning mobs
mobs.check_for_player_within_area = function(self, radius)
local pos1 = self.object:get_pos()
if not pos1 then return end
--get players in radius
for _,player in pairs(minetest_get_connected_players()) do
if player and player:get_hp() > 0 then

View File

Before

Width:  |  Height:  |  Size: 212 B

After

Width:  |  Height:  |  Size: 212 B

View File

@ -28,7 +28,9 @@ minetest.register_alias("mapgen_clay", "mcl_core:clay")
minetest.register_alias("mapgen_lava_source", "air") -- Built-in lava generator is too unpredictable, we generate lava on our own
minetest.register_alias("mapgen_cobble", "mcl_core:cobble")
minetest.register_alias("mapgen_mossycobble", "mcl_core:mossycobble")
if minetest.get_modpath("mcl_flowers") then
minetest.register_alias("mapgen_junglegrass", "mcl_flowers:fern")
end
minetest.register_alias("mapgen_stone_with_coal", "mcl_core:stone_with_coal")
minetest.register_alias("mapgen_stone_with_iron", "mcl_core:stone_with_iron")
minetest.register_alias("mapgen_desert_sand", "mcl_core:sand")
@ -43,11 +45,14 @@ minetest.register_alias("mapgen_snow", "mcl_core:snow")
minetest.register_alias("mapgen_snowblock", "mcl_core:snowblock")
minetest.register_alias("mapgen_ice", "mcl_core:ice")
minetest.register_alias("mapgen_stair_cobble", "mcl_stairs:stair_cobble")
minetest.register_alias("mapgen_sandstonebrick", "mcl_core:sandstonesmooth")
if minetest.get_modpath("mcl_stairs") then
minetest.register_alias("mapgen_stair_cobble", "mcl_stairs:stair_cobble")
minetest.register_alias("mapgen_stair_sandstonebrick", "mcl_stairs:stair_sandstone")
minetest.register_alias("mapgen_stair_sandstone_block", "mcl_stairs:stair_sandstone")
minetest.register_alias("mapgen_stair_desert_stone", "mcl_stairs:stair_sandstone")
end
local mg_name = minetest.get_mapgen_setting("mg_name")
local superflat = mg_name == "flat" and minetest.get_mapgen_setting("mcl_superflat_classic") == "true"
@ -69,9 +74,16 @@ local c_sand = minetest.get_content_id("mcl_core:sand")
local c_void = minetest.get_content_id("mcl_core:void")
local c_lava = minetest.get_content_id("mcl_core:lava_source")
local c_water = minetest.get_content_id("mcl_core:water_source")
local c_soul_sand = minetest.get_content_id("mcl_nether:soul_sand")
local c_netherrack = minetest.get_content_id("mcl_nether:netherrack")
local c_nether_lava = minetest.get_content_id("mcl_nether:nether_lava_source")
local c_nether = nil
if minetest.get_modpath("mcl_nether") then
c_nether = {
soul_sand = minetest.get_content_id("mcl_nether:soul_sand"),
netherrack = minetest.get_content_id("mcl_nether:netherrack"),
lava = minetest.get_content_id("mcl_nether:nether_lava_source")
}
end
--local c_end_stone = minetest.get_content_id("mcl_end:end_stone")
local c_realm_barrier = minetest.get_content_id("mcl_core:realm_barrier")
local c_top_snow = minetest.get_content_id("mcl_core:snow")
@ -80,12 +92,18 @@ local c_clay = minetest.get_content_id("mcl_core:clay")
local c_leaves = minetest.get_content_id("mcl_core:leaves")
local c_jungleleaves = minetest.get_content_id("mcl_core:jungleleaves")
--local c_jungletree = minetest.get_content_id("mcl_core:jungletree")
local c_cocoa_1 = minetest.get_content_id("mcl_cocoas:cocoa_1")
local c_cocoa_2 = minetest.get_content_id("mcl_cocoas:cocoa_2")
local c_cocoa_3 = minetest.get_content_id("mcl_cocoas:cocoa_3")
local c_vine = minetest.get_content_id("mcl_core:vine")
local c_air = minetest.CONTENT_AIR
local c_cocoas = nil
if minetest.get_modpath("mcl_cocoas") then
c_cocoas = {
minetest.get_content_id("mcl_cocoas:cocoa_1"),
minetest.get_content_id("mcl_cocoas:cocoa_2"),
minetest.get_content_id("mcl_cocoas:cocoa_3")
}
end
--
-- Ore generation
--
@ -710,6 +728,13 @@ local function register_mgv6_decorations()
num_spawn_by = 1,
})
-- Hack to make sure certain items only spawn in jungles
local spawn_by_in_jungle = { "mcl_core:jungletree" }
if minetest.get_modpath("mcl_flowers") then
table.insert(spawn_by_in_jungle, "mcl_flowers:fern")
end
if minetest.get_modpath("mcl_flowers") then
-- Doubletall grass
minetest.register_decoration({
deco_type = "schematic",
@ -747,7 +772,7 @@ local function register_mgv6_decorations()
},
},
-- v6 hack: This makes sure large ferns only appear in jungles
spawn_by = { "mcl_core:jungletree", "mcl_flowers:fern" },
spawn_by = spawn_by_in_jungle,
num_spawn_by = 1,
place_on = {"group:grass_block_no_snow"},
@ -823,7 +848,9 @@ local function register_mgv6_decorations()
y_max = 0,
rotation = "random",
})
end
if minetest.get_modpath("mcl_farming") then
-- Pumpkin
minetest.register_decoration({
deco_type = "simple",
@ -858,14 +885,16 @@ local function register_mgv6_decorations()
persist = 0.6
},
-- Small trick to make sure melon spawn in jungles
spawn_by = { "mcl_core:jungletree", "mcl_flowers:fern" },
spawn_by = spawn_by_in_jungle,
num_spawn_by = 1,
y_min = 1,
y_max = 40,
decoration = "mcl_farming:melon",
})
end
-- Tall grass
if minetest.get_modpath("mcl_flowers") then
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass_block_no_snow"},
@ -898,8 +927,10 @@ local function register_mgv6_decorations()
y_max = mcl_vars.overworld_max,
decoration = "mcl_flowers:tallgrass",
})
end
-- Seagrass and kelp
if minetest.get_modpath("mcl_ocean") then
local materials = {"dirt","sand"}
for i=1, #materials do
local mat = materials[i]
@ -989,11 +1020,12 @@ local function register_mgv6_decorations()
param2 = 32,
param2_max = 160,
})
end
end
-- Wet Sponge
-- TODO: Remove this when we got ocean monuments
if minetest.get_modpath("mcl_sponges") then
minetest.register_decoration({
deco_type = "simple",
decoration = "mcl_sponges:sponge_wet",
@ -1013,8 +1045,10 @@ local function register_mgv6_decorations()
y_min = mcl_vars.mg_lava_overworld_max + 5,
y_max = -20,
})
end
-- Add a small amount of tall grass everywhere to avoid areas completely empty devoid of tall grass
if minetest.get_modpath("mcl_flowers") then
minetest.register_decoration({
deco_type = "simple",
place_on = {"group:grass_block_no_snow"},
@ -1024,7 +1058,9 @@ local function register_mgv6_decorations()
y_max = mcl_vars.overworld_max,
decoration = "mcl_flowers:tallgrass",
})
end
if minetest.get_modpath("mcl_mushrooms") then
local mushrooms = {"mcl_mushrooms:mushroom_red", "mcl_mushrooms:mushroom_brown"}
local mseeds = { 7133, 8244 }
for m=1, #mushrooms do
@ -1048,6 +1084,7 @@ local function register_mgv6_decorations()
num_spawn_by = 1,
})
end
end
-- Dead bushes
minetest.register_decoration({
@ -1067,6 +1104,7 @@ local function register_mgv6_decorations()
decoration = "mcl_core:deadbush",
})
if minetest.get_modpath("mcl_flowers") then
local function register_mgv6_flower(name, seed, offset, y_max)
if offset == nil then
offset = 0
@ -1107,6 +1145,7 @@ local function register_mgv6_decorations()
register_mgv6_flower("blue_orchid", 64500, nil, mcl_worlds.layer_to_y(67))
register_mgv6_flower("oxeye_daisy", 3490)
register_mgv6_flower("poppy", 9439)
end
-- Put top snow on snowy grass blocks. The v6 mapgen does not generate the top snow on its own.
minetest.register_decoration({
@ -1247,47 +1286,26 @@ local function generate_clay(minp, maxp, blockseed, voxelmanip_data, voxelmanip_
return lvm_used
end
local dragon_spawn_pos = false
local dragon_spawned, portal_generated = false, false
local function spawn_ender_dragon()
local obj = minetest.add_entity(dragon_spawn_pos, "mobs_mc:enderdragon")
if not obj then return false end
local function generate_end_exit_portal(pos)
local obj = minetest.add_entity(vector.add(pos, vector.new(3, 11, 3)), "mobs_mc:enderdragon")
if obj then
local dragon_entity = obj:get_luaentity()
dragon_entity._initial = true
dragon_entity._portal_pos = pos
return obj
else
minetest.log("error", "[mcl_mapgen_core] ERROR! Ender dragon doesn't want to spawn")
end
local function try_to_spawn_ender_dragon()
if spawn_ender_dragon() then
dragon_spawned = true
return
if mcl_structures ~= nil then
mcl_structures.call_struct(pos, "end_exit_portal")
end
minetest.after(2, try_to_spawn_ender_dragon)
minetest.log("warning", "[mcl_mapgen_core] WARNING! Ender dragon doesn't want to spawn at "..minetest.pos_to_string(dragon_spawn_pos))
end
if portal_generated and not dragon_spawned then
minetest.after(10, try_to_spawn_ender_dragon)
end
local function generate_end_exit_portal(pos)
if dragon_spawn_pos then return false end
dragon_spawn_pos = vector.add(pos, vector.new(3, 11, 3))
mcl_structures.call_struct(pos, "end_exit_portal", nil, nil, function()
minetest.after(2, function()
minetest.emerge_area(vector.subtract(dragon_spawn_pos, {x = 64, y = 12, z = 5}), vector.add(dragon_spawn_pos, {x = 3, y = 3, z = 5}), function(blockpos, action, calls_remaining, param)
if calls_remaining > 0 then return end
minetest.after(2, try_to_spawn_ender_dragon)
end)
end)
end)
portal_generated = true
end
-- TODO: Try to use more efficient structure generating code
local function generate_structures(minp, maxp, blockseed, biomemap)
if mcl_structures == nil then
return
end
local chunk_has_desert_well = false
local chunk_has_desert_temple = false
local chunk_has_igloo = false
@ -1596,6 +1614,7 @@ local function generate_tree_decorations(minp, maxp, seed, data, param2_data, ar
local pos, treepos, dir
if c_cocoas ~= nil then
local cocoachance = 40
if dense_vegetation then
cocoachance = 32
@ -1628,17 +1647,11 @@ local function generate_tree_decorations(minp, maxp, seed, data, param2_data, ar
and data[p_pos] == c_air
and l and l > 12 then
local c = pr:next(1, 3)
if c == 1 then
data[p_pos] = c_cocoa_1
elseif c == 2 then
data[p_pos] = c_cocoa_2
else
data[p_pos] = c_cocoa_3
end
data[p_pos] = c_cocoas[c]
param2_data[p_pos] = minetest.dir_to_facedir(vector.subtract(treepos, pos))
lvm_used = true
end
end
end
end
@ -1748,6 +1761,10 @@ end
-- Generate mushrooms in caves manually.
-- Minetest's API does not support decorations in caves yet. :-(
local function generate_underground_mushrooms(minp, maxp, seed)
if not minetest.get_modpath("mcl_mushrooms") then
return
end
local pr_shroom = PseudoRandom(seed-24359)
-- Generate rare underground mushrooms
-- TODO: Make them appear in groups, use Perlin noise
@ -1782,6 +1799,10 @@ end
-- Generate Nether decorations manually: Eternal fire, mushrooms, nether wart
-- Minetest's API does not support decorations in caves yet. :-(
local function generate_nether_decorations(minp, maxp, seed)
if c_nether == nil then
return
end
local pr_nether = PseudoRandom(seed+667)
if minp.y > mcl_vars.mg_nether_max or maxp.y < mcl_vars.mg_nether_min then
@ -1824,6 +1845,7 @@ local function generate_nether_decorations(minp, maxp, seed)
-- Mushrooms on netherrack
-- Note: Spawned *after* the fire because of light level checks
if minetest.get_modpath("mcl_mushrooms") then
special_deco(rack, function(bpos)
local l = minetest.get_node_light(bpos, 0.5)
if bpos.y > mcl_vars.mg_lava_nether_max + 6 and l and l <= 12 and pr_nether:next(1,1000) <= 4 then
@ -1835,6 +1857,7 @@ local function generate_nether_decorations(minp, maxp, seed)
end
end
end)
end
-- Nether wart on soul sand
-- TODO: Spawn in Nether fortresses
@ -2047,7 +2070,9 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- Big lava seas by replacing air below a certain height
if mcl_vars.mg_lava then
lvm_used = set_layers(data, area, c_lava, c_air, mcl_vars.mg_overworld_min, mcl_vars.mg_lava_overworld_max, emin, emax, lvm_used, pr)
lvm_used = set_layers(data, area, c_nether_lava, c_air, mcl_vars.mg_nether_min, mcl_vars.mg_lava_nether_max, emin, emax, lvm_used, pr)
if c_nether then
lvm_used = set_layers(data, area, c_nether.lava, c_air, mcl_vars.mg_nether_min, mcl_vars.mg_lava_nether_max, emin, emax, lvm_used, pr)
end
end
-- Clay, vines, cocoas
@ -2129,25 +2154,27 @@ local function basic(vm, data, data2, emin, emax, area, minp, maxp, blockseed)
-- * Replace water with Nether lava.
-- * Replace stone, sand dirt in v6 so the Nether works in v6.
elseif emin.y <= mcl_vars.mg_nether_max and emax.y >= mcl_vars.mg_nether_min then
if c_nether then
if mg_name == "v6" then
local nodes = minetest.find_nodes_in_area(emin, emax, {"mcl_core:water_source", "mcl_core:stone", "mcl_core:sand", "mcl_core:dirt"})
for n=1, #nodes do
local p_pos = area:index(nodes[n].x, nodes[n].y, nodes[n].z)
if data[p_pos] == c_water then
data[p_pos] = c_nether_lava
data[p_pos] = c_nether.lava
lvm_used = true
elseif data[p_pos] == c_stone then
data[p_pos] = c_netherrack
data[p_pos] = c_nether.netherrack
lvm_used = true
elseif data[p_pos] == c_sand or data[p_pos] == c_dirt then
data[p_pos] = c_soul_sand
data[p_pos] = c_nether.soul_sand
lvm_used = true
end
end
else
local nodes = minetest.find_nodes_in_area(emin, emax, {"group:water"})
for _, n in pairs(nodes) do
data[area:index(n.x, n.y, n.z)] = c_nether_lava
data[area:index(n.x, n.y, n.z)] = c_nether.lava
end
end
end

View File

@ -1,5 +1,5 @@
name = mcl_mapgen_core
author = Wuzzy
description = The core of the MCL2 mapgen
depends = mcl_init, mcl_core, biomeinfo, mcl_worlds, mcl_cocoas, mcl_sponges, mcl_ocean, mcl_stairs, mcl_monster_eggs, mcl_structures
optional_depends = mclx_core
depends = mcl_init, mcl_core, biomeinfo, mcl_worlds
optional_depends = mclx_core, mcl_cocoas, mcl_sponges, mcl_ocean, mcl_stairs, mcl_monster_eggs, mcl_structures, mcl_flowers, mcl_farming, mcl_mushrooms, mcl_nether

View File

@ -69,7 +69,7 @@ local function init_node_construct(pos)
end
-- The call of Struct
function mcl_structures.call_struct(pos, struct_style, rotation, pr, callback)
function mcl_structures.call_struct(pos, struct_style, rotation, pr)
minetest.log("action","[mcl_structures] call_struct " .. struct_style.." at "..minetest.pos_to_string(pos))
if not rotation then
rotation = "random"
@ -91,31 +91,13 @@ function mcl_structures.call_struct(pos, struct_style, rotation, pr, callback)
elseif struct_style == "fossil" then
return mcl_structures.generate_fossil(pos, rotation, pr)
elseif struct_style == "end_exit_portal" then
return mcl_structures.generate_end_exit_portal(pos, rotation, pr, callback)
return mcl_structures.generate_end_exit_portal(pos, rotation)
elseif struct_style == "end_exit_portal_open" then
return mcl_structures.generate_end_exit_portal_open(pos, rotation)
elseif struct_style == "end_gateway_portal" then
return mcl_structures.generate_end_gateway_portal(pos, rotation)
elseif struct_style == "end_portal_shrine" then
return mcl_structures.generate_end_portal_shrine(pos, rotation, pr)
elseif struct_style == "end_portal" then
return mcl_structures.generate_end_portal(pos, rotation, pr)
end
end
function mcl_structures.generate_end_portal(pos, rotation, pr)
-- todo: proper facedir
local x0, y0, z0 = pos.x - 2, pos.y, pos.z - 2
for x = 0, 4 do
for z = 0, 4 do
if x % 4 == 0 or z % 4 == 0 then
if x % 4 ~= 0 or z % 4 ~= 0 then
minetest.swap_node({x = x0 + x, y = y0, z = z0 + z}, {name = "mcl_portals:end_portal_frame_eye"})
end
else
minetest.swap_node({x = x0 + x, y = y0, z = z0 + z}, {name = "mcl_portals:portal_end"})
end
end
end
end
@ -342,9 +324,9 @@ function mcl_structures.generate_fossil(pos, rotation, pr)
return mcl_structures.place_schematic(newpos, path, rotation or "random", nil, true)
end
function mcl_structures.generate_end_exit_portal(pos, rot, pr, callback)
function mcl_structures.generate_end_exit_portal(pos, rot)
local path = modpath.."/schematics/mcl_structures_end_exit_portal.mts"
return mcl_structures.place_schematic(pos, path, rot or "0", {["mcl_portals:portal_end"] = "air"}, true, nil, callback)
return mcl_structures.place_schematic(pos, path, rot or "0", {["mcl_portals:portal_end"] = "air"}, true)
end
function mcl_structures.generate_end_exit_portal_open(pos, rot)
@ -574,7 +556,7 @@ end
-- Debug command
minetest.register_chatcommand("spawnstruct", {
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_exit_portal_open | end_gateway_portal | end_portal_shrine | end_portal | nether_portal | dungeon",
params = "desert_temple | desert_well | igloo | witch_hut | boulder | ice_spike_small | ice_spike_large | fossil | end_exit_portal | end_exit_portal_open | end_gateway_portal | end_portal_shrine | nether_portal | dungeon",
description = S("Generate a pre-defined structure near your position."),
privs = {debug = true},
func = function(name, param)
@ -614,8 +596,6 @@ minetest.register_chatcommand("spawnstruct", {
mcl_structures.generate_end_portal_shrine(pos, rot, pr)
elseif param == "dungeon" and mcl_dungeons and mcl_dungeons.spawn_dungeon then
mcl_dungeons.spawn_dungeon(pos, rot, pr)
elseif param == "end_portal" then
mcl_structures.generate_end_portal(pos, rot, pr)
elseif param == "nether_portal" and mcl_portals and mcl_portals.spawn_nether_portal then
mcl_portals.spawn_nether_portal(pos, rot, pr, name)
elseif param == "" then