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

@ -229,3 +229,45 @@ minetest.register_craft({
{'fun_caves:dry_fiber', '', 'fun_caves:dry_fiber'}, {'fun_caves:dry_fiber', '', 'fun_caves:dry_fiber'},
} }
}) })
minetest.register_craftitem("fun_caves:apple_pie_slice", {
description = "Apple Pie",
inventory_image = "fun_caves_apple_pie_slice.png",
on_use = minetest.item_eat(5),
})
minetest.register_craft({
output = 'fun_caves:apple_pie_slice 6',
type = 'shapeless',
recipe = {
'fun_caves:apple_pie',
}
})
minetest.register_craftitem("fun_caves:apple_pie", {
description = "Apple Pie",
inventory_image = "fun_caves_apple_pie.png",
})
minetest.register_craftitem("fun_caves:apple_pie_uncooked", {
description = "Uncooked Apple Pie",
inventory_image = "fun_caves_apple_pie_uncooked.png",
})
minetest.register_craft({
output = 'fun_caves:apple_pie_uncooked',
type = 'shapeless',
recipe = {
'default:apple',
'default:apple',
'farming:flour',
'mobs:honey',
}
})
minetest.register_craft({
type = "cooking",
cooktime = 15,
output = "fun_caves:apple_pie",
recipe = "fun_caves:apple_pie_uncooked"
})

View file

@ -59,7 +59,7 @@ local function floor(pos, blocks, node_name, user_name)
p.x = pos.x + x p.x = pos.x + x
local node = minetest.get_node_or_nil(p) 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}) minetest.set_node(p, {name = node_name})
count = count + 1 count = count + 1
if count > blocks then if count > blocks then
@ -83,16 +83,26 @@ for _, node in pairs(nodes) do
end end
local newnode = fun_caves.clone_node(node_name) local newnode = fun_caves.clone_node(node_name)
local _, d_name = node_name:match('(.*:)(.*)') 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) 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.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.inventory_image = '[inventorycube{tnt_top.png{'..node_texture..'{tnt_side.png'
newnode.drop = bomb_name
newnode.on_punch = function(pos, node, puncher, pointed_thing) 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() 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) disintigrate(pos, 5, node_name, puncher:get_player_name(), comp)
minetest.remove_node(pos) minetest.remove_node(pos)
end) end)
end end
minetest.register_node("fun_caves:"..d_name..'_bomb', newnode) minetest.register_node(bomb_name, newnode)
minetest.register_craft({ minetest.register_craft({
output = "fun_caves:"..d_name..'_bomb', output = "fun_caves:"..d_name..'_bomb',
@ -115,18 +125,27 @@ for _, node in pairs(nodes) do
node_texture = node_texture[1] node_texture = node_texture[1]
end end
local _, d_name = node_name:match('(.*:)(.*)') 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 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) local newnode = fun_caves.clone_node(node_name)
newnode.description = d_name_u.." Floor Bomb" newnode.description = d_name_u.." Floor Bomb"
newnode.inventory_image = '[inventorycube{'..node_texture..'{'..node_texture..'{'..node_texture..'^fun_caves_expand.png' 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) 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() 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()) floor(pos, 100, node_name, puncher:get_player_name())
minetest.set_node(pos, {name = node_name}) minetest.set_node(pos, {name = node_name})
end) end)
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 if not minetest.registered_items[comp] then
newnode = fun_caves.clone_node(node_name) newnode = fun_caves.clone_node(node_name)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB