mirror of
https://codeberg.org/tenplus1/mobs_redo.git
synced 2025-01-09 09:20:21 +01:00
fix map_load chance check
This commit is contained in:
parent
c25975e7ea
commit
c24874a3bf
18
api.lua
18
api.lua
@ -19,7 +19,7 @@ end
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20241202",
|
version = "20241208",
|
||||||
spawning_mobs = {},
|
spawning_mobs = {},
|
||||||
translate = S,
|
translate = S,
|
||||||
node_snow = has(minetest.registered_aliases["mapgen_snow"])
|
node_snow = has(minetest.registered_aliases["mapgen_snow"])
|
||||||
@ -3716,7 +3716,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
|
|||||||
pos, node, active_object_count, active_object_count_wider)
|
pos, node, active_object_count, active_object_count_wider)
|
||||||
|
|
||||||
-- use instead of abm's chance setting when using lbm
|
-- use instead of abm's chance setting when using lbm
|
||||||
if map_load and random(max(1, (chance * mob_chance_multiplier))) > 1 then
|
if map_load and random(max(1, (chance * mob_chance_multiplier))) == 1 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -3726,8 +3726,10 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local ent = minetest.registered_entities[name]
|
||||||
|
|
||||||
-- is mob actually registered?
|
-- is mob actually registered?
|
||||||
if not mobs.spawning_mobs[name] or not minetest.registered_entities[name] then
|
if not mobs.spawning_mobs[name] or not ent then
|
||||||
--print("--- mob doesn't exist", name)
|
--print("--- mob doesn't exist", name)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -3738,7 +3740,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- additional custom checks for spawning mob
|
-- additional custom checks for mob spawning
|
||||||
if mobs:spawn_abm_check(pos, node, name) then
|
if mobs:spawn_abm_check(pos, node, name) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@ -3781,13 +3783,7 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light, inter
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local ent = minetest.registered_entities[name]
|
-- change position to node above
|
||||||
|
|
||||||
if not ent or not ent.base_colbox then
|
|
||||||
print("[MOBS] Error spawning mob: " .. name) ; return
|
|
||||||
end
|
|
||||||
|
|
||||||
-- spawn above node
|
|
||||||
pos.y = pos.y + 1
|
pos.y = pos.y + 1
|
||||||
|
|
||||||
-- are we spawning within height limits?
|
-- are we spawning within height limits?
|
||||||
|
Loading…
Reference in New Issue
Block a user