mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-12 22:41:49 +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
|
local odrop = other:get_component("base:drop").dropitem
|
||||||
if odrop.id == dropitem.id and not odrop.data then
|
if odrop.id == dropitem.id and not odrop.data then
|
||||||
local stack = item.stack_size(dropitem.id)
|
local stack = item.stack_size(dropitem.id)
|
||||||
local sum = dropitem.count + odrop.count
|
local sum = (dropitem.count or 0) + (odrop.count or 0)
|
||||||
if sum <= stack then
|
if sum == 0 then
|
||||||
|
dropitem:despawn();
|
||||||
|
odrop:despawn();
|
||||||
|
return
|
||||||
|
elseif sum <= stack then
|
||||||
dropitem.count = 0
|
dropitem.count = 0
|
||||||
odrop.count = sum
|
odrop.count = sum
|
||||||
entity:despawn()
|
entity:despawn()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue