From 2dbda44a93e91973001066170d3bd024e7fe4bd4 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Sun, 3 Jun 2018 17:48:32 +0200 Subject: [PATCH] Add some global spawn restrictions - no monsters on mycelium - nothing on non-opaque blocks, except air --- mods/ENTITIES/mobs_mc/5_spawn_abm_check.lua | 10 ++++++++++ mods/ENTITIES/mobs_mc/init.lua | 2 ++ 2 files changed, 12 insertions(+) create mode 100644 mods/ENTITIES/mobs_mc/5_spawn_abm_check.lua diff --git a/mods/ENTITIES/mobs_mc/5_spawn_abm_check.lua b/mods/ENTITIES/mobs_mc/5_spawn_abm_check.lua new file mode 100644 index 00000000..35a3c344 --- /dev/null +++ b/mods/ENTITIES/mobs_mc/5_spawn_abm_check.lua @@ -0,0 +1,10 @@ +function mobs:spawn_abm_check(pos, node, name) + if (node.name == "air") then + return true + elseif (node.name == "mcl_core:mycelium" or node.name == "mcl_core:mycelium_snow") and minetest.registered_entities[name].type == "monster" then + return false + elseif minetest.get_item_group(node.name, "opaque") ~= 0 then + return false + end + return true +end diff --git a/mods/ENTITIES/mobs_mc/init.lua b/mods/ENTITIES/mobs_mc/init.lua index e2ec3400..3206c0ba 100644 --- a/mods/ENTITIES/mobs_mc/init.lua +++ b/mods/ENTITIES/mobs_mc/init.lua @@ -38,6 +38,8 @@ dofile(path .. "/3_shared.lua") --Mob heads dofile(path .. "/4_heads.lua") +dofile(path .. "/5_spawn_abm_check.lua") + -- Animals dofile(path .. "/bat.lua") -- Mesh and animation by toby109tt / https://github.com/22i dofile(path .. "/rabbit.lua") -- Mesh and animation byExeterDad