From 1862ddbef367dd1fd43cc7feb051e0b043e979ba Mon Sep 17 00:00:00 2001
From: LNJ <git@lnj.li>
Date: Sat, 1 Apr 2017 20:22:38 +0200
Subject: Fix bug: not removing items from stack if drawer is nearly full

---
 lua/visual.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'lua')

diff --git a/lua/visual.lua b/lua/visual.lua
index 8f99e5e..61b02a3 100755
--- a/lua/visual.lua
+++ b/lua/visual.lua
@@ -188,8 +188,8 @@ core.register_entity("drawers:visual", {
 		-- set new counts:
 		-- if new count is more than max_count
 		if (self.count + stackCount) > self.maxCount then
+			itemstack:set_count(self.count + stackCount - self.maxCount)
 			self.count = self.maxCount
-			itemstack:set_count((self.count + stackCount) - self.maxCount)
 		else -- new count fits
 			self.count = self.count + stackCount
 			-- this is for only removing one
-- 
cgit v1.2.3