From 0012bdb71e3c02e93996cf84d433e11705fe517b Mon Sep 17 00:00:00 2001 From: OgelGames Date: Wed, 31 Jul 2024 03:26:28 +0200 Subject: [PATCH] Clear itemstring when picking up or merging items (#4530) Prevents possible item duplication with other mods. Matches the behavior of the default `__builtin:item`. See also https://github.com/mt-mods/pipeworks/issues/130 Reviewed-on: https://git.minetest.land/VoxeLibre/VoxeLibre/pulls/4530 Reviewed-by: the-real-herowl Co-authored-by: OgelGames Co-committed-by: OgelGames --- mods/ENTITIES/mcl_item_entity/init.lua | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index 2cb506450..f23d7af42 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -136,6 +136,7 @@ local function try_object_pickup(player, inv, object, checkpos) -- Destroy entity -- This just prevents this section to be run again because object:remove() doesn't remove the item immediately. le.target = checkpos + le.itemstring = "" le._removed = true -- Stop the object @@ -957,6 +958,7 @@ minetest.register_entity(":__builtin:item", { self.random_velocity = 0 self:set_item(own_stack:to_string()) + entity.itemstring = "" entity._removed = true object:remove() return true