From 03e692d72a9772fc6d5ca875ff7416e333cb01fb Mon Sep 17 00:00:00 2001 From: LNJ Date: Wed, 5 Apr 2017 12:32:41 +0200 Subject: [PATCH] Fix drawer initialization bug; used wrong meta fields for 1x1 Drawers --- lua/api.lua | 15 +++++++++------ lua/visual.lua | 1 - 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/lua/api.lua b/lua/api.lua index 71af49b..414245e 100755 --- a/lua/api.lua +++ b/lua/api.lua @@ -48,13 +48,16 @@ function drawers.drawer_on_construct(pos) i = 1 while i <= drawerType do - meta:set_string("name"..i, "") - meta:set_int("count"..i, 0) - meta:set_int("max_count"..i, base_stack_max * stack_max_factor) - meta:set_int("base_stack_max"..i, base_stack_max) - meta:set_string("entity_infotext"..i, drawers.gen_info_text("Empty", 0, + local vid = i + -- 1x1 drawers don't have numbers in the meta fields + if drawerType == 1 then vid = "" end + meta:set_string("name"..vid, "") + meta:set_int("count"..vid, 0) + meta:set_int("max_count"..vid, base_stack_max * stack_max_factor) + meta:set_int("base_stack_max"..vid, base_stack_max) + meta:set_string("entity_infotext"..vid, drawers.gen_info_text("Empty", 0, stack_max_factor, base_stack_max)) - meta:set_int("stack_max_factor"..i, stack_max_factor) + meta:set_int("stack_max_factor"..vid, stack_max_factor) i = i + 1 end diff --git a/lua/visual.lua b/lua/visual.lua index 3ddd20a..f0d3cc6 100755 --- a/lua/visual.lua +++ b/lua/visual.lua @@ -91,7 +91,6 @@ core.register_entity("drawers:visual", { -- visual size local visual_size = {x = 0.6, y = 0.6} if self.drawerType >= 2 then - core.chat_send_all("small") visual_size = {x = 0.3, y = 0.3} end