0
0
Fork 0

Fix mob api can_spawn callback

This commit is contained in:
cora 2022-11-02 03:47:23 +01:00
parent ae9173f7ec
commit 646a341f52
2 changed files with 6 additions and 2 deletions

View File

@ -672,8 +672,8 @@ if mobs_spawn then
return return
end end
end end
if minetest.registered_entities[mob_def.name].can_spawn and not minetest.registered_entities[mob_def.name].can_spawn(pos) then if minetest.registered_entities[mob_def.name].can_spawn and not minetest.registered_entities[mob_def.name].can_spawn(spawning_position) then
minetest.log("warning","[mcl_mobs] mob "..mob_def.name.." refused to spawn at "..minetest.pos_to_string(vector.round(pos))) minetest.log("warning","[mcl_mobs] mob "..mob_def.name.." refused to spawn at "..minetest.pos_to_string(vector.round(spawning_position)))
return return
end end
--everything is correct, spawn mob --everything is correct, spawn mob

View File

@ -60,6 +60,10 @@ local strider = {
fire_resistant = true, fire_resistant = true,
floats_on_lava = 1, floats_on_lava = 1,
floats = 0, floats = 0,
can_spawn = function(pos)
local l = minetest.find_node_near(pos,2,{"mcl_nether:nether_lava_source","mcl_nether:nether_lava_flowing"})
return l ~= nil
end,
do_custom = function(self, dtime) do_custom = function(self, dtime)
if minetest.find_node_near(self.object:get_pos(), 2, {"mcl_core:lava_source","mcl_core:lava_flowing","mcl_nether:nether_lava_source","mcl_nether:nether_lava_flowing"}) then if minetest.find_node_near(self.object:get_pos(), 2, {"mcl_core:lava_source","mcl_core:lava_flowing","mcl_nether:nether_lava_source","mcl_nether:nether_lava_flowing"}) then