2021-01-06 14:50:49 +01: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 17:48:32 +02:00
|
|
|
function mobs:spawn_abm_check(pos, node, name)
|
2019-02-05 17:43:18 +01: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 17:48:32 +02:00
|
|
|
return true
|
2021-01-06 14:50:49 +01: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 17:43:18 +01:00
|
|
|
-- Spawn on opaque or liquid nodes
|
|
|
|
elseif minetest.get_item_group(node.name, "opaque") ~= 0 or minetest.registered_nodes[node.name].liquidtype ~= "none" then
|
2018-06-03 17:48:32 +02:00
|
|
|
return false
|
|
|
|
end
|
2021-01-06 14:50:49 +01:00
|
|
|
|
2019-02-05 17:43:18 +01:00
|
|
|
-- Reject everything else
|
2018-06-03 17:48:32 +02:00
|
|
|
return true
|
|
|
|
end
|