From 0f67c9e6b850d68c2258e9f17b9c362c4f99fe7a Mon Sep 17 00:00:00 2001 From: Niklp09 <89982526+Niklp09@users.noreply.github.com> Date: Mon, 14 Aug 2023 09:52:45 +0300 Subject: [PATCH] Add luacheck, repo cleanup --- .gitattributes | 17 +----------- .github/workflows/luacheck.yml | 10 ++++++++ .gitignore | 47 ---------------------------------- .luacheckrc | 8 ++++++ default_shields.lua | 23 +++++------------ depends.txt | 3 --- description.txt | 1 - intllib.lua | 45 -------------------------------- locale/castle_shields.it.tr | 3 +-- locale/it.po | 23 ----------------- locale/template.pot | 21 --------------- locale/template.txt | 3 +-- mod.conf | 3 +-- shield_functions.lua | 9 ++++--- 14 files changed, 33 insertions(+), 183 deletions(-) create mode 100644 .github/workflows/luacheck.yml delete mode 100644 .gitignore create mode 100644 .luacheckrc delete mode 100644 depends.txt delete mode 100644 description.txt delete mode 100644 intllib.lua delete mode 100644 locale/it.po delete mode 100644 locale/template.pot diff --git a/.gitattributes b/.gitattributes index bdb0cab..eba1110 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,17 +1,2 @@ # Auto detect text files and perform LF normalization -* text=auto - -# Custom for Visual Studio -*.cs diff=csharp - -# Standard to msysgit -*.doc diff=astextplain -*.DOC diff=astextplain -*.docx diff=astextplain -*.DOCX diff=astextplain -*.dot diff=astextplain -*.DOT diff=astextplain -*.pdf diff=astextplain -*.PDF diff=astextplain -*.rtf diff=astextplain -*.RTF diff=astextplain +* text=auto \ No newline at end of file diff --git a/.github/workflows/luacheck.yml b/.github/workflows/luacheck.yml new file mode 100644 index 0000000..b501650 --- /dev/null +++ b/.github/workflows/luacheck.yml @@ -0,0 +1,10 @@ +name: luacheck +on: [push, pull_request] +jobs: + luacheck: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@master + - name: Luacheck + uses: lunarmodules/luacheck@master \ No newline at end of file diff --git a/.gitignore b/.gitignore deleted file mode 100644 index cd2946a..0000000 --- a/.gitignore +++ /dev/null @@ -1,47 +0,0 @@ -# Windows image file caches -Thumbs.db -ehthumbs.db - -# Folder config file -Desktop.ini - -# Recycle Bin used on file shares -$RECYCLE.BIN/ - -# Windows Installer files -*.cab -*.msi -*.msm -*.msp - -# Windows shortcuts -*.lnk - -# ========================= -# Operating System Files -# ========================= - -# OSX -# ========================= - -.DS_Store -.AppleDouble -.LSOverride - -# Thumbnails -._* - -# Files that might appear in the root of a volume -.DocumentRevisions-V100 -.fseventsd -.Spotlight-V100 -.TemporaryItems -.Trashes -.VolumeIcon.icns - -# Directories potentially created on remote AFP share -.AppleDB -.AppleDesktop -Network Trash Folder -Temporary Items -.apdisk diff --git a/.luacheckrc b/.luacheckrc new file mode 100644 index 0000000..dea19ac --- /dev/null +++ b/.luacheckrc @@ -0,0 +1,8 @@ +read_globals = { + "minetest", + "default" +} + +globals = { + "castle_shields" +} \ No newline at end of file diff --git a/default_shields.lua b/default_shields.lua index 1c17216..70bf1db 100644 --- a/default_shields.lua +++ b/default_shields.lua @@ -2,25 +2,14 @@ minetest.register_alias("castle:shield", "castle_shields:shield_1") minetest.register_alias("castle:shield_2", "castle_shields:shield_2") minetest.register_alias("castle:shield_3", "castle_shields:shield_3") +-- Translation support +local S = minetest.get_translator("castle_shields") --- Used for localization, choose either built-in or intllib. +-- The following colors are permitted: +-- "black", "blue", "brown", "cyan", "dark_green", "dark_grey", "green", "grey", +-- "magenta", "orange", "pink", "red", "violet", "white", "yellow" -local MP, S, NS = nil - -if (minetest.get_modpath("intllib") == nil) then - S = minetest.get_translator("castle_shields") - -else - -- internationalization boilerplate - MP = minetest.get_modpath(minetest.get_current_modname()) - S, NS = dofile(MP.."/intllib.lua") - -end - - ---The following colors are permitted: --- "black", "blue", "brown", "cyan", "dark_green", "dark_grey", "green", "grey", "magenta", "orange", "pink", "red", "violet", "white", "yellow" ---The following patterns are permitted: +-- The following patterns are permitted: -- "slash", "chevron", "cross" -- method parameters are name, desc, background_color, foreground_color, pattern diff --git a/depends.txt b/depends.txt deleted file mode 100644 index cc455cf..0000000 --- a/depends.txt +++ /dev/null @@ -1,3 +0,0 @@ -default -dye -intllib? \ No newline at end of file diff --git a/description.txt b/description.txt deleted file mode 100644 index 8cd8630..0000000 --- a/description.txt +++ /dev/null @@ -1 +0,0 @@ -Adds decorative wall shields diff --git a/intllib.lua b/intllib.lua deleted file mode 100644 index 6669d72..0000000 --- a/intllib.lua +++ /dev/null @@ -1,45 +0,0 @@ - --- Fallback functions for when `intllib` is not installed. --- Code released under Unlicense . - --- Get the latest version of this file at: --- https://raw.githubusercontent.com/minetest-mods/intllib/master/lib/intllib.lua - -local function format(str, ...) - local args = { ... } - local function repl(escape, open, num, close) - if escape == "" then - local replacement = tostring(args[tonumber(num)]) - if open == "" then - replacement = replacement..close - end - return replacement - else - return "@"..open..num..close - end - end - return (str:gsub("(@?)@(%(?)(%d+)(%)?)", repl)) -end - -local gettext, ngettext -if minetest.get_modpath("intllib") then - if intllib.make_gettext_pair then - -- New method using gettext. - gettext, ngettext = intllib.make_gettext_pair() - else - -- Old method using text files. - gettext = intllib.Getter() - end -end - --- Fill in missing functions. - -gettext = gettext or function(msgid, ...) - return format(msgid, ...) -end - -ngettext = ngettext or function(msgid, msgid_plural, n, ...) - return format(n==1 and msgid or msgid_plural, ...) -end - -return gettext, ngettext diff --git a/locale/castle_shields.it.tr b/locale/castle_shields.it.tr index 5144490..5de9d13 100644 --- a/locale/castle_shields.it.tr +++ b/locale/castle_shields.it.tr @@ -1,3 +1,2 @@ -# textdomain:castle_shields - +# textdomain: castle_shields Mounted Shield=Scudo appeso diff --git a/locale/it.po b/locale/it.po deleted file mode 100644 index be34709..0000000 --- a/locale/it.po +++ /dev/null @@ -1,23 +0,0 @@ -# ITALIAN LOCALE FILE FOR THE CASTLE SHIELDS MODULE -# Copyright (C) 2017 Philipbenr And DanDuncombe -# This file is distributed under the same license as the CASTLE SHIELDS package. -# Hamlet , 2017. -# -msgid "" -msgstr "" -"Project-Id-Version: Castle Shields\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-02-25 14:47-0700\n" -"PO-Revision-Date: 2017-09-10 22:38+0100\n" -"Last-Translator: H4mlet \n" -"Language-Team: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=2; plural=(n != 1);\n" -"Language: it\n" -"X-Generator: Poedit 1.6.10\n" - -#: init.lua:6 init.lua:41 init.lua:75 -msgid "Mounted Shield" -msgstr "Scudo appeso" diff --git a/locale/template.pot b/locale/template.pot deleted file mode 100644 index bfb347c..0000000 --- a/locale/template.pot +++ /dev/null @@ -1,21 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: PACKAGE VERSION\n" -"Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2017-02-25 14:47-0700\n" -"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=CHARSET\n" -"Content-Transfer-Encoding: 8bit\n" - -#: init.lua:6 init.lua:41 init.lua:75 -msgid "Mounted Shield" -msgstr "" diff --git a/locale/template.txt b/locale/template.txt index 24e5751..a6528d6 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -1,3 +1,2 @@ -# textdomain:castle_shields - +# textdomain: castle_shields Mounted Shield= diff --git a/mod.conf b/mod.conf index 2e79513..126701a 100644 --- a/mod.conf +++ b/mod.conf @@ -1,4 +1,3 @@ name = castle_shields description = Adds decorative wall shields -depends = default, dye -optional_depends = intllib +depends = default, dye \ No newline at end of file diff --git a/shield_functions.lua b/shield_functions.lua index 83566f8..dc0b070 100644 --- a/shield_functions.lua +++ b/shield_functions.lua @@ -1,15 +1,16 @@ castle_shields.register_shield = function(name, desc, background_color, foreground_color, mask, disable_recipe) local tile_side = "castle_shield_"..background_color..".png" - local tile_front = "castle_shield_"..background_color..".png^(castle_shield_"..foreground_color..".png^[mask:castle_shield_mask_"..mask..".png)" + local tile_front = "castle_shield_"..background_color..".png^(castle_shield_"..foreground_color.. + ".png^[mask:castle_shield_mask_"..mask..".png)" minetest.register_node(minetest.get_current_modname()..":"..name, { description = desc, tiles = {tile_side, tile_side, tile_side, tile_side, "castle_shield_back.png", tile_front}, - drawtype="nodebox", + drawtype = "nodebox", paramtype2 = "facedir", paramtype = "light", - groups={cracky=3}, + groups = {cracky=3}, sounds = default.node_sound_metal_defaults(), node_box = { type = "fixed", @@ -27,7 +28,7 @@ castle_shields.register_shield = function(name, desc, background_color, foregrou }, }, }) - + if disable_recipe then -- recipe disabled by caller return