2015-06-29 20:55:56 +03:00
--[[
#!#!#!#Cake mod created by Jordan4ibanez#!#!#
#!#!#!#Released under CC Attribution-ShareAlike 3.0 Unported #!#!#
] ] --
2017-01-24 03:31:49 +02:00
local cake_texture = { " cake_top.png " , " cake_bottom.png " , " cake_inner.png " , " cake_side.png " , " cake_side.png " , " cake_side.png " }
local slice_1 = { - 7 / 16 , - 8 / 16 , - 7 / 16 , - 5 / 16 , 0 / 16 , 7 / 16 }
2017-02-28 01:01:51 +02:00
local slice_2 = { - 7 / 16 , - 8 / 16 , - 7 / 16 , - 3 / 16 , 0 / 16 , 7 / 16 }
local slice_3 = { - 7 / 16 , - 8 / 16 , - 7 / 16 , - 1 / 16 , 0 / 16 , 7 / 16 }
local slice_4 = { - 7 / 16 , - 8 / 16 , - 7 / 16 , 1 / 16 , 0 / 16 , 7 / 16 }
local slice_5 = { - 7 / 16 , - 8 / 16 , - 7 / 16 , 3 / 16 , 0 / 16 , 7 / 16 }
local slice_6 = { - 7 / 16 , - 8 / 16 , - 7 / 16 , 5 / 16 , 0 / 16 , 7 / 16 }
local full_cake = { - 7 / 16 , - 8 / 16 , - 7 / 16 , 7 / 16 , 0 / 16 , 7 / 16 }
2015-06-29 20:55:56 +03:00
minetest.register_craft ( {
2017-01-16 22:13:26 +02:00
output = " mcl_cake:cake " ,
2015-06-29 20:55:56 +03:00
recipe = {
2017-01-17 02:09:11 +02:00
{ ' mcl_mobitems:milk_bucket ' , ' mcl_mobitems:milk_bucket ' , ' mcl_mobitems:milk_bucket ' } ,
2017-02-01 00:32:56 +02:00
{ ' mcl_core:sugar ' , ' mcl_throwing:egg ' , ' mcl_core:sugar ' } ,
2017-02-11 22:38:25 +02:00
{ ' mcl_farming:wheat_item ' , ' mcl_farming:wheat_item ' , ' mcl_farming:wheat_item ' } ,
2015-06-29 20:55:56 +03:00
} ,
2017-01-17 02:09:11 +02:00
replacements = {
{ " mcl_mobitems:milk_bucket " , " bucket:bucket_empty " } ,
{ " mcl_mobitems:milk_bucket " , " bucket:bucket_empty " } ,
{ " mcl_mobitems:milk_bucket " , " bucket:bucket_empty " } ,
} ,
2015-06-29 20:55:56 +03:00
} )
2017-01-16 22:13:26 +02:00
minetest.register_node ( " mcl_cake:cake " , {
2015-06-29 20:55:56 +03:00
description = " Cake " ,
2017-03-11 02:53:29 +02:00
_doc_items_longdesc = " Cakes can be placed and eaten to restore hunger points. A cake has 7 slices and each slice restores 2 hunger points. Cakes will be destroyed when dug or when the block below them is broken. " ,
_doc_items_usagehelp = " Place the cake anywhere, then rightclick it to eat a single slice. " ,
2015-06-29 20:55:56 +03:00
tiles = { " cake_top.png " , " cake_bottom.png " , " cake_side.png " , " cake_side.png " , " cake_side.png " , " cake_side.png " } ,
2017-01-16 21:59:07 +02:00
inventory_image = " cake.png " ,
wield_image = " cake.png " ,
2015-06-29 20:55:56 +03:00
paramtype = " light " ,
2017-01-04 23:36:51 +02:00
is_ground_content = false ,
2015-06-29 20:55:56 +03:00
drawtype = " nodebox " ,
selection_box = {
type = " fixed " ,
2017-02-28 01:01:51 +02:00
fixed = full_cake
2015-06-29 20:55:56 +03:00
} ,
node_box = {
type = " fixed " ,
2017-02-28 01:01:51 +02:00
fixed = full_cake
} ,
2015-06-29 20:55:56 +03:00
stack_max = 1 ,
2017-03-29 23:58:31 +03:00
groups = { handy = 1 , food = 2 , attached_node = 1 , dig_by_piston = 1 } ,
2015-06-29 20:55:56 +03:00
drop = ' ' ,
on_rightclick = function ( pos , node , clicker , itemstack )
2017-02-28 01:01:51 +02:00
minetest.do_item_eat ( 2 , ItemStack ( " mcl_cake:cake_6 " ) , ItemStack ( " mcl_cake:cake " ) , clicker , { type = " nothing " } )
minetest.add_node ( pos , { type = " node " , name = " mcl_cake:cake_6 " , param2 = 0 } )
2015-06-29 20:55:56 +03:00
end ,
2017-02-11 19:46:23 +02:00
sounds = mcl_sounds.node_sound_leaves_defaults ( ) ,
2017-02-16 16:25:07 +02:00
_food_particles = false ,
2017-05-20 18:45:04 +03:00
_mcl_saturation = 0.4 ,
2017-02-27 02:13:03 +02:00
_mcl_blast_resistance = 2.5 ,
2017-03-20 20:29:46 +02:00
_mcl_hardness = 0.5 ,
2015-06-29 20:55:56 +03:00
} )
2017-02-16 16:25:07 +02:00
2017-02-28 01:01:51 +02:00
local register_slice = function ( level , nodebox , desc )
local this = " mcl_cake:cake_ " .. level
local after_eat = " mcl_cake:cake_ " .. ( level - 1 )
local on_rightclick
if level > 1 then
on_rightclick = function ( pos , node , clicker , itemstack )
minetest.do_item_eat ( 2 , ItemStack ( after_eat ) , ItemStack ( this ) , clicker , { type = " nothing " } )
minetest.add_node ( pos , { type = " node " , name = after_eat , param2 = 0 } )
end
else
on_rightclick = function ( pos , node , clicker , itemstack )
minetest.do_item_eat ( 2 , ItemStack ( " mcl:cake:cake 0 " ) , ItemStack ( " mcl_cake:cake_1 " ) , clicker , { type = " nothing " } )
minetest.remove_node ( pos )
end
end
2017-02-16 16:25:07 +02:00
2017-02-28 01:01:51 +02:00
minetest.register_node ( this , {
description = desc ,
2017-03-02 20:53:53 +02:00
_doc_items_create_entry = false ,
2017-02-28 01:01:51 +02:00
tiles = cake_texture ,
paramtype = " light " ,
is_ground_content = false ,
drawtype = " nodebox " ,
selection_box = {
type = " fixed " ,
fixed = nodebox ,
2015-06-29 20:55:56 +03:00
} ,
2017-02-28 01:01:51 +02:00
node_box = {
type = " fixed " ,
fixed = nodebox ,
} ,
2017-03-29 23:58:31 +03:00
groups = { handy = 1 , food = 2 , attached_node = 1 , not_in_creative_inventory = 1 , dig_by_piston = 1 } ,
2017-02-28 01:01:51 +02:00
drop = ' ' ,
on_rightclick = on_rightclick ,
sounds = mcl_sounds.node_sound_leaves_defaults ( ) ,
2017-02-16 16:25:07 +02:00
2017-02-28 01:01:51 +02:00
_food_particles = false ,
2017-05-20 18:45:04 +03:00
_mcl_saturation = 0.4 ,
2017-02-28 01:01:51 +02:00
_mcl_blast_resistance = 2.5 ,
2017-03-20 20:29:46 +02:00
_mcl_hardness = 0.5 ,
2017-02-28 01:01:51 +02:00
} )
2017-03-20 19:12:05 +02:00
if minetest.get_modpath ( " doc " ) then
doc.add_entry_alias ( " nodes " , " mcl_cake:cake " , " nodes " , " mcl_cake:cake_ " .. level )
end
2017-02-28 01:01:51 +02:00
end
2017-02-16 16:25:07 +02:00
2017-02-28 01:01:51 +02:00
register_slice ( 6 , slice_6 , " Cake (6 Slices Left " )
register_slice ( 5 , slice_5 , " Cake (5 Slices Left " )
register_slice ( 4 , slice_4 , " Cake (4 Slices Left " )
register_slice ( 3 , slice_3 , " Cake (3 Slices Left " )
register_slice ( 2 , slice_2 , " Cake (2 Slices Left " )
register_slice ( 1 , slice_1 , " Cake (1 Slice Left " )