This commit is contained in:
kay27 2022-01-19 04:53:55 +04:00
parent 89769b8168
commit 2a26adac0f
5 changed files with 43 additions and 24 deletions

View File

@ -276,9 +276,11 @@ minetest.register_on_generated(function(minp, maxp, chunkseed)
vm:set_light_data(light) vm:set_light_data(light)
end end
if vm_context.write or vm_context.write_param2 or vm_context.write_light then if vm_context.write or vm_context.write_param2 or vm_context.write_light then
vm:calc_lighting(minp, maxp, vm_context.shadow or true) -- TODO: check boundaries vm:calc_lighting(minp, maxp, (vm_context.shadow ~= nil) or true) -- TODO: check boundaries
vm:write_to_map() vm:write_to_map()
vm:update_liquids() vm:update_liquids()
elseif vm_context.calc_lighting then
vm:calc_lighting(minp, maxp, (vm_context.shadow ~= nil) or true)
end end
end end
@ -323,6 +325,8 @@ minetest.register_on_generated(function(minp, maxp, chunkseed)
-- vm:calc_lighting(minp, maxp, vm_context.shadow or true) -- vm:calc_lighting(minp, maxp, vm_context.shadow or true)
vm:write_to_map() vm:write_to_map()
vm:update_liquids() vm:update_liquids()
elseif vm_context.calc_lighting then
vm:calc_lighting(minp, maxp, (vm_context.shadow ~= nil) or true)
end end
current_chunks[i] = nil current_chunks[i] = nil
end end

View File

@ -1574,17 +1574,6 @@ local function basic_safe(vm_context)
end end
end end
-- Final hackery: Set sun light level in the End.
-- -26912 is at a mapchunk border.
local shadow = true
if minp.y >= -26912 and maxp.y <= mcl_mapgen.end_.max then
vm:set_lighting({day=15, night=15})
lvm_used = true
end
if minp.y >= mcl_mapgen.end_.min and maxp.y <= -26911 then
shadow = false
lvm_used = true
end
if not singlenode then if not singlenode then
-- Generate special decorations -- Generate special decorations
@ -1593,8 +1582,6 @@ local function basic_safe(vm_context)
end end
vm_context.write = vm_context.write or lvm_used vm_context.write = vm_context.write or lvm_used
return vm_context --, lvm_used, shadow
end end
mcl_mapgen.register_mapgen_block_lvm(basic_safe, 1) mcl_mapgen.register_mapgen_block_lvm(basic_safe, 1)
@ -1603,6 +1590,7 @@ local modpath = minetest.get_modpath(minetest.get_current_modname())
dofile(modpath .. "/clay.lua") dofile(modpath .. "/clay.lua")
dofile(modpath .. "/tree_decoration.lua") dofile(modpath .. "/tree_decoration.lua")
-- Nether Roof Light:
mcl_mapgen.register_mapgen_block_lvm(function(vm_context) mcl_mapgen.register_mapgen_block_lvm(function(vm_context)
local minp = vm_context.minp local minp = vm_context.minp
local miny = minp.y local miny = minp.y
@ -1613,4 +1601,19 @@ mcl_mapgen.register_mapgen_block_lvm(function(vm_context)
local p1 = {x = minp.x, y = math.max(miny, mcl_mapgen.nether.max + 1), z = minp.z} local p1 = {x = minp.x, y = math.max(miny, mcl_mapgen.nether.max + 1), z = minp.z}
local p2 = {x = maxp.x, y = math.min(maxy, mcl_mapgen.nether.max + 127), z = maxp.z} local p2 = {x = maxp.x, y = math.min(maxy, mcl_mapgen.nether.max + 127), z = maxp.z}
vm_context.vm:set_lighting({day=15, night=15}, p1, p2) vm_context.vm:set_lighting({day=15, night=15}, p1, p2)
vm_context.write = true
end, 999999999) end, 999999999)
-- End Light:
mcl_mapgen.register_mapgen_block_lvm(function(vm_context)
local minp = vm_context.minp
local miny = minp.y
if miny > mcl_mapgen.end_.max then return end
local maxp = vm_context.maxp
local maxy = maxp.y
if maxy <= mcl_mapgen.end_.min then return end
local p1 = {x = minp.x, y = math.max(miny, mcl_mapgen.end_.min), z = maxp.z}
local p2 = {x = maxp.x, y = math.min(maxy, mcl_mapgen.end_.max), z = maxp.z}
vm_context.vm:set_lighting({day=15, night=15}, p1, p2)
vm_context.write = true
end, 9999999999)

View File

@ -4,7 +4,7 @@ local modpath = minetest.get_modpath(modname)
local END_EXIT_PORTAL_POS_X = -3 local END_EXIT_PORTAL_POS_X = -3
local END_EXIT_PORTAL_POS_Y = -27003 local END_EXIT_PORTAL_POS_Y = -27003
local END_EXIT_PORTAL_POS_Z = -3 local END_EXIT_PORTAL_POS_Z = -3
local p = { local p0 = {
x = END_EXIT_PORTAL_POS_X, x = END_EXIT_PORTAL_POS_X,
y = END_EXIT_PORTAL_POS_Y, y = END_EXIT_PORTAL_POS_Y,
z = END_EXIT_PORTAL_POS_Z, z = END_EXIT_PORTAL_POS_Z,
@ -19,15 +19,17 @@ end
mcl_mapgen.register_mapgen(function(minp, maxp, seed, vm_context) mcl_mapgen.register_mapgen(function(minp, maxp, seed, vm_context)
local minp = minp local minp = minp
local y1 = minp.y local y1 = minp.y
if y1 < END_EXIT_PORTAL_POS_Y then return end if y1 > END_EXIT_PORTAL_POS_Y then return end
local maxp = maxp local maxp = maxp
local y2 = maxp.y local y2 = maxp.y
if y2 > END_EXIT_PORTAL_POS_Y then return end if y2 < END_EXIT_PORTAL_POS_Y then return end
if minp.x < END_EXIT_PORTAL_POS_X then return end if minp.x > END_EXIT_PORTAL_POS_X then return end
if maxp.x > END_EXIT_PORTAL_POS_X then return end if maxp.x < END_EXIT_PORTAL_POS_X then return end
if minp.z < END_EXIT_PORTAL_POS_Z then return end if minp.z > END_EXIT_PORTAL_POS_Z then return end
if maxp.z > END_EXIT_PORTAL_POS_Z then return end if maxp.z < END_EXIT_PORTAL_POS_Z then return end
local p = table.copy(p0)
for y = y2, y1, -1 do for y = y2, y1, -1 do
p.y = y p.y = y
if minetest.get_node(p).name == "mcl_end:end_stone" then if minetest.get_node(p).name == "mcl_end:end_stone" then
@ -35,6 +37,16 @@ mcl_mapgen.register_mapgen(function(minp, maxp, seed, vm_context)
return return
end end
end end
for y = y2, y1, -1 do
p.y = y
if minetest.get_node(p).name ~= "air" then
place(p, "0", PseudoRandom(vm_content.chunkseed))
return
end
end
place(p0, "0", PseudoRandom(vm_content.chunkseed))
end) end)
mcl_structures.register_structure({name = "end_exit_portal", place_function = place}) mcl_structures.register_structure({name = "end_exit_portal", place_function = place})

View File

@ -159,7 +159,7 @@ function mcl_structures.register_structure(def)
local decoration_id local decoration_id
if decoration then if decoration then
minetest.register_node(':' .. name, { minetest.register_node(':' .. name, {
-- drawtype = "airlike", drawtype = "airlike",
sunlight_propagates = true, sunlight_propagates = true,
pointable = false, pointable = false,
walkable = false, walkable = false,

View File

@ -11,7 +11,7 @@ if not mcl_mapgen.singlenode then
dofile(modpath .. "/ice_spike_large.lua") dofile(modpath .. "/ice_spike_large.lua")
dofile(modpath .. "/jungle_temple.lua") dofile(modpath .. "/jungle_temple.lua")
dofile(modpath .. "/nice_jungle_temple.lua") dofile(modpath .. "/nice_jungle_temple.lua")
dofile(modpath .. "/noise_indicator.lua") -- dofile(modpath .. "/noise_indicator.lua")
dofile(modpath .. "/stronghold.lua") dofile(modpath .. "/stronghold.lua")
dofile(modpath .. "/witch_hut.lua") dofile(modpath .. "/witch_hut.lua")
end end