1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-09-28 23:40:34 +02:00

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
This commit is contained in:
crabman77 2015-03-23 18:47:58 +01:00
parent 391df6d6e2
commit 25a0080980

View File

@ -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