1
0
mirror of https://github.com/sys4-fr/server-nalc.git synced 2024-11-16 23:40:31 +01: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 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 np={x=pos.x+x,y=pos.y+y,z=pos.z+z}
local n = minetest.get_node(np) 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 --activate_if_tnt(n.name, np, pos, 3) -- Pas de module TNT sur le serveur donc inutile
minetest.remove_node(np) minetest.remove_node(np)
nodeupdate(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? -- are we spawning inside a solid node?
local nod = minetest.get_node_or_nil(pos) 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 pos.y = pos.y + 1
nod = minetest.get_node_or_nil(pos) 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 minetest.registered_nodes[nod.name].walkable == true then return end