diff --git a/.cdb.json b/.cdb.json index 41b45b9..ada3089 100644 --- a/.cdb.json +++ b/.cdb.json @@ -5,7 +5,7 @@ "license": "MIT", "media_license": "CC0-1.0", "tags": ["world_tools"], - "repo": "https://github.com/AntumMT/mod-cleaner", - "issue_tracker": "https://github.com/AntumMT/mod-cleaner/issues", + "repo": "https://codeberg.org/AntumLuanti/mod-cleaner", + "issue_tracker": "https://codeberg.org/AntumLuanti/mod-cleaner/issues", "forums": 18381 } diff --git a/.github/workflows/reference.yml b/.github/workflows/reference.yml index cd61ab9..29dec4c 100644 --- a/.github/workflows/reference.yml +++ b/.github/workflows/reference.yml @@ -1,31 +1,30 @@ -name: Build Reference +name: Build Reference on: push: - branches: - - master + tags: + - 'v[0-9]*' + workflow_dispatch: jobs: build: - name: Build + name: Build Reference runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - name: Setup Lua uses: leafo/gh-actions-lua@v8 with: luaVersion: 5.4 - name: Setup Lua Rocks uses: leafo/gh-actions-luarocks@v4 - - name: Setup LDoc dependencies + - name: Setup dependencies run: luarocks install --only-deps https://raw.githubusercontent.com/lunarmodules/LDoc/master/ldoc-scm-3.rockspec - name: Setup LDoc - run: git clone --single-branch --branch=custom https://github.com/AntumDeluge/ldoc.git .ldoc/ldoc && chmod +x .ldoc/ldoc/ldoc.lua - - name: Generate docs - run: chmod +x .ldoc/gendoc.sh && ./.ldoc/gendoc.sh + run: git clone --single-branch --branch=custom https://github.com/AntumDeluge/LDoc.git ldoc + - name: Checkout & Build Docs + run: git clone https://github.com/AntumMT/mod-cleaner.git cleaner && cd cleaner && chmod +x .ldoc/build_versioned_docs.sh && ./.ldoc/build_versioned_docs.sh - name: Deploy uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: docs/ + publish_dir: cleaner/docs/ diff --git a/.ldoc/build_versioned_docs.sh b/.ldoc/build_versioned_docs.sh new file mode 100755 index 0000000..728103f --- /dev/null +++ b/.ldoc/build_versioned_docs.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +# place this file in mod ".ldoc" directory + + +d_config="$(dirname $(readlink -f $0))" + +cd "${d_config}/.." + +d_root="$(pwd)" +d_export="${d_export:-${d_root}/docs/reference}" + +cmd_ldoc="${d_root}/../ldoc/ldoc.lua" +if test -f "${cmd_ldoc}"; then + if test ! -x "${cmd_ldoc}"; then + chmod +x "${cmd_ldoc}" + fi +else + cmd_ldoc="ldoc" +fi + +# clean old files +rm -rf "${d_export}" + +# store current branch +main_branch="$(git branch --show-current)" + +html_out="\n\n\n\n\n\n\n" + +cd "${d_root}" +git checkout ${main_branch} + +echo -e "${html_out}" > "${d_export}/index.html" + +echo -e "\nDone!" diff --git a/.ldoc/config.ld b/.ldoc/config.ld index cf24500..10e46db 100644 --- a/.ldoc/config.ld +++ b/.ldoc/config.ld @@ -13,12 +13,12 @@ end project = "Cleaner" -title = "Cleaner mod for Minetest" +title = "Cleaner mod for Luanti" format = "markdown" not_luadoc=true boilerplate = false icon = "textures/cleaner_pencil.png" -favicon = "https://www.minetest.net/media/icon.svg" +favicon = "https://www.luanti.org/media/icon.svg" file = { "settings.lua", diff --git a/.ldoc/gendoc.sh b/.ldoc/gendoc.sh index 6339dea..75ef2c3 100755 --- a/.ldoc/gendoc.sh +++ b/.ldoc/gendoc.sh @@ -10,7 +10,6 @@ cd "${d_ldoc}/.." d_root="$(pwd)" d_export="${d_export:-${d_root}/docs/reference}" -d_data="${d_export}/data" cmd_ldoc="${d_ldoc}/ldoc/ldoc.lua" if test ! -x "${cmd_ldoc}"; then @@ -20,8 +19,11 @@ fi # clean old files rm -rf "${d_export}" +vinfo="v$(grep "^version = " "${d_root}/mod.conf" | head -1 | sed -e 's/version = //')" +d_data="${d_export}/${vinfo}/data" + # generate new doc files -"${cmd_ldoc}" --UNSAFE_NO_SANDBOX --multimodule -c "${f_config}" -d "${d_export}" "${d_root}"; retval=$? +"${cmd_ldoc}" --UNSAFE_NO_SANDBOX --multimodule -c "${f_config}" -d "${d_export}/${vinfo}" "${d_root}"; retval=$? # check exit status if test ${retval} -ne 0; then @@ -29,6 +31,11 @@ if test ${retval} -ne 0; then exit ${retval} fi +# show version info +for html in $(find "${d_export}/${vinfo}" -type f -name "*.html"); do + sed -i -e "s|^

[cC]leaner

$|

Cleaner (${vinfo})

|" "${html}" +done + # copy textures to data directory echo -e "\ncopying textures ..." mkdir -p "${d_data}" diff --git a/README.md b/README.md index 9900b9b..70253ef 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -## Cleaner mod for Minetest +## Cleaner mod for Luanti ### Description: -A [Minetest][] mod that can be used to remove/replace unknown entities, nodes, & items. Originally forked from [PilzAdam's ***clean*** mod][f.pilzadam]. +A [Luanti (Minetest)][Luanti] mod that can be used to remove/replace unknown entities, nodes, & items. Originally forked from [PilzAdam's ***clean*** mod][f.pilzadam]. ![screenshot](screenshot.png) @@ -13,7 +13,7 @@ A [Minetest][] mod that can be used to remove/replace unknown entities, nodes, & ### Requirements: -- Minetest minimum version: 5.0 +- Luanti minimum version: 5.0 - Depends: none ### Usage: @@ -73,14 +73,14 @@ cleaner.unsafe ### Links: -- [![ContentDB](https://content.minetest.net/packages/AntumDeluge/cleaner/shields/title/)][ContentDB] -- [Forum](https://forum.minetest.net/viewtopic.php?t=18381) +- [![ContentDB](https://content.luanti.org/packages/AntumDeluge/cleaner/shields/title/)][ContentDB] +- [Forum](https://forum.luanti.org/viewtopic.php?t=18381) - [Git repo](https://github.com/AntumMT/mod-cleaner) -- [Reference](https://antummt.github.io/mod-cleaner/reference) +- [Reference](https://antummt.github.io/mod-cleaner/reference/latest/) - [Changelog](changelog.txt) - [TODO](TODO.txt) -[Minetest]: http://www.minetest.net/ -[f.pilzadam]: https://forum.minetest.net/viewtopic.php?t=2777 -[ContentDB]: https://content.minetest.net/packages/AntumDeluge/cleaner/ +[Luanti]: https://luanti.org/ +[f.pilzadam]: https://forum.luanti.org/viewtopic.php?t=2777 +[ContentDB]: https://content.luanti.org/packages/AntumDeluge/cleaner/ diff --git a/changelog.txt b/changelog.txt index ebbb7b4..0214081 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,7 +1,14 @@ +2025-01-18 +---------- +- fix undeclared global +- added nil check after reading world data file + + v1.2.1 ---- - use sounds mod for sounds +- added nil check after reading world data file v1.2 @@ -26,7 +33,7 @@ v1.2 v1.1 ---- - uses "register_lbm" with "run_at_every_load" instead of "register_abm" to save resources - - suggested by bell07 ( https://forum.minetest.net/viewtopic.php?p=325519#p325519 ) + - suggested by bell07 ( https://forum.luanti.org/viewtopic.php?p=325519#p325519 ) v1.0 ---- diff --git a/chat.lua b/chat.lua index 4a22126..3f7cf43 100644 --- a/chat.lua +++ b/chat.lua @@ -135,9 +135,10 @@ local function format_params(cmd) local def = get_cmd_def(cmd) local param_count + -- FIXME: unused? local all_params = {} if def.params then - for k, v in ipairs(def.params) do + for _, p in ipairs(def.params) do table.insert(all_params, p) end end diff --git a/misc_functions.lua b/misc_functions.lua index 67460b1..27c8654 100644 --- a/misc_functions.lua +++ b/misc_functions.lua @@ -28,8 +28,13 @@ local function get_world_data() local wdata = {} local buffer = io.open(world_file, "r") if buffer then - wdata = core.parse_json(buffer:read("*a")) + local err + wdata, err = core.parse_json(buffer:read("*a"), nil, true) buffer:close() + if wdata == nil then + cleaner.log("warning", "reading world data file failed: " .. world_file) + wdata = {} + end end local rem_types = {"entities", "nodes", "ores",} diff --git a/mod.conf b/mod.conf index 858fb6d..03b84d4 100644 --- a/mod.conf +++ b/mod.conf @@ -1,6 +1,6 @@ name = cleaner description = A mod that can be used to remove/replace unknown entities, nodes, & items. -version = 1.2.1 +version = 2025-01-18 license = MIT author = PilzAdam, Jordan Irwin (AntumDeluge) min_minetest_version = 5.0