mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
fix drop component
This commit is contained in:
parent
60bc30f01f
commit
0a79f672f3
1 changed files with 6 additions and 2 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue