Support updating 3d_armor inventory lists via chat command...

https://content.minetest.net/packages/stu/3d_armor/
This commit is contained in:
Jordan Irwin 2021-07-12 23:03:23 -07:00
parent 5fcc824d0e
commit 7a482de659
2 changed files with 9 additions and 3 deletions

View file

@ -1,8 +1,8 @@
TODO:
- update world file when chat commands are used
- update player inventories when items are replaced:
- 3d_armor
- update storage inventories when items are replaced
- update inventories when items are replaced:
- creative
- storage (chests, etc.)
- update player inventories on login
- fix top nodes disappearing with /replace_node command

View file

@ -213,6 +213,7 @@ local function replace_item(src, tgt)
core.register_alias(src, tgt)
local bags = core.get_modpath("bags") ~= nil
local armor = core.get_modpath("3d_armor") ~= nil
-- update player inventories
for _, player in ipairs(core.get_connected_players()) do
@ -224,6 +225,11 @@ local function replace_item(src, tgt)
update_list(pinv, "bag" .. i .. "contents", src, tgt)
end
end
if armor then
local armor_inv = core.get_inventory({type="detached", name=player:get_player_name() .. "_armor"})
update_list(armor_inv, "armor", src, tgt)
end
end
return true