From f172a45d39d1b9c9d65b1ec091af562cfb79d0b8 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Wed, 24 Jul 2024 22:04:50 +0300 Subject: [PATCH] fix base:drop component --- res/content/base/scripts/components/drop.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/res/content/base/scripts/components/drop.lua b/res/content/base/scripts/components/drop.lua index 7c34222b..f8a5fc52 100644 --- a/res/content/base/scripts/components/drop.lua +++ b/res/content/base/scripts/components/drop.lua @@ -53,10 +53,11 @@ function on_fall() end function on_sensor_enter(index, oid) - local playerentity = player.get_entity(hud.get_player()) + local playerid = hud.get_player() + local playerentity = player.get_entity(playerid) if ready and oid == playerentity and index == 0 then entity:despawn() - inventory.add(player.get_inventory(oid), dropitem.id, dropitem.count) + inventory.add(player.get_inventory(playerid), dropitem.id, dropitem.count) audio.play_sound_2d("events/pickup", 0.5, 0.8+math.random()*0.4, "regular") end if index == 1 and ready and oid == playerentity then