Play out the rest of the mapblock log at standard shutdown

This prevents unpopulated map areas being left over after a restart.

Adds a fairly large shutdown penalty to the engine only if the mapgen is
actively generating at the time of shutdown.  If the mapgen is more or less
idle, no extra time is added.
This commit is contained in:
Vanessa Ezekowitz 2015-02-27 12:29:43 -05:00
parent b80a7a9693
commit bc80a079bc

View File

@ -434,6 +434,27 @@ minetest.register_globalstep(function(dtime)
plantslib:generate_block_no_aircheck(dtime) plantslib:generate_block_no_aircheck(dtime)
end) end)
-- 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 -- The spawning ABM
function plantslib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa) function plantslib:spawn_on_surfaces(sd,sp,sr,sc,ss,sa)