Merge remote-tracking branch 'origin/master' into HEAD

This commit is contained in:
Alexander Weber 2022-12-30 11:19:46 +01:00
commit abc3df86e3
10 changed files with 58 additions and 11 deletions

11
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,11 @@
on: [push, pull_request]
name: build
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: lint
uses: Roang-zero1/factorio-mod-luacheck@master
with:
luacheckrc_url: ""

13
.luacheckrc Normal file
View File

@ -0,0 +1,13 @@
unused_args = false
allow_defined_top = true
max_line_length = 999
globals = {
"minetest", "unified_inventory", "core",
"player_api", "clothing", "armor", "sfinv",
}
read_globals = {
string = {fields = {"split", "trim"}},
table = {fields = {"copy", "getn"}},
}

3
API.md
View File

@ -59,7 +59,8 @@ Could be redefined for dynamic texture generation
Set the hand node to be used with this skin
## skin:set_hand_from_texture()
Register and set hand node based on skin texture
Register and set hand node based on skin texture.
Uses different model depending on get_meta("format") ("1.0" or "1.8")
Only works on mod load
## skin:get_hand()

View File

@ -57,7 +57,7 @@ function skins.get_skin_selection_formspec(player, context, perplayer_formspec)
local yspc = 2
local skinwidth = 1
local skinheight = 2
local xscale = 1
local xscale = 1 -- luacheck: ignore
local btn_y = 8.15
local drop_y = 8
local btn_width = 1
@ -104,7 +104,7 @@ function skins.get_skin_selection_formspec(player, context, perplayer_formspec)
local page = context.skins_page
local formspec = ""
for i = (page-1)*maxdisp+1, page*maxdisp do
local skin = context.skins_list[i]
if not skin then

20
locale/skinsdb.pt_BR.tr Normal file
View File

@ -0,0 +1,20 @@
# textdomain: skinsdb
Raw texture=Textura crua
Name=Nome
Author=Autor
Change=Mudar
Page=Página
License=Licença
Description=Descrição
Show, list or set player's skin=Mostrar, listar ou definir a skin do jogador
Player not found=Jogador não encontrado
unknown command=Comando desconhecido
see /help skinsdb for supported parameters= consulte /help skinsdb para obter os parâmetros suportados
skin set to=Aparência definida para
invalid skin=Aparência inválida
unknown parameter=parâmetro desconhecido
unknown skin=Aparência desconhecida
Downloads thespecified range of skins and shuts down the server= Baixa o intervalo especificado de capas e desliga o servidor
Skins=Aparência
Requires skin key=Requer chave de aparência

BIN
models/skinsdb_hand_18.b3d Normal file

Binary file not shown.

Binary file not shown.

View File

@ -69,7 +69,11 @@ function skin_class:set_hand_from_texture()
hand_def.wield_scale = {x=1,y=1,z=1}
hand_def.paramtype = "light"
hand_def.drawtype = "mesh"
hand_def.mesh = "skinsdb_hand.b3d"
if(self:get_meta("format") == "1.0") then
hand_def.mesh = "skinsdb_hand.b3d"
else
hand_def.mesh = "skinsdb_hand_18.b3d"
end
hand_def.use_texture_alpha = ALPHA_CLIP
minetest.register_node(hand, hand_def)
self:set_hand(hand)
@ -221,6 +225,6 @@ end
function skin_class:is_applicable_for_player(playername)
local assigned_player = self:get_meta("playername")
return assigned_player == nil or assigned_player == true or
playername and (minetest.check_player_privs(playername, {server=true}) or
assigned_player:lower() == playername:lower())
playername and (minetest.check_player_privs(playername, {server=true}) or
assigned_player:lower() == playername:lower())
end

View File

@ -1,7 +1,7 @@
local skins_dir_list = minetest.get_dir_list(skins.modpath.."/textures")
for _, fn in pairs(skins_dir_list) do
local name, sort_id, assignment, is_preview, playername
local name, sort_id, is_preview, playername
local nameparts = string.gsub(fn, "[.]", "_"):split("_")
-- check allowed prefix and file extension
@ -51,9 +51,7 @@ for _, fn in pairs(skins_dir_list) do
local skin_format = skins.get_skin_format(file)
skin_obj:set_meta("format", skin_format)
file:close()
if skin_format == "1.0" then
skin_obj:set_hand_from_texture()
end
skin_obj:set_hand_from_texture()
file = io.open(skins.modpath.."/meta/"..name..".txt", "r")
if file then
local data = string.split(file:read("*all"), "\n", 3)

View File

@ -115,7 +115,7 @@ internal.get_pages_count = function(callback, ...)
callback(math.ceil(list.pages / 20), unpack(vars))
end)
end
-- Function to fetch a range of pages
internal.fetch_function = function(pages_total, start_page, len)
start_page = math.max(start_page, 1)