Add checks for player_api mod

This commit is contained in:
Juraj Vajda 2022-11-01 23:10:47 -04:00
parent 160fb29d34
commit 7194800898
5 changed files with 9 additions and 5 deletions

View File

@ -88,6 +88,8 @@ There are few indications on how to know when the bow shot arrow from quiver:
- u_skins
- wardrobe
- sfinv
- skinsdb
- player_api (shows 3d quiver)
## License:

View File

@ -38,6 +38,7 @@ XBows = {
wardrobe = minetest.get_modpath('wardrobe'),
_3d_armor = minetest.get_modpath('3d_armor'),
skinsdb = minetest.get_modpath('skinsdb'),
player_api = minetest.get_modpath('player_api'),
registered_bows = {},
registered_arrows = {},
registered_quivers = {},
@ -2261,7 +2262,7 @@ function XBowsQuiver.ui_register_page(self)
end
function XBowsQuiver.show_3d_quiver(self, player, props)
if not XBows.settings.x_bows_show_3d_quiver then
if not XBows.settings.x_bows_show_3d_quiver or not XBows.player_api then
return
end
@ -2361,7 +2362,7 @@ function XBowsQuiver.show_3d_quiver(self, player, props)
end
function XBowsQuiver.hide_3d_quiver(self, player)
if not XBows.settings.x_bows_show_3d_quiver then
if not XBows.settings.x_bows_show_3d_quiver or not XBows.player_api then
return
end

View File

@ -33,7 +33,7 @@ minetest.register_on_joinplayer(function(player)
local inv_quiver = player:get_inventory()--[[@as InvRef]]
local inv_arrow = player:get_inventory()--[[@as InvRef]]
if XBows.settings.x_bows_show_3d_quiver then
if XBows.settings.x_bows_show_3d_quiver and XBows.player_api then
---Order matters here
if XBows.skinsdb then
player_api.set_model(player, 'skinsdb_3d_armor_character_5.b3d')
@ -77,7 +77,7 @@ minetest.register_on_joinplayer(function(player)
XBowsQuiver:close_quiver(player)
end)
if XBows.settings.x_bows_show_3d_quiver then
if XBows.settings.x_bows_show_3d_quiver and XBows.player_api then
local model_name = 'x_bows_character.b3d'
if XBows.skinsdb then

View File

@ -1,6 +1,6 @@
name = x_bows
description = Adds bow and arrows to Minetest.
depends =
optional_depends = default, farming, 3d_armor, mesecons, playerphysics, player_monoids, wool, i3, unified_inventory, simple_skins, u_skins, wardrobe, sfinv, skinsdb
optional_depends = default, farming, 3d_armor, mesecons, playerphysics, player_monoids, wool, i3, unified_inventory, simple_skins, u_skins, wardrobe, sfinv, skinsdb, player_api
supported_games = minetest_game
min_minetest_version = 5.4

View File

@ -9,6 +9,7 @@
---@field wardrobe string|nil
---@field _3d_armor string|nil
---@field skinsdb string|nil
---@field player_api string|nil
---@field registered_bows table<string, ItemDef|BowItemDefCustom>
---@field registered_arrows table<string, ItemDef|ArrowItemDefCustom>
---@field registered_quivers table<string, ItemDef|QuiverItemDefCustom>