1
0
Fork 0
MineClone2/mods/cake/init.lua

173 lines
4.9 KiB
Lua
Raw Normal View History

2015-06-29 19:55:56 +02:00
--[[
#!#!#!#Cake mod created by Jordan4ibanez#!#!#
#!#!#!#Released under CC Attribution-ShareAlike 3.0 Unported #!#!#
]]--
cake_texture = {"cake_top.png","cake_bottom.png","cake_inner.png","cake_side.png","cake_side.png","cake_side.png"}
slice_1 = { -7/16, -8/16, -7/16, -5/16, 0/16, 7/16}
slice_2 = { -7/16, -8/16, -7/16, -2/16, 0/16, 7/16}
slice_3 = { -7/16, -8/16, -7/16, 1/16, 0/16, 7/16}
slice_4 = { -7/16, -8/16, -7/16, 3/16, 0/16, 7/16}
slice_5 = { -7/16, -8/16, -7/16, 5/16, 0/16, 7/16}
slice_6 = { -7/16, -8/16, -7/16, 7/16, 0/16, 7/16}
2017-01-10 03:43:31 +01:00
-- FIXME: Recipe. milk instead of water bucket and egg instead of leaves
2015-06-29 19:55:56 +02:00
minetest.register_craft({
output = "cake:cake",
recipe = {
{'bucket:bucket_water', 'bucket:bucket_water', 'bucket:bucket_water'},
{'default:sugar', 'default:leaves', 'default:sugar'},
{'farming:wheat_harvested', 'farming:wheat_harvested', 'farming:wheat_harvested'},
},
replacements = {{"bucket:bucket_water", "bucket:bucket_empty"}},
})
minetest.register_node("cake:cake", {
description = "Cake",
tiles = {"cake_top.png","cake_bottom.png","cake_side.png","cake_side.png","cake_side.png","cake_side.png"},
2017-01-16 20:59:07 +01:00
inventory_image = "cake.png",
wield_image = "cake.png",
2015-06-29 19:55:56 +02:00
paramtype = "light",
is_ground_content = false,
2015-06-29 19:55:56 +02:00
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = slice_6
},
node_box = {
type = "fixed",
fixed = slice_6
},
stack_max = 1,
2017-01-16 21:10:55 +01:00
groups = {food=2,crumbly=3,attached_node=1},
2015-06-29 19:55:56 +02:00
drop = '',
on_rightclick = function(pos, node, clicker, itemstack)
2017-01-16 21:10:55 +01:00
minetest.item_eat(2)
2015-06-29 19:55:56 +02:00
if clicker:get_hp() < 20 then
clicker:set_hp(clicker:get_hp()+2)
minetest.add_node(pos,{type="node",name="cake:cake_5",param2=param2})
2015-06-29 19:55:56 +02:00
end
end,
2017-01-16 21:10:55 +01:00
sounds = default.node_sound_leaves_defaults(),
2015-06-29 19:55:56 +02:00
})
minetest.register_node("cake:cake_5", {
description = "Cake (5 Slices Left)",
2015-06-29 19:55:56 +02:00
tiles = cake_texture,
paramtype = "light",
is_ground_content = false,
2015-06-29 19:55:56 +02:00
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = slice_5
},
node_box = {
type = "fixed",
fixed = slice_5
},
2017-01-16 21:10:55 +01:00
groups = {food=2,crumbly=3,attached_node=1,not_in_creative_inventory=1},
2015-06-29 19:55:56 +02:00
drop = '',
on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then
clicker:set_hp(clicker:get_hp()+2)
minetest.add_node(pos,{type="node",name="cake:cake_4",param2=param2})
2015-06-29 19:55:56 +02:00
end
end,
2017-01-16 21:10:55 +01:00
sounds = default.node_sound_leaves_defaults(),
2015-06-29 19:55:56 +02:00
})
minetest.register_node("cake:cake_4", {
description = "Cake (4 Slices Left)",
2015-06-29 19:55:56 +02:00
tiles = cake_texture,
paramtype = "light",
is_ground_content = false,
2015-06-29 19:55:56 +02:00
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = slice_4
},
node_box = {
type = "fixed",
fixed = slice_4
},
2017-01-16 21:10:55 +01:00
groups = {food=2,crumbly=3,attached_node=1,not_in_creative_inventory=1},
2015-06-29 19:55:56 +02:00
drop = '',
on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then
clicker:set_hp(clicker:get_hp()+2)
minetest.add_node(pos,{type="node",name="cake:cake_3",param2=param2})
2015-06-29 19:55:56 +02:00
end
end,
2017-01-16 21:10:55 +01:00
sounds = default.node_sound_leaves_defaults(),
2015-06-29 19:55:56 +02:00
})
minetest.register_node("cake:cake_3", {
description = "Cake (3 Slices Left)",
2015-06-29 19:55:56 +02:00
tiles = cake_texture,
paramtype = "light",
is_ground_content = false,
2015-06-29 19:55:56 +02:00
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = slice_3
},
node_box = {
type = "fixed",
fixed = slice_3
},
2017-01-16 21:10:55 +01:00
groups = {food=2,crumbly=3,attached_node=1,not_in_creative_inventory=1},
2015-06-29 19:55:56 +02:00
drop = '',
on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then
clicker:set_hp(clicker:get_hp()+2)
minetest.add_node(pos,{type="node",name="cake:cake_2",param2=param2})
2015-06-29 19:55:56 +02:00
end
end,
2017-01-16 21:10:55 +01:00
sounds = default.node_sound_leaves_defaults(),
2015-06-29 19:55:56 +02:00
})
minetest.register_node("cake:cake_2", {
description = "Cake (2 Slices Left)",
2015-06-29 19:55:56 +02:00
tiles = cake_texture,
paramtype = "light",
is_ground_content = false,
2015-06-29 19:55:56 +02:00
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = slice_2
},
node_box = {
type = "fixed",
fixed = slice_2
},
2017-01-16 21:10:55 +01:00
groups = {food=2,crumbly=3,attached_node=1,not_in_creative_inventory=1},
2015-06-29 19:55:56 +02:00
drop = '',
on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then
clicker:set_hp(clicker:get_hp()+2)
minetest.add_node(pos,{type="node",name="cake:cake_1",param2=param2})
2015-06-29 19:55:56 +02:00
end
end,
2017-01-16 21:10:55 +01:00
sounds = default.node_sound_leaves_defaults(),
2015-06-29 19:55:56 +02:00
})
minetest.register_node("cake:cake_1", {
description = "Cake (1 Slice Left)",
2015-06-29 19:55:56 +02:00
tiles = cake_texture,
paramtype = "light",
is_ground_content = false,
2015-06-29 19:55:56 +02:00
drawtype = "nodebox",
selection_box = {
type = "fixed",
fixed = slice_1
},
node_box = {
type = "fixed",
fixed = slice_1
},
2017-01-16 21:10:55 +01:00
groups = {food=2,crumbly=3,attached_node=1,not_in_creative_inventory=1},
2015-06-29 19:55:56 +02:00
drop = '',
on_rightclick = function(pos, node, clicker, itemstack)
if clicker:get_hp() < 20 then
clicker:set_hp(clicker:get_hp()+2)
minetest.remove_node(pos)
2015-06-29 19:55:56 +02:00
end
end,
2017-01-16 21:10:55 +01:00
sounds = default.node_sound_leaves_defaults(),
})