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', 'XBows',
'XBowsQuiver', 'XBowsQuiver',
'XBowsEntityDefBase', 'XBowsEntityDefBase',
'XBowsEntityDefCustom', 'XBowsEntityDefCustom'
'sfinv'
} }
read_globals = { read_globals = {

49
api.lua
View File

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

View File

@ -1,6 +1,6 @@
--[[ --[[
X Bows. Adds bow and arrows with API. 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 This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public 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. 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 This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public 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 else
return 0 return 0
end 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) local stack = inventory:get_stack(inventory_info.from_list, inventory_info.from_index)
if minetest.get_item_group(stack:get_name(), 'arrow') ~= 0 then 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. 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 This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public

View File

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

View File

@ -1,6 +1,6 @@
--[[ --[[
X Bows. Adds bow and arrows with API. 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 This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public 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. 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 This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public modify it under the terms of the GNU Lesser General Public

View File

@ -1,6 +1,6 @@
/** /**
* Deploy code to CDB * 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 * This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public * modify it under the terms of the GNU Lesser General Public