Add apple pie. Allow digging bombs.

This commit is contained in:
Duane 2016-07-10 05:57:36 -05:00
parent 186abc20f3
commit 4cfa301cea
5 changed files with 64 additions and 3 deletions

View file

@ -59,7 +59,7 @@ local function floor(pos, blocks, node_name, user_name)
p.x = pos.x + x
local node = minetest.get_node_or_nil(p)
if node and node.name == 'air' and not minetest.is_protected(p, user_name) then
if node and (node.name == 'air' or node.name == 'default:water_source') and not minetest.is_protected(p, user_name) then
minetest.set_node(p, {name = node_name})
count = count + 1
if count > blocks then
@ -83,16 +83,26 @@ for _, node in pairs(nodes) do
end
local newnode = fun_caves.clone_node(node_name)
local _, d_name = node_name:match('(.*:)(.*)')
local bomb_name = "fun_caves:"..d_name..'_bomb'
local d_name_u = d_name:gsub("(%l)(%w*)", function(a,b) return string.upper(a)..b end)
newnode.description = d_name_u.." Bomb"
newnode.tiles = {'tnt_top.png', 'tnt_bottom.png', newnode.tiles[1]}
newnode.inventory_image = '[inventorycube{tnt_top.png{'..node_texture..'{tnt_side.png'
newnode.drop = bomb_name
newnode.on_punch = function(pos, node, puncher, pointed_thing)
if puncher:get_wielded_item():get_name() ~= "default:torch" then
return
end
minetest.after(5, function()
local pos_node = minetest.get_node_or_nil(pos)
if pos_node.name ~= bomb_name then
return
end
disintigrate(pos, 5, node_name, puncher:get_player_name(), comp)
minetest.remove_node(pos)
end)
end
minetest.register_node("fun_caves:"..d_name..'_bomb', newnode)
minetest.register_node(bomb_name, newnode)
minetest.register_craft({
output = "fun_caves:"..d_name..'_bomb',
@ -115,18 +125,27 @@ for _, node in pairs(nodes) do
node_texture = node_texture[1]
end
local _, d_name = node_name:match('(.*:)(.*)')
local bomb_name = "fun_caves:"..d_name..'_floor_bomb'
local d_name_u = d_name:gsub("(%l)(%w*)", function(a,b) return string.upper(a)..b end)
local newnode = fun_caves.clone_node(node_name)
newnode.description = d_name_u.." Floor Bomb"
newnode.inventory_image = '[inventorycube{'..node_texture..'{'..node_texture..'{'..node_texture..'^fun_caves_expand.png'
newnode.drop = bomb_name
newnode.on_punch = function(pos, node, puncher, pointed_thing)
if puncher:get_wielded_item():get_name() ~= "default:torch" then
return
end
minetest.after(5, function()
local pos_node = minetest.get_node_or_nil(pos)
if pos_node.name ~= bomb_name then
return
end
floor(pos, 100, node_name, puncher:get_player_name())
minetest.set_node(pos, {name = node_name})
end)
end
minetest.register_node("fun_caves:"..d_name..'_floor_bomb', newnode)
minetest.register_node(bomb_name, newnode)
if not minetest.registered_items[comp] then
newnode = fun_caves.clone_node(node_name)