diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..817e409 --- /dev/null +++ b/.github/workflows/build.yml @@ -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: "" diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..f86a57a --- /dev/null +++ b/.luacheckrc @@ -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"}}, +} diff --git a/API.md b/API.md index 830b30e..3cfe77c 100644 --- a/API.md +++ b/API.md @@ -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() diff --git a/formspecs.lua b/formspecs.lua index 19482e8..3241143 100644 --- a/formspecs.lua +++ b/formspecs.lua @@ -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 diff --git a/locale/skinsdb.pt_BR.tr b/locale/skinsdb.pt_BR.tr new file mode 100644 index 0000000..58700db --- /dev/null +++ b/locale/skinsdb.pt_BR.tr @@ -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 diff --git a/models/skinsdb_hand_18.b3d b/models/skinsdb_hand_18.b3d new file mode 100644 index 0000000..88449c6 Binary files /dev/null and b/models/skinsdb_hand_18.b3d differ diff --git a/models/skinsdb_hand_18.blend b/models/skinsdb_hand_18.blend new file mode 100644 index 0000000..decc873 Binary files /dev/null and b/models/skinsdb_hand_18.blend differ diff --git a/skin_meta_api.lua b/skin_meta_api.lua index 7a5ad2e..6c6138d 100644 --- a/skin_meta_api.lua +++ b/skin_meta_api.lua @@ -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 diff --git a/skinlist.lua b/skinlist.lua index a40ed56..bde0ae5 100644 --- a/skinlist.lua +++ b/skinlist.lua @@ -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) diff --git a/skins_updater.lua b/skins_updater.lua index 22f3486..1e461ed 100644 --- a/skins_updater.lua +++ b/skins_updater.lua @@ -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)