Never spawn mobs on leaves

This commit is contained in:
cora 2022-07-13 16:45:41 +02:00
parent 825da03ba3
commit 9e60d24fe0
1 changed files with 2 additions and 0 deletions

View File

@ -428,6 +428,7 @@ if mobs_spawn then
local is_water = get_item_group(gotten_node, "water") ~= 0 local is_water = get_item_group(gotten_node, "water") ~= 0
local is_lava = get_item_group(gotten_node, "lava") ~= 0 local is_lava = get_item_group(gotten_node, "lava") ~= 0
local is_leaf = get_item_group(gotten_node, "leaves") ~= 0
local is_ground = not (is_water or is_lava) local is_ground = not (is_water or is_lava)
local is_grass = minetest.get_item_group(gotten_node,"grass_block") ~= 0 local is_grass = minetest.get_item_group(gotten_node,"grass_block") ~= 0
local has_bed = minetest.find_node_near(pos,25,{"group:bed"}) local has_bed = minetest.find_node_near(pos,25,{"group:bed"})
@ -469,6 +470,7 @@ if mobs_spawn then
and gotten_light >= mob_def.min_light and gotten_light >= mob_def.min_light
and gotten_light <= mob_def.max_light and gotten_light <= mob_def.max_light
and (is_ground or mob_def.type_of_spawning ~= "ground") and (is_ground or mob_def.type_of_spawning ~= "ground")
and (mob_def.type_of_spawning ~= "ground" or not is_leaf)
and (mob_def.check_position and mob_def.check_position(spawning_position) or true) and (mob_def.check_position and mob_def.check_position(spawning_position) or true)
and (not is_farm_animal(mob_def.name) or is_grass) and (not is_farm_animal(mob_def.name) or is_grass)
and (mob_type ~= "npc" or has_bed) and (mob_type ~= "npc" or has_bed)