forked from mtcontrib/mobs_redo
nil check on spawn collisionbox
This commit is contained in:
parent
afb7e01b91
commit
6bf6e8fbd8
6
api.lua
6
api.lua
@ -6,7 +6,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||||||
|
|
||||||
mobs = {
|
mobs = {
|
||||||
mod = "redo",
|
mod = "redo",
|
||||||
version = "20180915",
|
version = "20180928",
|
||||||
intllib = S,
|
intllib = S,
|
||||||
invis = minetest.global_exists("invisibility") and invisibility or {},
|
invis = minetest.global_exists("invisibility") and invisibility or {},
|
||||||
}
|
}
|
||||||
@ -3258,7 +3258,9 @@ function mobs:spawn_specific(name, nodes, neighbors, min_light, max_light,
|
|||||||
|
|
||||||
-- do we have enough height clearance to spawn mob?
|
-- do we have enough height clearance to spawn mob?
|
||||||
local ent = minetest.registered_entities[name]
|
local ent = minetest.registered_entities[name]
|
||||||
local height = max(0, math.ceil(ent.collisionbox[5] - ent.collisionbox[2]) - 1)
|
local height = max(1, math.ceil(
|
||||||
|
(ent.collisionbox[5] or 0.25) -
|
||||||
|
(ent.collisionbox[2] or -0.25) - 1))
|
||||||
|
|
||||||
for n = 0, height do
|
for n = 0, height do
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user