cornernote / minetest-bags

Attach bags to your inventory to increase item storage capacity.
http://cornernote.github.io/minetest-bags/
Other
15 stars 9 forks source link

minetest.create_detached_inventory updates #2

Open Fixer-007 opened 7 years ago

Fixer-007 commented 7 years ago

There were changes to minetest.create_detached_inventory function, due to bug https://github.com/minetest/minetest/issues/4403, there were fixes merged: https://github.com/minetest/minetest/pull/4812 and https://github.com/minetest/minetest_game/pull/1413.

Basically on player join all other players detached inventories were send to player causing him to have severe 0 0 0 bug for several minutes on some servers. This was fixed, but some mod makers should check their mods for use of this function to send only his player inventory to him if needed.

Also quoting sfan5 about minetest.create_detached_inventory(player:get_player_name():

everything with :get_player_name() definitely need a fix

New function info:

* `minetest.create_detached_inventory(name, callbacks, [player_name])`: returns an `InvRef`
    * callbacks: See "Detached inventory callbacks"
    * player_name: Make detached inventory available to one player exclusively,
      by default they will be sent to every player (even if not used).
      Note that this parameter is mostly just a workaround and will be removed in future releases.
    * Creates a detached inventory. If it already exists, it is cleared.

Your mod has this:

minetest-bags/bags/init.lua:64: local bags_inv = minetest.create_detached_inventory(player:get_player_name().."_bags",{

I hope I described it right. Some mods are already updated. If not sure ask on IRC.

cornernote commented 7 years ago

Hi @Fixer-007

Thanks for pointing this out. Would you like to submit a PR for this change?

Fixer-007 commented 7 years ago

Nope, I have not enough expertise, I'm just a messenger.

cornernote commented 7 years ago

I don't have enough time to do a fix. I'll leave this open incase someone who wants to try code a fix has some time available.