ZenonSeth / logistica

A Minetest item transport and storage mod
Other
1 stars 4 forks source link

Vacuum dupe #14

Closed Ocraw closed 1 month ago

Ocraw commented 1 month ago

When a player picks up items in the chest range there's a chance the chest will also grab the item.

Fixed like this:

local inv = minetest.get_meta(pos):get_inventory()
    for _, obj in pairs(minetest.get_objects_in_area(minPos, maxPos)) do
        local entity = obj:get_luaentity()
        if entity
      and entity.name == "__builtin:item"
      and entity.itemstring ~= "" 
      and not entity._removed then
      local itemStack = ItemStack(entity.itemstring)
      if inv:room_for_item(INV_MAIN, itemStack) then

Hope works for you too.

Tested on mineclonia.

ZenonSeth commented 1 month ago

Interesting, was not aware of the _removed property for entities. I'm assuming due to the rather long auto-pickup animation of mineclonia/mineclone2 this happened pretty much exclusively in those games.

Either way, good catch, implemented the fix as you suggested in https://github.com/ZenonSeth/logistica/releases/tag/1.2.1 - also now published on ContentDB.

Ocraw commented 1 month ago

Confirmed working. Should I close the issues I open or you prefer taking care of that yourself?

ZenonSeth commented 1 month ago

Either one is fine, but since I'm here now, I'll close it. Feel free to close your other tickets you raised if you feel they're resolved though.

Ocraw commented 1 month ago

https://github.com/mt-mods/pipeworks/issues/130#issue-2408152849

Apparently is a bug in MCL*. The workaround doesn't cause issues as I've tested it in minetest_game as well with other mods. The check can be removed once they merge the fix I guess. Sorry if it was unnecessary on your part, but it works so not that bad.