Closed AKryukov92 closed 2 years ago
I checked https://github.com/minetest/minetest/blob/master/doc/lua_api.txt And found several ways to do this:
I'll try to tinker with those options and see which one suits me more.
minetest.register_on_player_inventory_action
is the best option. on_metadata_inventory_take
callbacks are executed when taking items from a node inventory (e.g. chest) and is hence irrelevant to your requirement. Overriding on_use
is the most tedious way to do this, as you'd have to override this callback for every registered node/craftitem/tool.
There's an open PR for running callbacks on item-pickup, which would be the most straight-forward way to do this, but that's only for 5.0, assuming it even gets merged.
minetest.register_on_player_inventory_action
is a 5.0-dev feature. I already run a modified version of 0.4.17 with 5.0 features, so I could add it. I'd just rather not
I think this is now doable, as capturetheflag is now targeting 5.0.0 (while maintaining backwards compat with 0.4.x). Would you be able to work on this @AKryukov92?
I will look on this this week. I assume, that "backward compatibility" can be handled by disabling this feature if MT version is lower than 5.0
Today I have played CTF and noticed that it is extremely incomvenient to gather throphies in heat of battle.
Player as usual can manually manage his inventory as he likes.
I propose following changes:
Is it possible to handle pickups in MT?