summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLNJ <git@lnj.li>2017-04-05 12:32:41 +0200
committerLNJ <git@lnj.li>2017-04-05 14:53:16 +0200
commit03e692d72a9772fc6d5ca875ff7416e333cb01fb (patch)
tree3cb9bde0bc36de578aa8e6778a5b887c14d928f2
parent768edb4d09f651c1ad732bde9c04b50fd69bcf30 (diff)
Fix drawer initialization bug; used wrong meta fields for 1x1 Drawers
-rwxr-xr-xlua/api.lua15
-rwxr-xr-xlua/visual.lua1
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