2021-01-06 16:50:49 +03:00
|
|
|
local function is_forbidden_node(pos, node)
|
|
|
|
node = node or minetest.get_node(pos)
|
|
|
|
return minetest.get_item_group(node.name, "stair") > 0 or minetest.get_item_group(node.name, "slab") > 0 or minetest.get_item_group(node.name, "carpet") > 0
|
|
|
|
end
|
|
|
|
|
2018-06-03 18:48:32 +03:00
|
|
|
function mobs:spawn_abm_check(pos, node, name)
|
2019-02-05 19:43:18 +03:00
|
|
|
-- Don't spawn monsters on mycelium
|
|
|
|
if (node.name == "mcl_core:mycelium" or node.name == "mcl_core:mycelium_snow") and minetest.registered_entities[name].type == "monster" then
|
2018-06-03 18:48:32 +03:00
|
|
|
return true
|
2021-01-06 16:50:49 +03:00
|
|
|
--Don't Spawn mobs on stairs, slabs, or carpets
|
|
|
|
elseif is_forbidden_node(pos, node) or is_forbidden_node(vector.add(pos, vector.new(0, 1, 0))) then
|
|
|
|
return true
|
2019-02-05 19:43:18 +03:00
|
|
|
-- Spawn on opaque or liquid nodes
|
2021-02-09 15:06:19 +03:00
|
|
|
elseif minetest.get_item_group(node.name, "opaque") ~= 0 or minetest.registered_nodes[node.name].liquidtype ~= "none" or node.name == "mcl_core:grass_path" then
|
2018-06-03 18:48:32 +03:00
|
|
|
return false
|
|
|
|
end
|
2021-01-06 16:50:49 +03:00
|
|
|
|
2019-02-05 19:43:18 +03:00
|
|
|
-- Reject everything else
|
2018-06-03 18:48:32 +03:00
|
|
|
return true
|
|
|
|
end
|