minetest-mods / xdecor

A decoration mod for Minetest meant to be light, simple and well-featured
Other
29 stars 46 forks source link

Possible to multiply resources when using saw in workbench #74

Closed VindellePounze closed 7 years ago

VindellePounze commented 7 years ago

When using middle mouse button for taking a small stack of products and putting them in an occupied inventory slot it uses the correct amount of resources (tested with slabs: 10 slabs for 5 wood planks) but gives you the maximum possible amount regarding to how many resources you have in the saw slot. Discovered on Server "Wildes Land" (running Minetest 0.4.14, I believe) and also tested in Singleplayer with just minetest_game and XDecor (Minetest 0.4.15-dev-xxx from some days ago). In Singleplayer, XDecor is the latest version downloaded from github.

xdecor_saw_1

xdecor_saw_2

xdecor_saw_3

kilbith commented 7 years ago

Thanks for the report.

This is an engine issue. It doesn't distinguish a left / middle / right click when your stack is moved onto an occupied slot. Result : you get the full stack count as if it was a left click on taking.

This bug also occurs on [moreblocks]. EDIT: It occurs on every storage nodes in Minetest, like the default chest.

I suggest to open a report on the engine repository.

sofar commented 7 years ago

I'm fairly sure this is an engine issue. The only thing I can think of is to use the on_metadatainventory* functions to validate that the player isn't extracting too much, and reject the move/take if so.

kilbith commented 7 years ago

@sofar There's no way in the engine to know if the player used left / middle / right click on a stack when it was moved against an occupied slot. For the engine it's always a left click, internally.

kilbith commented 7 years ago

Fixed with https://github.com/minetest-mods/xdecor/commit/6d6ddd1d9f7a24779fa710037b6410db4e648536 but I consider it a hack. Engine still needs proper patching.

Please take note of this, @sofar

sofar commented 7 years ago

noted, I agree this isn't a nice solution.