minetest-mods / craftguide

:book: The most comprehensive Crafting Guide on Minetest
Other
43 stars 20 forks source link

Progressive list update does not work as expected without pages change #50

Closed bell07 closed 5 years ago

bell07 commented 5 years ago

Steps to reproduce:

  1. Start with progressive mode and minetest game
  2. Drop aspen tree nearly to player and get jungle tree to inventory
  3. Look to the crafting guide => You get the jungle wood recipe as expected
  4. Collect aspen tree without changing sfinv pages (shortly leave inventory, collect and start back)
  5. Issue: There is no way to refresh the prorgessive selection for changed items, except changing the sfinv pages

Please also note the progressive selection should be refresheable in case of active search using search button

kilbith commented 5 years ago

Because there's no event callback when you open the inventory up.

bell07 commented 5 years ago

But there should be a way to trigger the update. Even I search for a string and reset the search the crafting guide does not know the added aspen tree. My proposal is the redo progessive check at least the reset button is pressed.

kilbith commented 5 years ago

Using a button to actualize is not the best approach. Instead the engine should have a callback when the inventory is opened. @rubenwardy maybe? (I don't have the ability to submit PRs anymore).

p-ouellette commented 5 years ago

Since the inventory is client-side that would probably have to wait until we get server sent client mods.

Maybe the ideal solution would be to update the progressive items when a new item type is added to the inventory or the last item of some type is removed from the inventory. We would need a new callback for this too, similar to on_player_inventory_action, but it needs to be called for any addition/removal, not just when the player adds/removes an item from their inventory.

kilbith commented 5 years ago

Fixed by https://github.com/minetest-mods/craftguide/commit/59b806c9c494b98f0f67015afa4978f75d17b309