From 0a79f672f3e37d1338375ca1f6f7857f165fe4ca Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 21 Jul 2025 23:13:15 +0300 Subject: [PATCH] fix drop component --- res/content/base/scripts/components/drop.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/res/content/base/scripts/components/drop.lua b/res/content/base/scripts/components/drop.lua index 4995aee4..a979c72d 100644 --- a/res/content/base/scripts/components/drop.lua +++ b/res/content/base/scripts/components/drop.lua @@ -64,8 +64,12 @@ function on_sensor_enter(index, oid) local odrop = other:get_component("base:drop").dropitem if odrop.id == dropitem.id and not odrop.data then local stack = item.stack_size(dropitem.id) - local sum = dropitem.count + odrop.count - if sum <= stack then + local sum = (dropitem.count or 0) + (odrop.count or 0) + if sum == 0 then + dropitem:despawn(); + odrop:despawn(); + return + elseif sum <= stack then dropitem.count = 0 odrop.count = sum entity:despawn()