diff --git a/api-manual.txt b/api-manual.txt index 000121d..034f793 100644 --- a/api-manual.txt +++ b/api-manual.txt @@ -51,6 +51,7 @@ If you want to use one of the default explosion types you have to include the ex -"pool" --spawns a "pool" of the specified block and size, see the lava_bomb as example -"sphere" --spawns a cube of the block specified of the specified size -"sphere_shell" + -"sphere_cover" --covers the ground inside an imaginary sphere with block -"cubic_shell" -"column" --see water column bomb as example -"circle" --see Fire circle bomb diff --git a/bombs_api.lua b/bombs_api.lua index 4a2448b..1763037 100644 --- a/bombs_api.lua +++ b/bombs_api.lua @@ -139,6 +139,23 @@ function default_hit_node(self, explosion) end end end + elseif shape == "sphere_cover" then + for dx = -radius,radius do + for dy = radius,-radius,-1 do + for dz = -radius,radius do + local pos1 = {x = p.x+dx, y=p.y+dy, z=p.z+dz} + if math.abs(vector.length(vector.subtract(pos1,p))) <= radius then + local node_at = minetest.get_node_or_nil(pos1) + local node_below = minetest.get_node_or_nil({x=pos1.x, y=pos1.y-1, z=pos1.z}) + if node_at and node_below and node_at.name == 'air' and node_below.name ~= 'air' then + if not minetest.is_protected(pos1, "") or not minetest.get_item_group(minetest.get_node(pos1).name, "unbreakable") == 1 then + minetest.set_node(pos1, {name=block}) + end + end + end + end + end + end elseif shape == "cubic_shell" then center.y = p.y + radius for dx = -radius,radius do