forked from MineClone5/MineClone5
Compare commits
7 Commits
pillager_o
...
master
Author | SHA1 | Date |
---|---|---|
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 | ee2418f91c | |
𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 | 56b915d51d | |
PrairieWind | ba47414a95 | |
FaceDeer | 7e0cfed1b5 | |
FaceDeer | 5cc0288a03 | |
FaceDeer | eef5c0dc46 | |
FaceDeer | ae60960a00 |
|
@ -394,7 +394,17 @@ minetest.register_on_generated(function(minp, maxp, chunkseed)
|
|||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_generated = mcl_mapgen.register_chunk_generator
|
||||
local register_on_generated_old = minetest.register_on_generated
|
||||
minetest.register_on_generated = function(...)
|
||||
minetest.log("warning", "minetest.register_on_generated() is being called by the mod '"
|
||||
.. minetest.get_current_modname() .. "'. MineClone5's map generation system avoids using "
|
||||
.. "this callback to work around engine map generation issues. If possible please read "
|
||||
.. "mods/CORE/mcl_mapgen/API.md and update " .. minetest.get_current_modname()
|
||||
.. " to use the method described from there. MineClone5 makes no promises that "
|
||||
.. "mapgen mods will be fully compatible with it, please test your server and use at "
|
||||
.. "your own risk.")
|
||||
return register_on_generated_old(...)
|
||||
end
|
||||
|
||||
function mcl_mapgen.get_far_node(p)
|
||||
local p = p
|
||||
|
@ -440,6 +450,21 @@ function mcl_mapgen.get_chunk_number(pos) -- unsigned int
|
|||
c.x + k_positive
|
||||
end
|
||||
|
||||
-- Components of this game should register functions here to update their internal
|
||||
-- state when external mods modify mapgen settings that they care about.
|
||||
local settings_changed_callbacks = {}
|
||||
function mcl_mapgen.register_on_settings_changed(callback)
|
||||
table.insert(settings_changed_callbacks, callback)
|
||||
end
|
||||
|
||||
-- this is to be called by external mods after modifying these settings
|
||||
-- to notify Mineclone that it needs to update local copies and whatever's based on them.
|
||||
function mcl_mapgen.on_settings_changed()
|
||||
for _, callback in pairs(settings_changed_callbacks) do
|
||||
callback()
|
||||
end
|
||||
end
|
||||
|
||||
mcl_mapgen.minecraft_height_limit = 256
|
||||
|
||||
mcl_mapgen.bedrock_is_rough = normal
|
||||
|
|
|
@ -2,11 +2,18 @@ mcl_worlds = {}
|
|||
|
||||
local get_connected_players = minetest.get_connected_players
|
||||
|
||||
local min1, min2, min3
|
||||
local max1, max2, max3
|
||||
local get_local_settings = function()
|
||||
min1, min2, min3 = mcl_mapgen.overworld.min, mcl_mapgen.end_.min, mcl_mapgen.nether.min
|
||||
max1, max2, max3 = mcl_mapgen.overworld.max, mcl_mapgen.end_.max, mcl_mapgen.nether.max+128
|
||||
end
|
||||
get_local_settings()
|
||||
mcl_mapgen.register_on_settings_changed(get_local_settings)
|
||||
|
||||
-- For a given position, returns a 2-tuple:
|
||||
-- 1st return value: true if pos is in void
|
||||
-- 2nd return value: true if it is in the deadly part of the void
|
||||
local min1, min2, min3 = mcl_mapgen.overworld.min, mcl_mapgen.end_.min, mcl_mapgen.nether.min
|
||||
local max1, max2, max3 = mcl_mapgen.overworld.max, mcl_mapgen.end_.max, mcl_mapgen.nether.max+128
|
||||
function mcl_worlds.is_in_void(pos)
|
||||
local y = pos.y
|
||||
local void = not ((y < max1 and y > min1) or (y < max2 and y > min2) or (y < max3 and y > min3))
|
||||
|
|
|
@ -229,19 +229,23 @@ mobs_mc.override.spawn = {
|
|||
}
|
||||
|
||||
-- This table contains important spawn height references for the mob spawn height.
|
||||
mobs_mc.override.spawn_height = {
|
||||
water = tonumber(minetest.settings:get("water_level")) or 0, -- Water level in the Overworld
|
||||
|
||||
-- Overworld boundaries (inclusive)
|
||||
overworld_min = mcl_mapgen.overworld.min,
|
||||
overworld_max = mcl_mapgen.overworld.max,
|
||||
|
||||
-- Nether boundaries (inclusive)
|
||||
nether_min = mcl_mapgen.nether.min,
|
||||
nether_max = mcl_mapgen.nether.max,
|
||||
|
||||
-- End boundaries (inclusive)
|
||||
end_min = mcl_mapgen.end_.min,
|
||||
end_max = mcl_mapgen.end_.max,
|
||||
}
|
||||
local get_local_settings = function()
|
||||
mobs_mc.override.spawn_height = {
|
||||
water = tonumber(minetest.settings:get("water_level")) or 0, -- Water level in the Overworld
|
||||
|
||||
-- Overworld boundaries (inclusive)
|
||||
overworld_min = mcl_mapgen.overworld.min,
|
||||
overworld_max = mcl_mapgen.overworld.max,
|
||||
|
||||
-- Nether boundaries (inclusive)
|
||||
nether_min = mcl_mapgen.nether.min,
|
||||
nether_max = mcl_mapgen.nether.max,
|
||||
|
||||
-- End boundaries (inclusive)
|
||||
end_min = mcl_mapgen.end_.min,
|
||||
end_max = mcl_mapgen.end_.max,
|
||||
}
|
||||
end
|
||||
get_local_settings()
|
||||
mcl_mapgen.register_on_settings_changed(get_local_settings)
|
||||
|
||||
|
|
|
@ -12,9 +12,17 @@ local floor = math.floor
|
|||
local minetest_get_gametime = minetest.get_gametime
|
||||
local get_voxel_manip = minetest.get_voxel_manip
|
||||
|
||||
local min1, min2, min3 = mcl_mapgen.overworld.min, mcl_mapgen.end_.min, mcl_mapgen.nether.min
|
||||
local max1, max2, max3 = mcl_mapgen.overworld.max, mcl_mapgen.end_.max, mcl_mapgen.nether.max + 128
|
||||
local CS = mcl_mapgen.CS_NODES
|
||||
local min1, min2, min3
|
||||
local max1, max2, max3
|
||||
local CS
|
||||
|
||||
local get_local_settings = function()
|
||||
min1, min2, min3 = mcl_mapgen.overworld.min, mcl_mapgen.end_.min, mcl_mapgen.nether.min
|
||||
max1, max2, max3 = mcl_mapgen.overworld.max, mcl_mapgen.end_.max, mcl_mapgen.nether.max+128
|
||||
CS = mcl_mapgen.CS_NODES
|
||||
end
|
||||
get_local_settings()
|
||||
mcl_mapgen.register_on_settings_changed(get_local_settings)
|
||||
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
|
|
@ -34,7 +34,7 @@ minetest.register_on_mods_loaded(function()
|
|||
for name,def in pairs(minetest.registered_items) do
|
||||
if (not def.groups.not_in_creative_inventory or def.groups.not_in_creative_inventory == 0) and def.description and def.description ~= "" then
|
||||
local function is_redstone(def)
|
||||
return def.mesecons or def.groups.mesecon or def.groups.mesecon_conductor_craftable or def.groups.mesecon_effecor_off
|
||||
return def.mesecons or def.groups.mesecon or def.groups.mesecon_conductor_craftable or def.groups.mesecon_effector_off
|
||||
end
|
||||
local function is_tool(def)
|
||||
return def.groups.tool or (def.tool_capabilities and def.tool_capabilities.damage_groups == nil)
|
||||
|
|
|
@ -510,8 +510,8 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_alias("mcl_blast_furnace:blast_furnace", "mcl_furnaces:blast_furnace")
|
||||
minetest.register_alias("mcl_blast_furnace:blast_furnace_active", "mcl_furnaces:blast_furnace_active")
|
||||
minetest.register_alias("mcl_furnaces:blast_furnace", "mcl_blast_furnace:blast_furnace")
|
||||
minetest.register_alias("mcl_furnaces:blast_furnace_active", "mcl_blast_furnace:blast_furnace_active")
|
||||
|
||||
-- Add entry alias for the Help
|
||||
if minetest.get_modpath("doc") then
|
||||
|
|
|
@ -91,7 +91,7 @@ minetest.register_craftitem("mcl_farming:potato_item", {
|
|||
_doc_items_longdesc = S("Potatoes are food items which can be eaten, cooked in the furnace and planted. Pigs like potatoes."),
|
||||
_doc_items_usagehelp = S("Hold it in your hand and rightclick to eat it. Place it on top of farmland to plant it. It grows in sunlight and grows faster on hydrated farmland. Rightclick an animal to feed it."),
|
||||
inventory_image = "farming_potato.png",
|
||||
groups = { food = 2, eatable = 1, compostability=65 },
|
||||
groups = { food = 2, eatable = 1, compostability=65, smoker_cookable=1 },
|
||||
_mcl_saturation = 0.6,
|
||||
stack_max = 64,
|
||||
on_secondary_use = minetest.item_eat(1),
|
||||
|
|
|
@ -27,8 +27,34 @@ local DELAY = 3 -- seconds before teleporting in Nether portal in Survival mo
|
|||
local DISTANCE_MAX = 128
|
||||
local PORTAL = "mcl_portals:portal"
|
||||
local OBSIDIAN = "mcl_core:obsidian"
|
||||
local O_Y_MIN, O_Y_MAX = max(mcl_mapgen.overworld.min, -31), min(mcl_mapgen.overworld.max, 2048)
|
||||
local N_Y_MIN, N_Y_MAX = mcl_mapgen.nether.bedrock_bottom_min, mcl_mapgen.nether.bedrock_top_min - H_MIN
|
||||
local O_Y_MIN, O_Y_MAX
|
||||
local N_Y_MIN, N_Y_MAX
|
||||
|
||||
local overworld_lava_max
|
||||
local nether_lava_max
|
||||
local overworld_min
|
||||
local limits
|
||||
|
||||
local get_local_settings = function()
|
||||
O_Y_MIN, O_Y_MAX = max(mcl_mapgen.overworld.min, -31), min(mcl_mapgen.overworld.max, 2048)
|
||||
N_Y_MIN, N_Y_MAX = mcl_mapgen.nether.bedrock_bottom_min, mcl_mapgen.nether.bedrock_top_min - H_MIN
|
||||
overworld_min = mcl_mapgen.overworld.min
|
||||
overworld_lava_max = mcl_mapgen.overworld.lava_max
|
||||
nether_lava_max = mcl_mapgen.nether.lava_max
|
||||
|
||||
limits = {
|
||||
nether = {
|
||||
pmin = {x=LIM_MIN, y = N_Y_MIN, z = LIM_MIN},
|
||||
pmax = {x=LIM_MAX, y = N_Y_MAX, z = LIM_MAX},
|
||||
},
|
||||
overworld = {
|
||||
pmin = {x=LIM_MIN, y = O_Y_MIN, z = LIM_MIN},
|
||||
pmax = {x=LIM_MAX, y = O_Y_MAX, z = LIM_MAX},
|
||||
},
|
||||
}
|
||||
end
|
||||
get_local_settings()
|
||||
mcl_mapgen.register_on_settings_changed(get_local_settings)
|
||||
|
||||
-- Alpha and particles
|
||||
local node_particles_allowed = minetest.settings:get("mcl_node_particles") or "none"
|
||||
|
@ -79,17 +105,6 @@ local get_us_time = minetest.get_us_time
|
|||
|
||||
local dimension_to_teleport = { nether = "overworld", overworld = "nether" }
|
||||
|
||||
local limits = {
|
||||
nether = {
|
||||
pmin = {x=LIM_MIN, y = N_Y_MIN, z = LIM_MIN},
|
||||
pmax = {x=LIM_MAX, y = N_Y_MAX, z = LIM_MAX},
|
||||
},
|
||||
overworld = {
|
||||
pmin = {x=LIM_MIN, y = O_Y_MIN, z = LIM_MIN},
|
||||
pmax = {x=LIM_MAX, y = O_Y_MAX, z = LIM_MAX},
|
||||
},
|
||||
}
|
||||
|
||||
-- This function registers exits from Nether portals.
|
||||
-- Incoming verification performed: two nodes must be portal nodes, and an obsidian below them.
|
||||
-- If the verification passes - position adds to the table and saves to mod storage on exit.
|
||||
|
@ -164,7 +179,7 @@ local function find_exit(p, dx, dy, dz)
|
|||
end
|
||||
end
|
||||
|
||||
-- This functon searches Nether portal nodes whitin distance specified and checks the node
|
||||
-- This function searches Nether portal nodes within distance specified and checks the node
|
||||
local function find_exit_with_check(p, dx, dy, dz)
|
||||
while true do
|
||||
local pos = find_exit(p, dx, dy, dz)
|
||||
|
@ -181,7 +196,7 @@ local function find_exit_with_check(p, dx, dy, dz)
|
|||
end
|
||||
end
|
||||
|
||||
-- Ping-Pong the coordinate for Fast Travelling, https://git.minetest.land/Wuzzy/MineClone2/issues/795#issuecomment-11058
|
||||
-- Ping-Pong the coordinate for Fast Traveling, https://git.minetest.land/Wuzzy/MineClone2/issues/795#issuecomment-11058
|
||||
local function ping_pong(x, m, l1, l2)
|
||||
if x < 0 then
|
||||
return l1 + abs(((x*m+l1) % (l1*4)) - (l1*2)), floor(x*m/l1/2) + ((ceil(x*m/l1)+1)%2) * ((x*m)%l1)/l1
|
||||
|
@ -421,9 +436,9 @@ end
|
|||
|
||||
local function get_lava_level(pos, pos1, pos2)
|
||||
if pos.y > -1000 then
|
||||
return max(min(mcl_mapgen.overworld.lava_max, pos2.y-1), pos1.y+1)
|
||||
return max(min(overworld_lava_max, pos2.y-1), pos1.y+1)
|
||||
end
|
||||
return max(min(mcl_mapgen.nether.lava_max, pos2.y-1), pos1.y+1)
|
||||
return max(min(nether_lava_max, pos2.y-1), pos1.y+1)
|
||||
end
|
||||
|
||||
local function ecb_scan_area_2(blockpos, action, calls_remaining, param)
|
||||
|
@ -746,7 +761,7 @@ minetest.register_abm({
|
|||
return
|
||||
end
|
||||
|
||||
if lower_node_name == OBSIDIAN and pos.y >= mcl_mapgen.overworld.min and random(1, 750) == 19 then
|
||||
if lower_node_name == OBSIDIAN and pos.y >= overworld_min and random(1, 750) == 19 then
|
||||
local pigman_obj = minetest.add_entity(pos, "mobs_mc:pigman")
|
||||
if pigman_obj then
|
||||
teleport_cooloff(pigman_obj)
|
||||
|
|
|
@ -509,8 +509,8 @@ minetest.register_craft({
|
|||
}
|
||||
})
|
||||
|
||||
minetest.register_alias("mcl_smoker:smoker", "mcl_furnaces:smoker")
|
||||
minetest.register_alias("mcl_smoker:smoker_active", "mcl_furnaces:smoker_active")
|
||||
minetest.register_alias("mcl_furnaces:smoker", "mcl_smoker:smoker")
|
||||
minetest.register_alias("mcl_furnaces:smoker_active", "mcl_smoker:smoker_active")
|
||||
|
||||
-- Add entry alias for the Help
|
||||
if minetest.get_modpath("doc") then
|
||||
|
|
|
@ -32,9 +32,16 @@ local math_ceil = math.ceil
|
|||
--custom mcl_vars
|
||||
local get_node = mcl_mapgen.get_far_node
|
||||
|
||||
local min_y
|
||||
local max_y
|
||||
|
||||
local get_local_settings = function()
|
||||
min_y = math_max(mcl_mapgen.overworld.min, mcl_mapgen.overworld.bedrock_max) + 1
|
||||
max_y = mcl_mapgen.overworld.max - 1
|
||||
end
|
||||
get_local_settings()
|
||||
mcl_mapgen.register_on_settings_changed(get_local_settings)
|
||||
|
||||
local min_y = math_max(mcl_mapgen.overworld.min, mcl_mapgen.overworld.bedrock_max) + 1
|
||||
local max_y = mcl_mapgen.overworld.max - 1
|
||||
-- Calculate the number of dungeon spawn attempts
|
||||
-- In Minecraft, there 8 dungeon spawn attempts Minecraft chunk (16*256*16 = 65536 blocks).
|
||||
-- Minetest chunks don't have this size, so scale the number accordingly.
|
||||
|
|
|
@ -1214,25 +1214,34 @@ if flat then
|
|||
air_layers[#air_layers + 1] = {mcl_mapgen.nether.flat_floor, mcl_mapgen.nether.flat_ceiling} -- Flat Nether
|
||||
end
|
||||
|
||||
-- Realm barrier between the Overworld void and the End
|
||||
local barrier_min = mcl_mapgen.realm_barrier_overworld_end_min
|
||||
local barrier_max = mcl_mapgen.realm_barrier_overworld_end_max
|
||||
local barrier_min
|
||||
local barrier_max
|
||||
local void_layers
|
||||
local bedrock_layers
|
||||
|
||||
local void_layers = {
|
||||
{mcl_mapgen.EDGE_MIN , mcl_mapgen.nether.min - 1 }, -- below Nether
|
||||
{mcl_mapgen.nether.max + 129, mcl_mapgen.end_.min - 1 }, -- below End (above Nether)
|
||||
{mcl_mapgen.end_.max + 1 , barrier_min - 1 }, -- below Realm Barrier, above End
|
||||
{barrier_max + 1 , mcl_mapgen.overworld.min - 1}, -- below Overworld, above Realm Barrier
|
||||
}
|
||||
local get_local_settings = function()
|
||||
-- Realm barrier between the Overworld void and the End
|
||||
barrier_min = mcl_mapgen.realm_barrier_overworld_end_min
|
||||
barrier_max = mcl_mapgen.realm_barrier_overworld_end_max
|
||||
|
||||
local bedrock_layers = {}
|
||||
if not singlenode then
|
||||
bedrock_layers = {
|
||||
{mcl_mapgen.overworld.bedrock_min , mcl_mapgen.overworld.bedrock_max },
|
||||
{mcl_mapgen.nether.bedrock_bottom_min, mcl_mapgen.nether.bedrock_bottom_max},
|
||||
{mcl_mapgen.nether.bedrock_top_min , mcl_mapgen.nether.bedrock_top_max },
|
||||
void_layers = {
|
||||
{mcl_mapgen.EDGE_MIN , mcl_mapgen.nether.min - 1 }, -- below Nether
|
||||
{mcl_mapgen.nether.max + 129, mcl_mapgen.end_.min - 1 }, -- below End (above Nether)
|
||||
{mcl_mapgen.end_.max + 1 , barrier_min - 1 }, -- below Realm Barrier, above End
|
||||
{barrier_max + 1 , mcl_mapgen.overworld.min - 1}, -- below Overworld, above Realm Barrier
|
||||
}
|
||||
|
||||
bedrock_layers = {}
|
||||
if not singlenode then
|
||||
bedrock_layers = {
|
||||
{mcl_mapgen.overworld.bedrock_min , mcl_mapgen.overworld.bedrock_max },
|
||||
{mcl_mapgen.nether.bedrock_bottom_min, mcl_mapgen.nether.bedrock_bottom_max},
|
||||
{mcl_mapgen.nether.bedrock_top_min , mcl_mapgen.nether.bedrock_top_max },
|
||||
}
|
||||
end
|
||||
end
|
||||
get_local_settings()
|
||||
mcl_mapgen.register_on_settings_changed(get_local_settings)
|
||||
|
||||
mcl_mapgen.register_mapgen_block_lvm(function(vm_context)
|
||||
local vm, data, area, minp, maxp, chunkseed, blockseed = vm_context.vm, vm_context.data, vm_context.area, vm_context.minp, vm_context.maxp, vm_context.chunkseed, vm_context.blockseed
|
||||
|
|
|
@ -94,13 +94,21 @@ if setting then
|
|||
end
|
||||
|
||||
-- Max. and min. heights between rail corridors are generated
|
||||
local height_min
|
||||
if mcl_mapgen.lava then
|
||||
height_min = mcl_mapgen.overworld.lava_max + 2
|
||||
else
|
||||
height_min = mcl_mapgen.overworld.bedrock_max + 2
|
||||
local height_min, height_max
|
||||
local get_local_settings = function()
|
||||
if mcl_mapgen.lava then
|
||||
height_min = mcl_mapgen.overworld.lava_max + 2
|
||||
else
|
||||
height_min = mcl_mapgen.overworld.bedrock_max + 2
|
||||
end
|
||||
height_max = mcl_worlds.layer_to_y(60)
|
||||
|
||||
-- Allow mods to separately override this
|
||||
height_min = mcl_mapgen.overworld.railcorridors_height_min or height_min
|
||||
height_max = mcl_mapgen.overworld.railcorridors_height_max or height_max
|
||||
end
|
||||
local height_max = mcl_worlds.layer_to_y(60)
|
||||
get_local_settings()
|
||||
mcl_mapgen.register_on_settings_changed(get_local_settings)
|
||||
|
||||
-- Chaos Mode: If enabled, rail corridors don't stop generating when hitting obstacles
|
||||
local chaos_mode = minetest.settings:get_bool("tsm_railcorridors_chaos") or false
|
||||
|
|
Loading…
Reference in New Issue