fix drop component

This commit is contained in:
MihailRis 2025-07-21 23:13:15 +03:00
parent 60bc30f01f
commit 0a79f672f3

View File

@ -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()