]> git.lizzy.rs Git - Crafter.git/commitdiff
Fix cake not replenishing hunger
authoroilboi <47129783+oilboi@users.noreply.github.com>
Mon, 25 May 2020 19:58:00 +0000 (15:58 -0400)
committeroilboi <47129783+oilboi@users.noreply.github.com>
Mon, 25 May 2020 19:58:00 +0000 (15:58 -0400)
mods/cake/init.lua

index 9d7d9d1a8f8d8f2723805d6b851e6b1fe0215040..e5425a5bfa31c1e26c7dacc8a124f3b6c4d0a7c9 100644 (file)
@@ -3,6 +3,15 @@
 -- Namespace: test
 -- 
 -- the higher it is the more it's "eaten"
+
+minetest.register_food("cake:cake_item_placeholder",{
+       description = "",
+       texture = "nothing.png",
+       satiation=10,
+       hunger=6,
+})
+
+
 for i = 0,13 do
        local missing_slice
        if i == 0 then
@@ -38,7 +47,7 @@ for i = 0,13 do
                        end
                end,
                on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
-                       minetest.eat_food(clicker,node)
+                       minetest.eat_food(clicker,"cake:cake_item_placeholder")
                        --clicker:set_hp(clicker:get_hp()+5)
                        if i == 13 then
                        minetest.sound_play("eat_finish",{pos=pos,gain=0.2,pitch=math.random(90,100)/100})
@@ -85,6 +94,7 @@ for i = 0,13 do
                        timer:start(0.2)
                end,
                on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
+                       minetest.eat_food(clicker,"cake:cake_item_placeholder")
                        clicker:set_hp(clicker:get_hp()-5)
                end,
                on_timer = function(pos, elapsed)