From c5c186a1239217dade5420d6f56751b2e6bde189 Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Wed, 11 Jan 2023 13:54:53 -0400 Subject: [PATCH] backguard compatibility with mod default from older games * this permits to use non player_api mod from default * this permits to use older chest api by an aliase * so this make to use this mod in 0.4 older deafult sub games --- inventory.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/inventory.lua b/inventory.lua index fcd8578..03d458a 100644 --- a/inventory.lua +++ b/inventory.lua @@ -84,6 +84,12 @@ mod.worn_items_inv = 'list[current_player;worn;0,3.5;2,4;]' mod.empty_button = 'image_button[2.25,2;1,1;transparent_button.png;dinv_empty_craft;Empty]' mod.fill_button = 'image_button[2.25,1;1,1;transparent_button.png;dinv_fill_craft;Fill]' +-- backguard compatibility for older default mod, game pre 5.1 release +if not minetest.global_exists("default.chest") then + default.chest = {} + default.chest.get_chest_formspec = default.get_chest_formspec + minetest.log("warning", "[dinv] using older chest api from default mod") +end -- All this is necessary to add scroll buttons to chests. if ADD_SCROLL_TO_DEFAULT_CHEST then @@ -831,7 +837,11 @@ function mod.set_armor_textures(player) end end textures = { tex } - player_api.set_textures(player, textures) + if minetest.get_modpath("player_api") then + player_api.set_textures(player, textures) + else + default.player_set_textures(player, textures) + end end