mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-06-28 06:11:47 +02:00
Update home decor and plantlife
more mesh on homedecor, and important performance upgrade for plantlife
This commit is contained in:
0
mods/plantlife_modpack/plants_lib/API.txt
Normal file → Executable file
0
mods/plantlife_modpack/plants_lib/API.txt
Normal file → Executable file
0
mods/plantlife_modpack/plants_lib/depends.txt
Normal file → Executable file
0
mods/plantlife_modpack/plants_lib/depends.txt
Normal file → Executable file
64
mods/plantlife_modpack/plants_lib/init.lua
Normal file → Executable file
64
mods/plantlife_modpack/plants_lib/init.lua
Normal file → Executable file
@ -325,8 +325,7 @@ end
|
||||
-- Primary mapgen spawner, for mods that can work with air checking enabled on
|
||||
-- a surface during the initial map read stage.
|
||||
|
||||
function plantslib:generate_block_with_air_checking(dtime)
|
||||
if dtime > 0.2 then return end -- don't attempt to populate if lag is too high
|
||||
function plantslib:generate_block_with_air_checking()
|
||||
if #plantslib.blocklist_aircheck > 0 then
|
||||
|
||||
local minp = plantslib.blocklist_aircheck[1][1]
|
||||
@ -339,17 +338,22 @@ function plantslib:generate_block_with_air_checking(dtime)
|
||||
|
||||
if not plantslib.surface_nodes_aircheck.blockhash then
|
||||
|
||||
local search_area = minetest.find_nodes_in_area(minp, maxp, plantslib.surfaceslist_aircheck)
|
||||
if type(minetest.find_nodes_in_area_under_air) == "function" then -- use newer API call
|
||||
plantslib.surface_nodes_aircheck.blockhash =
|
||||
minetest.find_nodes_in_area_under_air(minp, maxp, plantslib.surfaceslist_aircheck)
|
||||
else
|
||||
local search_area = minetest.find_nodes_in_area(minp, maxp, plantslib.surfaceslist_aircheck)
|
||||
|
||||
-- search the generated block for air-bounded surfaces
|
||||
-- search the generated block for air-bounded surfaces the slow way.
|
||||
|
||||
plantslib.surface_nodes_aircheck.blockhash = {}
|
||||
plantslib.surface_nodes_aircheck.blockhash = {}
|
||||
|
||||
for i = 1, #search_area do
|
||||
local pos = search_area[i]
|
||||
local p_top = { x=pos.x, y=pos.y+1, z=pos.z }
|
||||
if minetest.get_node(p_top).name == "air" then
|
||||
plantslib.surface_nodes_aircheck.blockhash[#plantslib.surface_nodes_aircheck.blockhash + 1] = pos
|
||||
for i = 1, #search_area do
|
||||
local pos = search_area[i]
|
||||
local p_top = { x=pos.x, y=pos.y+1, z=pos.z }
|
||||
if minetest.get_node(p_top).name == "air" then
|
||||
plantslib.surface_nodes_aircheck.blockhash[#plantslib.surface_nodes_aircheck.blockhash + 1] = pos
|
||||
end
|
||||
end
|
||||
end
|
||||
plantslib.actioncount_aircheck.blockhash = 1
|
||||
@ -375,8 +379,7 @@ end
|
||||
-- Secondary mapgen spawner, for mods that require disabling of
|
||||
-- checking for air during the initial map read stage.
|
||||
|
||||
function plantslib:generate_block_no_aircheck(dtime)
|
||||
if dtime > 0.2 then return end
|
||||
function plantslib:generate_block_no_aircheck()
|
||||
if #plantslib.blocklist_no_aircheck > 0 then
|
||||
|
||||
local minp = plantslib.blocklist_no_aircheck[1][1]
|
||||
@ -422,11 +425,42 @@ end)
|
||||
-- "Play" them back, populating them with new stuff in the process
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
plantslib:generate_block_with_air_checking(dtime)
|
||||
if dtime < 0.2 and -- don't attempt to populate if lag is already too high
|
||||
(#plantslib.blocklist_aircheck > 0 or #plantslib.blocklist_no_aircheck > 0) then
|
||||
plantslib.globalstep_start_time = minetest.get_us_time()
|
||||
plantslib.globalstep_runtime = 0
|
||||
while (#plantslib.blocklist_aircheck > 0 or #plantslib.blocklist_no_aircheck > 0)
|
||||
and plantslib.globalstep_runtime < 200000 do -- 0.2 seconds, in uS.
|
||||
if #plantslib.blocklist_aircheck > 0 then
|
||||
plantslib:generate_block_with_air_checking()
|
||||
end
|
||||
if #plantslib.blocklist_no_aircheck > 0 then
|
||||
plantslib:generate_block_no_aircheck()
|
||||
end
|
||||
plantslib.globalstep_runtime = minetest.get_us_time() - plantslib.globalstep_start_time
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
plantslib:generate_block_no_aircheck(dtime)
|
||||
-- Play out the entire log all at once on shutdown
|
||||
-- to prevent unpopulated map areas
|
||||
|
||||
minetest.register_on_shutdown(function()
|
||||
print("[plants_lib] Stand by, playing out the rest of the aircheck mapblock log")
|
||||
print("(there are "..#plantslib.blocklist_aircheck.." entries)...")
|
||||
while true do
|
||||
plantslib:generate_block_with_air_checking(0.1)
|
||||
if #plantslib.blocklist_aircheck == 0 then return end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_on_shutdown(function()
|
||||
print("[plants_lib] Stand by, playing out the rest of the no-aircheck mapblock log")
|
||||
print("(there are "..#plantslib.blocklist_aircheck.." entries)...")
|
||||
while true do
|
||||
plantslib:generate_block_no_aircheck(0.1)
|
||||
if #plantslib.blocklist_no_aircheck == 0 then return end
|
||||
end
|
||||
end)
|
||||
|
||||
-- The spawning ABM
|
||||
|
0
mods/plantlife_modpack/plants_lib/locale/de.txt
Normal file → Executable file
0
mods/plantlife_modpack/plants_lib/locale/de.txt
Normal file → Executable file
0
mods/plantlife_modpack/plants_lib/locale/template.txt
Normal file → Executable file
0
mods/plantlife_modpack/plants_lib/locale/template.txt
Normal file → Executable file
Reference in New Issue
Block a user