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
master
mckaygerhard 2023-01-11 13:54:53 -04:00
parent 9e11db0433
commit c5c186a123
1 changed files with 11 additions and 1 deletions

View File

@ -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