0
0
Fork 0

More Minecraft-like cake behaviour

This commit is contained in:
Wuzzy 2017-01-16 21:10:55 +01:00
parent fa9937d55a
commit 22cb7930b6
2 changed files with 14 additions and 6 deletions

1
mods/cake/depends.txt Normal file
View File

@ -0,0 +1 @@
default

View File

@ -39,14 +39,16 @@ minetest.register_node("cake:cake", {
fixed = slice_6 fixed = slice_6
}, },
stack_max = 1, stack_max = 1,
groups = {food=2,crumbly=3,falling_node=1}, groups = {food=2,crumbly=3,attached_node=1},
drop = '', drop = '',
on_rightclick = function(pos, node, clicker, itemstack) on_rightclick = function(pos, node, clicker, itemstack)
minetest.item_eat(2)
if clicker:get_hp() < 20 then if clicker:get_hp() < 20 then
clicker:set_hp(clicker:get_hp()+2) clicker:set_hp(clicker:get_hp()+2)
minetest.add_node(pos,{type="node",name="cake:cake_5",param2=param2}) minetest.add_node(pos,{type="node",name="cake:cake_5",param2=param2})
end end
end, end,
sounds = default.node_sound_leaves_defaults(),
}) })
minetest.register_node("cake:cake_5", { minetest.register_node("cake:cake_5", {
description = "Cake (5 Slices Left)", description = "Cake (5 Slices Left)",
@ -62,7 +64,7 @@ minetest.register_node("cake:cake_5", {
type = "fixed", type = "fixed",
fixed = slice_5 fixed = slice_5
}, },
groups = {food=2,crumbly=3,falling_node=1,not_in_creative_inventory=1}, groups = {food=2,crumbly=3,attached_node=1,not_in_creative_inventory=1},
drop = '', drop = '',
on_rightclick = function(pos, node, clicker, itemstack) on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then if clicker:get_hp() < 20 then
@ -70,6 +72,7 @@ minetest.register_node("cake:cake_5", {
minetest.add_node(pos,{type="node",name="cake:cake_4",param2=param2}) minetest.add_node(pos,{type="node",name="cake:cake_4",param2=param2})
end end
end, end,
sounds = default.node_sound_leaves_defaults(),
}) })
minetest.register_node("cake:cake_4", { minetest.register_node("cake:cake_4", {
description = "Cake (4 Slices Left)", description = "Cake (4 Slices Left)",
@ -85,7 +88,7 @@ minetest.register_node("cake:cake_4", {
type = "fixed", type = "fixed",
fixed = slice_4 fixed = slice_4
}, },
groups = {food=2,crumbly=3,falling_node=1,not_in_creative_inventory=1}, groups = {food=2,crumbly=3,attached_node=1,not_in_creative_inventory=1},
drop = '', drop = '',
on_rightclick = function(pos, node, clicker, itemstack) on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then if clicker:get_hp() < 20 then
@ -93,6 +96,7 @@ minetest.register_node("cake:cake_4", {
minetest.add_node(pos,{type="node",name="cake:cake_3",param2=param2}) minetest.add_node(pos,{type="node",name="cake:cake_3",param2=param2})
end end
end, end,
sounds = default.node_sound_leaves_defaults(),
}) })
minetest.register_node("cake:cake_3", { minetest.register_node("cake:cake_3", {
description = "Cake (3 Slices Left)", description = "Cake (3 Slices Left)",
@ -108,7 +112,7 @@ minetest.register_node("cake:cake_3", {
type = "fixed", type = "fixed",
fixed = slice_3 fixed = slice_3
}, },
groups = {food=2,crumbly=3,falling_node=1,not_in_creative_inventory=1}, groups = {food=2,crumbly=3,attached_node=1,not_in_creative_inventory=1},
drop = '', drop = '',
on_rightclick = function(pos, node, clicker, itemstack) on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then if clicker:get_hp() < 20 then
@ -116,6 +120,7 @@ minetest.register_node("cake:cake_3", {
minetest.add_node(pos,{type="node",name="cake:cake_2",param2=param2}) minetest.add_node(pos,{type="node",name="cake:cake_2",param2=param2})
end end
end, end,
sounds = default.node_sound_leaves_defaults(),
}) })
minetest.register_node("cake:cake_2", { minetest.register_node("cake:cake_2", {
description = "Cake (2 Slices Left)", description = "Cake (2 Slices Left)",
@ -131,7 +136,7 @@ minetest.register_node("cake:cake_2", {
type = "fixed", type = "fixed",
fixed = slice_2 fixed = slice_2
}, },
groups = {food=2,crumbly=3,falling_node=1,not_in_creative_inventory=1}, groups = {food=2,crumbly=3,attached_node=1,not_in_creative_inventory=1},
drop = '', drop = '',
on_rightclick = function(pos, node, clicker, itemstack) on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then if clicker:get_hp() < 20 then
@ -139,6 +144,7 @@ minetest.register_node("cake:cake_2", {
minetest.add_node(pos,{type="node",name="cake:cake_1",param2=param2}) minetest.add_node(pos,{type="node",name="cake:cake_1",param2=param2})
end end
end, end,
sounds = default.node_sound_leaves_defaults(),
}) })
minetest.register_node("cake:cake_1", { minetest.register_node("cake:cake_1", {
description = "Cake (1 Slice Left)", description = "Cake (1 Slice Left)",
@ -154,7 +160,7 @@ minetest.register_node("cake:cake_1", {
type = "fixed", type = "fixed",
fixed = slice_1 fixed = slice_1
}, },
groups = {food=2,crumbly=3,falling_node=1,not_in_creative_inventory=1}, groups = {food=2,crumbly=3,attached_node=1,not_in_creative_inventory=1},
drop = '', drop = '',
on_rightclick = function(pos, node, clicker, itemstack) on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then if clicker:get_hp() < 20 then
@ -162,4 +168,5 @@ minetest.register_node("cake:cake_1", {
minetest.remove_node(pos) minetest.remove_node(pos)
end end
end, end,
sounds = default.node_sound_leaves_defaults(),
}) })