mirror of
https://github.com/minetest-mods/skinsdb.git
synced 2024-12-22 07:20:19 +01:00
Add Continuous Integration and LuaCheck (#71)
All warnings have been fixed as well.
This commit is contained in:
parent
03d424fea7
commit
b769824d24
11
.github/workflows/build.yml
vendored
Normal file
11
.github/workflows/build.yml
vendored
Normal 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
13
.luacheckrc
Normal 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"}},
|
||||||
|
}
|
@ -57,7 +57,7 @@ function skins.get_skin_selection_formspec(player, context, perplayer_formspec)
|
|||||||
local yspc = 2
|
local yspc = 2
|
||||||
local skinwidth = 1
|
local skinwidth = 1
|
||||||
local skinheight = 2
|
local skinheight = 2
|
||||||
local xscale = 1
|
local xscale = 1 -- luacheck: ignore
|
||||||
local btn_y = 8.15
|
local btn_y = 8.15
|
||||||
local drop_y = 8
|
local drop_y = 8
|
||||||
local btn_width = 1
|
local btn_width = 1
|
||||||
@ -104,7 +104,7 @@ function skins.get_skin_selection_formspec(player, context, perplayer_formspec)
|
|||||||
|
|
||||||
local page = context.skins_page
|
local page = context.skins_page
|
||||||
local formspec = ""
|
local formspec = ""
|
||||||
|
|
||||||
for i = (page-1)*maxdisp+1, page*maxdisp do
|
for i = (page-1)*maxdisp+1, page*maxdisp do
|
||||||
local skin = context.skins_list[i]
|
local skin = context.skins_list[i]
|
||||||
if not skin then
|
if not skin then
|
||||||
|
@ -221,6 +221,6 @@ end
|
|||||||
function skin_class:is_applicable_for_player(playername)
|
function skin_class:is_applicable_for_player(playername)
|
||||||
local assigned_player = self:get_meta("playername")
|
local assigned_player = self:get_meta("playername")
|
||||||
return assigned_player == nil or assigned_player == true or
|
return assigned_player == nil or assigned_player == true or
|
||||||
playername and (minetest.check_player_privs(playername, {server=true}) or
|
playername and (minetest.check_player_privs(playername, {server=true}) or
|
||||||
assigned_player:lower() == playername:lower())
|
assigned_player:lower() == playername:lower())
|
||||||
end
|
end
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
local skins_dir_list = minetest.get_dir_list(skins.modpath.."/textures")
|
local skins_dir_list = minetest.get_dir_list(skins.modpath.."/textures")
|
||||||
|
|
||||||
for _, fn in pairs(skins_dir_list) do
|
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("_")
|
local nameparts = string.gsub(fn, "[.]", "_"):split("_")
|
||||||
|
|
||||||
-- check allowed prefix and file extension
|
-- check allowed prefix and file extension
|
||||||
|
@ -115,7 +115,7 @@ internal.get_pages_count = function(callback, ...)
|
|||||||
callback(math.ceil(list.pages / 20), unpack(vars))
|
callback(math.ceil(list.pages / 20), unpack(vars))
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Function to fetch a range of pages
|
-- Function to fetch a range of pages
|
||||||
internal.fetch_function = function(pages_total, start_page, len)
|
internal.fetch_function = function(pages_total, start_page, len)
|
||||||
start_page = math.max(start_page, 1)
|
start_page = math.max(start_page, 1)
|
||||||
|
Loading…
Reference in New Issue
Block a user