mirror of
https://codeberg.org/AntumLuanti/mod-cleaner.git
synced 2025-04-30 06:01:44 -04:00
Compare commits
11 commits
Author | SHA1 | Date | |
---|---|---|---|
|
c72b710c56 | ||
|
209008b88d | ||
|
f35e2f1808 | ||
|
ecf5201220 | ||
|
0d42a1bdd8 | ||
|
7d47f8ff5d | ||
|
93fa96d6c2 | ||
|
9ca550703b | ||
|
b261dda15c | ||
|
06e4408b91 | ||
|
6b3220048b |
10 changed files with 147 additions and 30 deletions
|
@ -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
|
||||
}
|
||||
|
|
21
.github/workflows/reference.yml
vendored
21
.github/workflows/reference.yml
vendored
|
@ -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/
|
||||
|
|
98
.ldoc/build_versioned_docs.sh
Executable file
98
.ldoc/build_versioned_docs.sh
Executable file
|
@ -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="<html>\n<head></head>\n\n<body>\n\n<ul>\n"
|
||||
|
||||
# generate new doc files
|
||||
mkdir -p "${d_export}"
|
||||
for vinfo in $(git tag -l --sort=-v:refname | grep "^v[0-9]"); do
|
||||
echo -e "\nbuilding ${vinfo} docs ..."
|
||||
git checkout ${vinfo}
|
||||
d_temp="${d_config}/temp"
|
||||
mkdir -p "${d_temp}"
|
||||
|
||||
# backward compat
|
||||
f_config="${d_root}/docs/config.ld"
|
||||
if test ! -f "${f_config}"; then
|
||||
f_config="${d_config}/config.ld"
|
||||
fi
|
||||
|
||||
if test ! -f "${f_config}"; then
|
||||
echo -e "\nLDoc config not available for ${vinfo}, skipping build ..."
|
||||
continue
|
||||
fi
|
||||
|
||||
"${cmd_ldoc}" --UNSAFE_NO_SANDBOX --multimodule -c "${f_config}" -d "${d_temp}" "${d_root}"; retval=$?
|
||||
if test ${retval} -ne 0; then
|
||||
echo -e "\nERROR: doc build for ${vinfo} failed!"
|
||||
rm -rf "${d_temp}"
|
||||
continue
|
||||
fi
|
||||
|
||||
# show version info
|
||||
for html in $(find "${d_temp}" -type f -name "*.html"); do
|
||||
sed -i -e "s|^<h1>[cC]leaner</h1>$|<h1>Cleaner <span style=\"font-size:12pt;\">(${vinfo})</span></h1>|" \
|
||||
"${html}"
|
||||
done
|
||||
|
||||
if test -d "${d_root}/textures"; then
|
||||
# copy textures to data directory
|
||||
echo -e "\ncopying textures ..."
|
||||
d_data="${d_temp}/data"
|
||||
mkdir -p "${d_data}"
|
||||
texture_count=0
|
||||
for png in $(find "${d_root}/textures" -maxdepth 1 -type f -name "*.png"); do
|
||||
t_png="${d_data}/$(basename ${png})"
|
||||
if test -f "${t_png}"; then
|
||||
echo "WARNING: not overwriting existing file: ${t_png}"
|
||||
else
|
||||
cp "${png}" "${d_data}"
|
||||
texture_count=$((texture_count + 1))
|
||||
printf "\rcopied ${texture_count} textures"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
mv "${d_temp}" "${d_export}/${vinfo}"
|
||||
if test -z ${vcur+x}; then
|
||||
vcur="${vinfo}"
|
||||
ln -s "${d_export}/${vinfo}" "${d_export}/current"
|
||||
ln -s "${d_export}/${vinfo}" "${d_export}/latest"
|
||||
html_out="${html_out} <li><a href=\"current/\">current</a></li>\n"
|
||||
html_out="${html_out} <li><a href=\"latest/\">latest</a></li>\n"
|
||||
fi
|
||||
html_out="${html_out} <li><a href=\"${vinfo}/\">${vinfo}</a></li>\n"
|
||||
done
|
||||
|
||||
html_out="${html_out}</ul>\n\n</body></html>"
|
||||
|
||||
cd "${d_root}"
|
||||
git checkout ${main_branch}
|
||||
|
||||
echo -e "${html_out}" > "${d_export}/index.html"
|
||||
|
||||
echo -e "\nDone!"
|
|
@ -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",
|
||||
|
|
|
@ -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|^<h1>[cC]leaner</h1>$|<h1>Cleaner <span style=\"font-size:12pt;\">(${vinfo})</span></h1>|" "${html}"
|
||||
done
|
||||
|
||||
# copy textures to data directory
|
||||
echo -e "\ncopying textures ..."
|
||||
mkdir -p "${d_data}"
|
||||
|
|
18
README.md
18
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].
|
||||
|
||||

|
||||
|
||||
|
@ -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]
|
||||
- [Forum](https://forum.minetest.net/viewtopic.php?t=18381)
|
||||
- [][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/
|
||||
|
|
|
@ -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
|
||||
----
|
||||
|
|
3
chat.lua
3
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
|
||||
|
|
|
@ -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",}
|
||||
|
|
2
mod.conf
2
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
|
||||
|
|
Loading…
Add table
Reference in a new issue