Compare commits

..

No commits in common. "0b758cbca461e4a14fccc90502f0163224790189" and "c0c021a19f70aaf7d877cb4d76276fe63446854f" have entirely different histories.

11 changed files with 28 additions and 62 deletions

View File

@ -19,8 +19,7 @@ globals = {
'XBows',
'XBowsQuiver',
'XBowsEntityDefBase',
'XBowsEntityDefCustom',
'sfinv'
'XBowsEntityDefCustom'
}
read_globals = {

49
api.lua
View File

@ -1,6 +1,6 @@
--[[
X Bows. Adds bow and arrows with API.
Copyright (C) 2024 SaKeL
Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -18,6 +18,8 @@
local S = minetest.get_translator(minetest.get_current_modname())
sfinv = sfinv --[[@as Sfinv]]
---Check if table contains value
---@param table table
---@param value string|number
@ -1152,10 +1154,7 @@ function XBowsEntityDef.on_step(self, selfObj, dtime)
)
or (
pointed_thing.ref:get_luaentity()
and (
pointed_thing.ref:get_luaentity().physical
or pointed_thing.ref:get_properties().physical
)
and pointed_thing.ref:get_luaentity().physical
and pointed_thing.ref:get_luaentity().name ~= '__builtin:item'
)
)
@ -2243,7 +2242,7 @@ end
---@param self XBowsQuiver
function XBowsQuiver.sfinv_register_page(self)
sfinv.register_page('x_bows:quiver_page', {
title = S('X Bows'),
title = 'X Bows',
get = function(this, player, context)
local formspec = {
---arrow
@ -2300,7 +2299,7 @@ end
---Register i3 page
function XBowsQuiver.i3_register_page(self)
i3.new_tab('x_bows_quiver_page', {
description = S('X Bows'),
description = 'X Bows',
slots = true,
formspec = function(player, data, fs)
local formspec = {
@ -2410,7 +2409,7 @@ function XBowsQuiver.ui_register_page(self)
unified_inventory.register_button('x_bows:quiver_page', {
type = 'image',
image = "x_bows_bow_wood_charged.png",
tooltip = S('X Bows'),
tooltip = 'X Bows',
})
end
@ -2429,12 +2428,8 @@ function XBowsQuiver.show_3d_quiver(self, player, props)
end
if self.skinsdb then
minetest.after(1, function(v_player)
if not v_player then
return
end
local textures = player_api.get_textures(v_player)
minetest.after(1, function()
local textures = player_api.get_textures(player)
---cleanup
for index, value in ipairs(textures) do
@ -2450,15 +2445,15 @@ function XBowsQuiver.show_3d_quiver(self, player, props)
player_textures = textures
if player_textures then
if _props.is_empty and not self.quiver_empty_state[v_player:get_player_name()] then
self.quiver_empty_state[v_player:get_player_name()] = true
player_api.set_textures(v_player, player_textures)
elseif not _props.is_empty and self.quiver_empty_state[v_player:get_player_name()] then
self.quiver_empty_state[v_player:get_player_name()] = false
player_api.set_textures(v_player, player_textures)
if _props.is_empty and not self.quiver_empty_state[player:get_player_name()] then
self.quiver_empty_state[player:get_player_name()] = true
player_api.set_textures(player, player_textures)
elseif not _props.is_empty and self.quiver_empty_state[player:get_player_name()] then
self.quiver_empty_state[player:get_player_name()] = false
player_api.set_textures(player, player_textures)
end
end
end, player)
end)
return
elseif self._3d_armor then
@ -2531,12 +2526,8 @@ function XBowsQuiver.hide_3d_quiver(self, player)
local player_textures
if self.skinsdb then
minetest.after(1, function(v_player)
if not v_player then
return
end
local textures = player_api.get_textures(v_player)
minetest.after(1, function()
local textures = player_api.get_textures(player)
---cleanup
for index, value in ipairs(textures) do
@ -2552,9 +2543,9 @@ function XBowsQuiver.hide_3d_quiver(self, player)
player_textures = textures
if player_textures then
player_api.set_textures(v_player, player_textures)
player_api.set_textures(player, player_textures)
end
end, player)
end)
return
elseif self._3d_armor then

View File

@ -1,6 +1,6 @@
--[[
X Bows. Adds bow and arrows with API.
Copyright (C) 2024 SaKeL
Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
--[[
X Bows. Adds bow and arrows with API.
Copyright (C) 2024 SaKeL
Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
@ -126,7 +126,7 @@ minetest.register_allow_player_inventory_action(function(player, action, invento
else
return 0
end
elseif action == 'move' and inventory_info.from_list == 'x_bows:arrow_inv' and inventory_info.to_list ~= 'x_bows:quiver_inv' then
elseif action == 'move' and inventory_info.from_list == 'x_bows:arrow_inv' then
local stack = inventory:get_stack(inventory_info.from_list, inventory_info.from_index)
if minetest.get_item_group(stack:get_name(), 'arrow') ~= 0 then

View File

@ -1,6 +1,6 @@
--[[
X Bows. Adds bow and arrows with API.
Copyright (C) 2024 SaKeL
Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public

View File

@ -8,7 +8,6 @@ Charge Time=
Faster Arrows=
Arrow Damage=
No Ammo=
X Bows=
Arrows=
Quiver=
Empty=

View File

@ -1,22 +0,0 @@
# textdomain: x_bows
Critical Arrow Chance=Ŝanco de profunda trafo
Strength=Forteco
Allowed ammunition=Uzeblaj pafaĵoj
none=neniu
Damage=Forteco
Charge Time=Tirprokrasto
Faster Arrows=Plirapidaj sagoj
Arrow Damage=Forteco de sago
No Ammo=Neniu pafaĵo
X Bows=X Pafarkoj
Arrows=Sagoj
Quiver=Sagujo
Empty=Malplena
Wooden Bow=Ligna pafarko
Arrow Wood=Ligna sago
Arrow Stone=Ŝtona sago
Arrow Bronze=Bronza sago
Arrow Steel=Ŝtala sago
Arrow Mese=Mesea sago
Arrow Diamond=Diamanta sago
Target=Pafcelo

View File

@ -8,7 +8,6 @@ Charge Time=Doba nabíjania
Faster Arrows=Rýchlejšie šípy
Arrow Damage=Poškodenie šípom
No Ammo=Žiadne strelivo
X Bows=
Arrows=Šípy
Quiver=Púzdro
Empty=Prázdne

View File

@ -1,6 +1,6 @@
--[[
X Bows. Adds bow and arrows with API.
Copyright (C) 2024 SaKeL
Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
--[[
X Bows. Adds bow and arrows with API.
Copyright (C) 2024 SaKeL
Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
/**
* Deploy code to CDB
* Copyright (C) 2024 SaKeL
* Copyright (C) 2023 SaKeL <juraj.vajda@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public