Fix invalid use of on_mapgen functions in deep_large_caves spawner

This commit is contained in:
sapier 2013-08-19 23:32:30 +02:00
parent 59fadf8905
commit 645f64f871

View File

@ -209,11 +209,7 @@ function mobf_spawn_in_deep_large_caves_entity(mob_name,mob_transform,spawning_d
end end
end) end)
--add mob spawner on map generation
minetest.register_on_generated(function(minp, maxp, seed)
local spawnfunc = function(name,pos,min_y,max_y,spawning_data) local spawnfunc = function(name,pos,min_y,max_y,spawning_data)
if max_y > spawning_data.min_depth then if max_y > spawning_data.min_depth then
return false return false
end end
@ -246,9 +242,10 @@ function mobf_spawn_in_deep_large_caves_entity(mob_name,mob_transform,spawning_d
return false return false
end end
if minetest.world_setting_get("mobf_delayed_spawning") then
minetest.register_on_generated(function(minp, maxp, seed)
if minetest.world_setting_get("mobf_delayed_spawning") then
minetest.register_on_generated(function(minp, maxp, seed)
local job = { local job = {
callback = spawning.divide_mapgen_entity_jobfunc, callback = spawning.divide_mapgen_entity_jobfunc,
@ -266,10 +263,15 @@ function mobf_spawn_in_deep_large_caves_entity(mob_name,mob_transform,spawning_d
mobf_job_queue.add_job(job) mobf_job_queue.add_job(job)
end) end)
else else
--add mob spawner on map generation
minetest.register_on_generated(function(minp, maxp, seed)
local starttime = mobf_get_time_ms()
spawning.divide_mapgen_entity(minp,maxp,spawning_data,mob_name,spawnfunc) spawning.divide_mapgen_entity(minp,maxp,spawning_data,mob_name,spawnfunc)
end mobf_warn_long_fct(starttime,"on_mapgen " .. mob_name,"mapgen")
end) --register mapgen end) --register mapgen
end end
end
--!@} --!@}
spawning.register_spawn_algorithm("deep large caves", mobf_spawn_in_deep_large_caves) spawning.register_spawn_algorithm("deep large caves", mobf_spawn_in_deep_large_caves)