From 1e3b620482835d2ffd676dc041171f7d1286b02c Mon Sep 17 00:00:00 2001 From: LeMagnesium Date: Mon, 23 Mar 2015 19:58:09 +0100 Subject: [PATCH] Wrap lines and added exceptions on creeper's explosions - Stuff contained in default:chest will be dropped as are items when player die - Steel doors and locked chests won't be affected by explosions - If part of a wooden door is destroyed, the second part is too --- mods/mobs/api.lua | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/mods/mobs/api.lua b/mods/mobs/api.lua index ec5ab2dc..ba6b117d 100755 --- a/mods/mobs/api.lua +++ b/mods/mobs/api.lua @@ -606,8 +606,27 @@ 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 minetest.get_item_group(n.name, "unbreakable") ~= 1 and next(areas:getAreasAtPos(np)) == nil then + if n.name ~= "air" and n.name ~= "doors:door_steel_b_1" and n.name ~= "doors:door_steel_t_1" + and n.name ~= "doors:door_steel_b_2" and n.name ~= "doors:door_steel_t_2" + and n.name ~= "default:chest_locked" 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 + if n.name == "default:chest" then + meta = minetest.get_meta(np) + inv = meta:get_inventory() + for i = 1,32 do + m_stack = inv:get_stack("main",i) + obj = minetest.add_item(pos,m_stack) + if obj then + obj:setvelocity({x=math.random(-1,1), y=5, z=math.random(-1,1)}) + end + end + end + if n.name == "doors:door_wood_b_1" then + minetest.remove_node({x=np.x,y=np.y+1,z=np.z}) + elseif n.name == "doors:door_wood_t_1" then + minetest.remove_node({x=np.x,y=np.y-1,z=np.z}) + end minetest.remove_node(np) nodeupdate(np) --[[ if n.name ~= "tnt:tnt" and math.random() > 0.9 then