theFox6 / working_villages

A mod for minetest that adds villagers performing work
https://content.minetest.net/packages/theFox/working_villages/
MIT License
13 stars 10 forks source link

villager inventory duplicates job items #48

Open lmaddox opened 10 months ago

lmaddox commented 10 months ago

when the (job) item is removed from the global job_inv and added to the villager's job inv, the item is not removed from the global job_inv. This is probably correct behavior.

when the item is removed from the villager's job inv to the global job_inv, it is duplicated.

the duplicate items are cleared from the global job_inv when the server is restarted.

job_inv.on_put() contains a commented-out line that, when uncommented, fixes the behavior.

--inv:remove_item(listname, stack)
stack:clear()

Screenshot_2023-12-02_16_23_50

theFox6 commented 9 months ago

I believe I remember there being a way to lose jobs with that line in place, which is why I commented it out. A better fix would probably be to check whether all jobs are within the inventory every now and then. Maybe making them stackable and removing duplicates could be a good idea.

sfence commented 9 months ago

I believe I remember there being a way to lose jobs with that line in place, which is why I commented it out. A better fix would probably be to check whether all jobs are within the inventory every now and then. Maybe making them stackable and removing duplicates could be a good idea.

If you overwrite put and take function for the inventory or inventory list, items can be taken and returned without effect for items in the jobs inventory list.