From 3af73463c5d02d0c3a168443bfeb6590d9af2eb2 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 8 Feb 2017 17:02:45 +0100 Subject: [PATCH] Make clocks stackable to 64 --- mods/mcl_clock/init.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/mods/mcl_clock/init.lua b/mods/mcl_clock/init.lua index 328d43e5e..0863ed5ec 100644 --- a/mods/mcl_clock/init.lua +++ b/mods/mcl_clock/init.lua @@ -28,12 +28,12 @@ function watch.register_item(name, image, creative) if creative then g = 0 end - minetest.register_tool(name, { + minetest.register_craftitem(name, { description = "Clock", inventory_image = image, groups = {not_in_creative_inventory=g, tool=1, clock=1}, wield_image = "", - stack_max = 1, + stack_max = 64, }) end @@ -55,10 +55,11 @@ minetest.register_globalstep(function(dtime) local players = minetest.get_connected_players() for p, player in ipairs(players) do for s, stack in ipairs(player:get_inventory():get_list("main")) do + local count = stack:get_count() if stack:get_name() == "mcl_clock:clock" then - player:get_inventory():set_stack("main", s, "mcl_clock:clock_"..now) + player:get_inventory():set_stack("main", s, "mcl_clock:clock_"..now.." "..count) elseif string.sub(stack:get_name(), 1, 16) == "mcl_clock:clock_" then - player:get_inventory():set_stack("main", s, "mcl_clock:clock_"..now) + player:get_inventory():set_stack("main", s, "mcl_clock:clock_"..now.." "..count) end end end