From 25a0080980de6bfa7f15c74c2414635256e678e7 Mon Sep 17 00:00:00 2001 From: crabman77 Date: Mon, 23 Mar 2015 18:47:58 +0100 Subject: [PATCH] add creeper explosion don't destruct areas and unbreakable nodes add creeper explosion don't destruct areas and unbreakable nodes fix mobs crash if spawn on unknown node --- mods/mobs/api.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua index 65253981..ec5ab2dc 100755 --- a/mods/mobs/api.lua +++ b/mods/mobs/api.lua @@ -606,7 +606,7 @@ function mobs:register_mob(name, def) if x*x+y*y+z*z <= 3 * 3 + 3 then local np={x=pos.x+x,y=pos.y+y,z=pos.z+z} local n = minetest.get_node(np) - if n.name ~= "air" and n.name ~= "default:obsidian" and n.name ~= "default:bedrock" and n.name ~= "protector:protect" then + if n.name ~= "air" and n.name ~= "default:obsidian" and n.name ~= "default:bedrock" and minetest.get_item_group(n.name, "unbreakable") ~= 1 and next(areas:getAreasAtPos(np)) == nil then --activate_if_tnt(n.name, np, pos, 3) -- Pas de module TNT sur le serveur donc inutile minetest.remove_node(np) nodeupdate(np) @@ -946,7 +946,7 @@ function mobs:register_spawn(name, nodes, max_light, min_light, chance, active_o -- are we spawning inside a solid node? local nod = minetest.get_node_or_nil(pos) - if not nod or minetest.registered_nodes[nod.name].walkable == true then return end + if not nod or not minetest.registered_nodes[nod] or minetest.registered_nodes[nod.name].walkable == true then return end pos.y = pos.y + 1 nod = minetest.get_node_or_nil(pos) if not nod or minetest.registered_nodes[nod.name].walkable == true then return end