mirror of
https://codeberg.org/AntumLuanti/mod-cleaner.git
synced 2025-04-30 14:11:44 -04:00
Compare commits
18 commits
Author | SHA1 | Date | |
---|---|---|---|
|
c72b710c56 | ||
|
209008b88d | ||
|
f35e2f1808 | ||
|
ecf5201220 | ||
|
0d42a1bdd8 | ||
|
7d47f8ff5d | ||
|
93fa96d6c2 | ||
|
9ca550703b | ||
|
b261dda15c | ||
|
06e4408b91 | ||
|
6b3220048b | ||
|
f0004e3c7b | ||
|
e3959a815f | ||
|
45e59dbf8b | ||
|
0098ef5da4 | ||
|
51a812fa86 | ||
|
5efafec098 | ||
|
0ab5d51584 |
18 changed files with 240 additions and 346 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
|
||||
}
|
||||
|
|
2
.gitattributes
vendored
2
.gitattributes
vendored
|
@ -1,2 +1,2 @@
|
|||
.* export-ignore
|
||||
sounds_src/ export-ignore
|
||||
*.py export-ignore
|
||||
|
|
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,13 +13,12 @@ end
|
|||
|
||||
|
||||
project = "Cleaner"
|
||||
title = "Cleaner mod for Minetest"
|
||||
title = "Cleaner mod for Luanti"
|
||||
format = "markdown"
|
||||
not_luadoc=true
|
||||
boilerplate = false
|
||||
style = true
|
||||
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 -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}"
|
||||
|
|
305
.ldoc/ldoc.css
305
.ldoc/ldoc.css
|
@ -1,305 +0,0 @@
|
|||
/* BEGIN RESET
|
||||
|
||||
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
|
||||
Code licensed under the BSD License:
|
||||
http://developer.yahoo.com/yui/license.html
|
||||
version: 2.8.2r1
|
||||
*/
|
||||
html {
|
||||
color: #000;
|
||||
background: #FFF;
|
||||
}
|
||||
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0;
|
||||
}
|
||||
fieldset,img {
|
||||
border: 0;
|
||||
}
|
||||
address,caption,cite,code,dfn,em,strong,th,var,optgroup {
|
||||
font-style: inherit;
|
||||
font-weight: inherit;
|
||||
}
|
||||
del,ins {
|
||||
text-decoration: none;
|
||||
}
|
||||
li {
|
||||
margin-left: 20px;
|
||||
}
|
||||
caption,th {
|
||||
text-align: left;
|
||||
}
|
||||
h1,h2,h3,h4,h5,h6 {
|
||||
font-size: 100%;
|
||||
font-weight: bold;
|
||||
}
|
||||
q:before,q:after {
|
||||
content: '';
|
||||
}
|
||||
abbr,acronym {
|
||||
border: 0;
|
||||
font-variant: normal;
|
||||
}
|
||||
sup {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
sub {
|
||||
vertical-align: baseline;
|
||||
}
|
||||
legend {
|
||||
color: #000;
|
||||
}
|
||||
input,button,textarea,select,optgroup,option {
|
||||
font-family: inherit;
|
||||
font-size: inherit;
|
||||
font-style: inherit;
|
||||
font-weight: inherit;
|
||||
}
|
||||
input,button,textarea,select {*font-size:100%;
|
||||
}
|
||||
/* END RESET */
|
||||
|
||||
body {
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
font-family: arial, helvetica, geneva, sans-serif;
|
||||
background-color: #ffffff; margin: 0px;
|
||||
}
|
||||
|
||||
code, tt { font-family: monospace; font-size: 1.1em; }
|
||||
span.parameter { font-family:monospace; }
|
||||
span.parameter:after { content:":"; }
|
||||
span.types:before { content:"("; }
|
||||
span.types:after { content:")"; }
|
||||
.type { font-weight: bold; font-style:italic }
|
||||
|
||||
body, p, td, th { font-size: .95em; line-height: 1.2em;}
|
||||
|
||||
p, ul { margin: 10px 0 0 0px;}
|
||||
|
||||
strong { font-weight: bold;}
|
||||
|
||||
em { font-style: italic;}
|
||||
|
||||
h1 {
|
||||
font-size: 1.5em;
|
||||
margin: 20px 0 20px 0;
|
||||
}
|
||||
h2, h3, h4 { margin: 15px 0 10px 0; }
|
||||
h2 { font-size: 1.25em; }
|
||||
h3 { font-size: 1.15em; }
|
||||
h4 { font-size: 1.06em; }
|
||||
|
||||
a:link { font-weight: bold; color: #004080; text-decoration: none; }
|
||||
a:visited { font-weight: bold; color: #006699; text-decoration: none; }
|
||||
a:link:hover { text-decoration: underline; }
|
||||
|
||||
hr {
|
||||
color:#cccccc;
|
||||
background: #00007f;
|
||||
height: 1px;
|
||||
}
|
||||
|
||||
blockquote { margin-left: 3em; }
|
||||
|
||||
ul { list-style-type: disc; }
|
||||
|
||||
p.name {
|
||||
font-family: "Andale Mono", monospace;
|
||||
padding-top: 1em;
|
||||
}
|
||||
|
||||
pre {
|
||||
background-color: rgb(245, 245, 245);
|
||||
border: 1px solid #C0C0C0; /* silver */
|
||||
padding: 10px;
|
||||
margin: 10px 0 10px 0;
|
||||
overflow: auto;
|
||||
font-family: "Andale Mono", monospace;
|
||||
}
|
||||
|
||||
pre.example {
|
||||
font-size: .85em;
|
||||
}
|
||||
|
||||
table.index { border: 1px #00007f; }
|
||||
table.index td { text-align: left; vertical-align: top; }
|
||||
|
||||
#container {
|
||||
margin-left: 1em;
|
||||
margin-right: 1em;
|
||||
background-color: #f0f0f0;
|
||||
}
|
||||
|
||||
#product {
|
||||
text-align: center;
|
||||
border-bottom: 1px solid #cccccc;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#product big {
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
#main {
|
||||
background-color: #f0f0f0;
|
||||
border-left: 2px solid #cccccc;
|
||||
}
|
||||
|
||||
#navigation {
|
||||
float: left;
|
||||
width: 14em;
|
||||
vertical-align: top;
|
||||
background-color: #f0f0f0;
|
||||
overflow: visible;
|
||||
position: fixed;
|
||||
}
|
||||
|
||||
#navigation h2 {
|
||||
background-color:#e7e7e7;
|
||||
font-size:1.1em;
|
||||
color:#000000;
|
||||
text-align: left;
|
||||
padding:0.2em;
|
||||
border-top:1px solid #dddddd;
|
||||
border-bottom:1px solid #dddddd;
|
||||
}
|
||||
|
||||
#navigation ul
|
||||
{
|
||||
font-size:1em;
|
||||
list-style-type: none;
|
||||
margin: 1px 1px 10px 1px;
|
||||
}
|
||||
|
||||
#navigation li {
|
||||
text-indent: -1em;
|
||||
display: block;
|
||||
margin: 3px 0px 0px 22px;
|
||||
}
|
||||
|
||||
#navigation li li a {
|
||||
margin: 0px 3px 0px -1em;
|
||||
}
|
||||
|
||||
#content {
|
||||
margin-left: 14em;
|
||||
padding: 1em;
|
||||
width: 700px;
|
||||
border-left: 2px solid #cccccc;
|
||||
border-right: 2px solid #cccccc;
|
||||
background-color: #ffffff;
|
||||
min-height: 425px;
|
||||
}
|
||||
|
||||
#about {
|
||||
clear: both;
|
||||
padding: 5px;
|
||||
border-top: 2px solid #cccccc;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
@media print {
|
||||
body {
|
||||
font: 12pt "Times New Roman", "TimeNR", Times, serif;
|
||||
}
|
||||
a { font-weight: bold; color: #004080; text-decoration: underline; }
|
||||
|
||||
#main {
|
||||
background-color: #ffffff;
|
||||
border-left: 0px;
|
||||
}
|
||||
|
||||
#container {
|
||||
margin-left: 2%;
|
||||
margin-right: 2%;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#content {
|
||||
padding: 1em;
|
||||
background-color: #ffffff;
|
||||
}
|
||||
|
||||
#navigation {
|
||||
display: none;
|
||||
}
|
||||
pre.example {
|
||||
font-family: "Andale Mono", monospace;
|
||||
font-size: 10pt;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
}
|
||||
|
||||
table.module_list {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.module_list td {
|
||||
border-width: 1px;
|
||||
padding: 3px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
}
|
||||
table.module_list td.name { background-color: #f0f0f0; min-width: 200px; }
|
||||
table.module_list td.summary { width: 100%; }
|
||||
|
||||
|
||||
table.function_list {
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
table.function_list td {
|
||||
border-width: 1px;
|
||||
padding: 3px;
|
||||
border-style: solid;
|
||||
border-color: #cccccc;
|
||||
}
|
||||
table.function_list td.name { background-color: #f0f0f0; min-width: 200px; }
|
||||
table.function_list td.summary { width: 100%; }
|
||||
|
||||
ul.nowrap {
|
||||
overflow:auto;
|
||||
white-space:nowrap;
|
||||
}
|
||||
|
||||
dl.table dt, dl.function dt {border-top: 1px solid #ccc; padding-top: 1em;}
|
||||
dl.table dd, dl.function dd {padding-bottom: 1em; margin: 10px 0 0 20px;}
|
||||
dl.table h3, dl.function h3 {font-size: .95em;}
|
||||
|
||||
/* stop sublists from having initial vertical space */
|
||||
ul ul { margin-top: 0px; }
|
||||
ol ul { margin-top: 0px; }
|
||||
ol ol { margin-top: 0px; }
|
||||
ul ol { margin-top: 0px; }
|
||||
|
||||
/* make the target distinct; helps when we're navigating to a function */
|
||||
a:target + * {
|
||||
background-color: #FF9;
|
||||
}
|
||||
|
||||
|
||||
/* styles for prettification of source */
|
||||
pre .comment { color: #558817; }
|
||||
pre .constant { color: #a8660d; }
|
||||
pre .escape { color: #844631; }
|
||||
pre .keyword { color: #aa5050; font-weight: bold; }
|
||||
pre .library { color: #0e7c6b; }
|
||||
pre .marker { color: #512b1e; background: #fedc56; font-weight: bold; }
|
||||
pre .string { color: #8080ff; }
|
||||
pre .number { color: #f8660d; }
|
||||
pre .operator { color: #2239a8; font-weight: bold; }
|
||||
pre .preprocessor, pre .prepro { color: #a33243; }
|
||||
pre .global { color: #800080; }
|
||||
pre .user-keyword { color: #800080; }
|
||||
pre .prompt { color: #558817; }
|
||||
pre .url { color: #272fc2; text-decoration: underline; }
|
||||
|
21
README.md
21
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].
|
||||
|
||||

|
||||
|
||||
|
@ -10,13 +10,10 @@ A [Minetest][] mod that can be used to remove/replace unknown entities, nodes, &
|
|||
|
||||
- Code: [MIT](LICENSE.txt)
|
||||
- Textures: CC0
|
||||
- Sounds:
|
||||
- cleaner_pencil_write: [CC0](https://freesound.org/people/NachtmahrTV/sounds/571800/)
|
||||
- cleaner_pencil_erase: [CC0](https://freesound.org/people/damsur/sounds/443241/)
|
||||
|
||||
### Requirements:
|
||||
|
||||
- Minetest minimum version: 5.0
|
||||
- Luanti minimum version: 5.0
|
||||
- Depends: none
|
||||
|
||||
### Usage:
|
||||
|
@ -76,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/
|
||||
|
|
3
TODO.txt
3
TODO.txt
|
@ -9,3 +9,6 @@ TODO:
|
|||
- add "xrotate" & "zrorate" modes for pencil
|
||||
- don't require "server" priv for "find_unknown_nodes" & "find_neaby_nodes" commands
|
||||
- add chat command to find nodes with specified attributes
|
||||
- may be better to update player inventories on login than add aliases for items
|
||||
- use aliases for unknown nodes instead of LBM
|
||||
- only use LBM when a node to replace is still registered
|
||||
|
|
|
@ -1,4 +1,16 @@
|
|||
|
||||
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
|
||||
----
|
||||
- added API
|
||||
|
@ -14,14 +26,14 @@ v1.2
|
|||
- replace_items
|
||||
- replace_nodes
|
||||
- find_unknown_nodes
|
||||
- find_neaby_nodes
|
||||
- find_nearby_nodes
|
||||
- remove_ores (unsafe)
|
||||
- ctool (manages pencil tool settings)
|
||||
- ctool (manages wielded cleaner tool settings)
|
||||
|
||||
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",}
|
||||
|
@ -151,6 +156,7 @@ local tool = {
|
|||
end,
|
||||
}
|
||||
|
||||
local use_sounds = core.global_exists("sounds")
|
||||
local sound_handle
|
||||
|
||||
tool.on_use = function(stack, user, pointed_thing)
|
||||
|
@ -175,17 +181,23 @@ tool.on_use = function(stack, user, pointed_thing)
|
|||
|
||||
if mode == "erase" then
|
||||
core.remove_node(npos)
|
||||
sound_handle = core.sound_play("cleaner_pencil_erase", {object=user})
|
||||
if use_sounds then
|
||||
local sound_handle = sounds.pencil_erase({object=user})
|
||||
end
|
||||
return stack
|
||||
elseif core.registered_nodes[new_node_name] then
|
||||
if mode == "swap" then
|
||||
core.swap_node(npos, {name=new_node_name})
|
||||
sound_handle = core.sound_play("cleaner_pencil_write", {object=user})
|
||||
if use_sounds then
|
||||
local sound_handle = sounds.pencil_write({object=user})
|
||||
end
|
||||
elseif mode == "write" then
|
||||
local node_above = core.get_node_or_nil(pointed_thing.above)
|
||||
if not node_above or node_above.name == "air" then
|
||||
core.set_node(pointed_thing.above, {name=new_node_name})
|
||||
sound_handle = core.sound_play("cleaner_pencil_write", {object=user})
|
||||
if use_sounds then
|
||||
local sound_handle = sounds.pencil_write({object=user})
|
||||
end
|
||||
else
|
||||
core.chat_send_player(pname, S("Can't place node there."))
|
||||
end
|
||||
|
|
3
mod.conf
3
mod.conf
|
@ -1,6 +1,7 @@
|
|||
name = cleaner
|
||||
description = A mod that can be used to remove/replace unknown entities, nodes, & items.
|
||||
version = 1.2
|
||||
version = 2025-01-18
|
||||
license = MIT
|
||||
author = PilzAdam, Jordan Irwin (AntumDeluge)
|
||||
min_minetest_version = 5.0
|
||||
optional_depends = sounds
|
||||
|
|
70
set_version.py
Executable file
70
set_version.py
Executable file
|
@ -0,0 +1,70 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import sys, os, codecs
|
||||
|
||||
|
||||
f_script = os.path.realpath(__file__)
|
||||
d_root = os.path.dirname(f_script)
|
||||
|
||||
os.chdir(d_root)
|
||||
|
||||
args = sys.argv[1:]
|
||||
if len(args) < 1:
|
||||
print("ERROR: must supply version as parameter")
|
||||
sys.exit(1)
|
||||
|
||||
new_version = args[0]
|
||||
|
||||
to_update = {
|
||||
"mod.conf": "version =",
|
||||
"changelog.txt": "next",
|
||||
os.path.normpath(".ldoc/config.ld"): "local version =",
|
||||
}
|
||||
|
||||
for f in to_update:
|
||||
f_path = os.path.join(d_root, f)
|
||||
if not os.path.isfile(f_path):
|
||||
print("WARNING: {} not found, skipping ...".format(f))
|
||||
continue
|
||||
|
||||
print("\nsetting version to {} in {}".format(new_version, f_path))
|
||||
|
||||
buffer = codecs.open(f_path, "r", "utf-8")
|
||||
if not buffer:
|
||||
print("WARNING: could not open {} for reading, skipping ...".format(f))
|
||||
continue
|
||||
|
||||
read_in = buffer.read()
|
||||
buffer.close()
|
||||
|
||||
read_in = read_in.replace("\r\n", "\n").replace("\r", "\n")
|
||||
replacement = to_update[f]
|
||||
new_lines = []
|
||||
|
||||
version_set = False
|
||||
for li in read_in.split("\n"):
|
||||
if not version_set:
|
||||
if "=" in replacement and li.startswith(replacement):
|
||||
key = li.split(" = ")[0]
|
||||
li = "{} = {}".format(key, new_version)
|
||||
version_set = True
|
||||
elif li == replacement:
|
||||
li = "v{}".format(new_version)
|
||||
version_set = True
|
||||
|
||||
new_lines.append(li)
|
||||
|
||||
write_out = "\n".join(new_lines)
|
||||
if write_out == read_in:
|
||||
print("no changes for {}, skipping ...".format(f))
|
||||
continue
|
||||
|
||||
buffer = codecs.open(f_path, "w", "utf-8")
|
||||
if not buffer:
|
||||
print("WARNING: could not open {} for writing, skipping ...".format(f))
|
||||
continue
|
||||
|
||||
buffer.write("\n".join(new_lines))
|
||||
buffer.close()
|
||||
|
||||
print("done")
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Add table
Reference in a new issue