From 7a482de6591353617cbab55f98237092aaba4b3e Mon Sep 17 00:00:00 2001 From: Jordan Irwin Date: Mon, 12 Jul 2021 23:03:23 -0700 Subject: [PATCH] Support updating 3d_armor inventory lists via chat command... https://content.minetest.net/packages/stu/3d_armor/ --- TODO.txt | 6 +++--- chat.lua | 6 ++++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/TODO.txt b/TODO.txt index 493aa05..0f755ed 100644 --- a/TODO.txt +++ b/TODO.txt @@ -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 diff --git a/chat.lua b/chat.lua index 5f9c4f8..b781250 100644 --- a/chat.lua +++ b/chat.lua @@ -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