Update cleaner mod to v1.2...
https://github.com/AntumMT/mod-cleaner/releases/tag/v1.2
This commit is contained in:
parent
09b94a0279
commit
6904b8382a
@ -11,7 +11,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
|||||||
|
|
||||||
* admin/
|
* admin/
|
||||||
* [alternode][] ([MIT][lic.alternode]) -- version: [1.3][ver.alternode] *2021-05-18*
|
* [alternode][] ([MIT][lic.alternode]) -- version: [1.3][ver.alternode] *2021-05-18*
|
||||||
* [cleaner][] ([MIT][lic.cleaner]) -- version: [182726e Git][ver.cleaner] *2021-07-29*
|
* [cleaner][] ([MIT][lic.cleaner]) -- version: [1.2][ver.cleaner] *2021-08-02*
|
||||||
* [no_fall_damage][] ([MIT][lic.no_fall_damage]) -- version [1.0.0][ver.no_fall_damage] *2020-12-19*
|
* [no_fall_damage][] ([MIT][lic.no_fall_damage]) -- version [1.0.0][ver.no_fall_damage] *2020-12-19*
|
||||||
* [spectator_mode][] ([WTFPL][lic.spectator_mode]) -- version: [3648371 Git][ver.spectator_mode] *2020-07-15*
|
* [spectator_mode][] ([WTFPL][lic.spectator_mode]) -- version: [3648371 Git][ver.spectator_mode] *2020-07-15*
|
||||||
* [whitelist][] ([MIT][lic.whitelist]) -- version: [1.1][ver.whitelist] *2021-06-09*
|
* [whitelist][] ([MIT][lic.whitelist]) -- version: [1.1][ver.whitelist] *2021-06-09*
|
||||||
@ -580,7 +580,7 @@ The game includes the mods from the default [minetest_game](https://github.com/m
|
|||||||
[ver.castle_weapons]: https://github.com/minetest-mods/castle_weapons/tree/d3cf095
|
[ver.castle_weapons]: https://github.com/minetest-mods/castle_weapons/tree/d3cf095
|
||||||
[ver.chatlog]: https://github.com/AntumMT/mod-chatlog/tree/v1.1
|
[ver.chatlog]: https://github.com/AntumMT/mod-chatlog/tree/v1.1
|
||||||
[ver.christmas]: https://github.com/TheZenKitteh/minetest-christmas/tree/d3bd872
|
[ver.christmas]: https://github.com/TheZenKitteh/minetest-christmas/tree/d3bd872
|
||||||
[ver.cleaner]: https://github.com/AntumMT/mod-cleaner/tree/182726e
|
[ver.cleaner]: https://github.com/AntumMT/mod-cleaner/releases/tag/v1.2
|
||||||
[ver.cmer]: https://github.com/AntumMT/mod-cmer/tree/2843875
|
[ver.cmer]: https://github.com/AntumMT/mod-cmer/tree/2843875
|
||||||
[ver.cmer_chicken]: http://github.com/AntumMT/mod-cmer/tree/085706f
|
[ver.cmer_chicken]: http://github.com/AntumMT/mod-cmer/tree/085706f
|
||||||
[ver.cmer_ghost]: https://github.com/AntumMT/mod-cmer/tree/2f70906
|
[ver.cmer_ghost]: https://github.com/AntumMT/mod-cmer/tree/2f70906
|
||||||
|
@ -4,6 +4,8 @@
|
|||||||
|
|
||||||
A [Minetest][] mod that can be used to remove/replace unknown entities, nodes, & items. Originally forked from [PilzAdam's ***clean*** mod][f.pilzadam].
|
A [Minetest][] mod that can be used to remove/replace unknown entities, nodes, & items. Originally forked from [PilzAdam's ***clean*** mod][f.pilzadam].
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
### Licensing:
|
### Licensing:
|
||||||
|
|
||||||
- Code: [MIT](LICENSE.txt)
|
- Code: [MIT](LICENSE.txt)
|
||||||
@ -77,7 +79,7 @@ cleaner.unsafe
|
|||||||
- [][ContentDB]
|
- [][ContentDB]
|
||||||
- [Forum](https://forum.minetest.net/viewtopic.php?t=18381)
|
- [Forum](https://forum.minetest.net/viewtopic.php?t=18381)
|
||||||
- [Git repo](https://github.com/AntumMT/mod-cleaner)
|
- [Git repo](https://github.com/AntumMT/mod-cleaner)
|
||||||
- [API](https://antummt.github.io/mod-cleaner/docs/reference)
|
- [Reference](https://antummt.github.io/mod-cleaner/reference)
|
||||||
- [Changelog](changelog.txt)
|
- [Changelog](changelog.txt)
|
||||||
- [TODO](TODO.txt)
|
- [TODO](TODO.txt)
|
||||||
|
|
||||||
|
@ -5,8 +5,7 @@ TODO:
|
|||||||
- creative
|
- creative
|
||||||
- storage (chests, etc.)
|
- storage (chests, etc.)
|
||||||
- add LBM when removing an item if it is a node
|
- add LBM when removing an item if it is a node
|
||||||
- update localization files
|
|
||||||
- add "radius" option for pencil or "xlen", "ylen", & "zlen" options
|
- add "radius" option for pencil or "xlen", "ylen", & "zlen" options
|
||||||
- add "xrotate" & "zrorate" modes for pencil
|
- add "xrotate" & "zrorate" modes for pencil
|
||||||
- fix pencil "write" mode when pointing to side of node (node gets placed below)
|
- don't require "server" priv for "find_unknown_nodes" & "find_neaby_nodes" commands
|
||||||
- add config file usage to HTML docs
|
- add chat command to find nodes with specified attributes
|
||||||
|
@ -141,9 +141,9 @@ function cleaner.register_node_replacement(src, tgt)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Unsafe methods.
|
--- Unsafe Methods.
|
||||||
--
|
--
|
||||||
-- Enabled with `cleaner.unsafe` setting.
|
-- Enabled with [cleaner.unsafe](settings.html#cleaner.unsafe) setting.
|
||||||
--
|
--
|
||||||
-- @section unsafe
|
-- @section unsafe
|
||||||
|
|
||||||
@ -153,7 +153,7 @@ if cleaner.unsafe then
|
|||||||
|
|
||||||
--- Retrieves list of ores to be removed.
|
--- Retrieves list of ores to be removed.
|
||||||
--
|
--
|
||||||
-- @treturn table Ores to be replaced.
|
-- @treturn table Ores to be removed.
|
||||||
function cleaner.get_remove_ores()
|
function cleaner.get_remove_ores()
|
||||||
return remove_ores
|
return remove_ores
|
||||||
end
|
end
|
||||||
|
@ -2,20 +2,21 @@
|
|||||||
v1.2
|
v1.2
|
||||||
----
|
----
|
||||||
- added API
|
- added API
|
||||||
- added chat commands:
|
|
||||||
- remove_entities
|
|
||||||
- remove_nodes
|
|
||||||
- replace_items
|
|
||||||
- replace_nodes
|
|
||||||
- find_unknown_nodes
|
|
||||||
- replace_ores (unsafe)
|
|
||||||
- added support for unregistering ores (unsafe)
|
- added support for unregistering ores (unsafe)
|
||||||
- added setting for enabling "unsafe" methods & commands
|
- added setting for enabling "unsafe" methods & commands
|
||||||
- all types are loaded from <world_path>/cleaner.json file
|
- all types are loaded from <world_path>/cleaner.json file
|
||||||
- added localization support
|
- added localization support
|
||||||
- added Spanish localization
|
- added Spanish localization
|
||||||
- added pencil tool for erasing, adding, & swapping nodes
|
- added pencil tool for erasing, adding, & swapping nodes
|
||||||
- added "cleaner" chat command for managing pencil tool settings
|
- added chat commands:
|
||||||
|
- remove_entities
|
||||||
|
- remove_nodes
|
||||||
|
- replace_items
|
||||||
|
- replace_nodes
|
||||||
|
- find_unknown_nodes
|
||||||
|
- find_nearby_nodes
|
||||||
|
- remove_ores (unsafe)
|
||||||
|
- ctool (manages wielded cleaner tool settings)
|
||||||
|
|
||||||
v1.1
|
v1.1
|
||||||
----
|
----
|
||||||
|
@ -32,6 +32,9 @@ local param_def = {
|
|||||||
old_item = {name=S("old_item"), desc=S("Technical name of item to be replaced.")},
|
old_item = {name=S("old_item"), desc=S("Technical name of item to be replaced.")},
|
||||||
new_item = {name=S("new_item"), desc=S("Technical name of item to be used in place.")},
|
new_item = {name=S("new_item"), desc=S("Technical name of item to be used in place.")},
|
||||||
ore = {name=S("ore"), desc=S("Ore technical name.")},
|
ore = {name=S("ore"), desc=S("Ore technical name.")},
|
||||||
|
action = {name=S("action"),
|
||||||
|
desc=S('Action to execute. Can be one of "@1", "@2", or "@3".', "status", "setmode", "setnode")},
|
||||||
|
value = {name=S("value"), desc=S('Mode or node to be set for tool (not required for "@1" action).', "status")},
|
||||||
}
|
}
|
||||||
|
|
||||||
local cmd_repo = {
|
local cmd_repo = {
|
||||||
@ -54,6 +57,10 @@ local cmd_repo = {
|
|||||||
cmd = "find_unknown_nodes",
|
cmd = "find_unknown_nodes",
|
||||||
oparams = {radius=100},
|
oparams = {radius=100},
|
||||||
},
|
},
|
||||||
|
near_node = {
|
||||||
|
cmd = "find_nearby_nodes",
|
||||||
|
oparams = {radius=5},
|
||||||
|
},
|
||||||
item = {
|
item = {
|
||||||
cmd = "replace_items",
|
cmd = "replace_items",
|
||||||
params = {"old_item", "new_item"},
|
params = {"old_item", "new_item"},
|
||||||
@ -62,6 +69,10 @@ local cmd_repo = {
|
|||||||
cmd = "remove_ores",
|
cmd = "remove_ores",
|
||||||
params = {"ore"},
|
params = {"ore"},
|
||||||
},
|
},
|
||||||
|
tool = {
|
||||||
|
cmd = "ctool",
|
||||||
|
params = {"action", "value"},
|
||||||
|
},
|
||||||
param = {
|
param = {
|
||||||
missing = S("Missing parameter."),
|
missing = S("Missing parameter."),
|
||||||
excess = S("Too many parameters."),
|
excess = S("Too many parameters."),
|
||||||
@ -181,11 +192,32 @@ local function format_help(cmd)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function check_radius(radius, pname)
|
||||||
|
local is_admin = core.check_player_privs(pname, {server=true})
|
||||||
|
|
||||||
|
if not is_admin and radius > 10 then
|
||||||
|
radius = 10
|
||||||
|
return radius, S("You do not have permission to set radius that high. Reduced to @1.", radius)
|
||||||
|
end
|
||||||
|
|
||||||
|
if radius > 100 then
|
||||||
|
radius = 100
|
||||||
|
return radius, S("Radius is too high. Reduced to @1.", radius)
|
||||||
|
end
|
||||||
|
|
||||||
|
return radius
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
--- Removes nearby entities.
|
--- Removes nearby entities.
|
||||||
--
|
--
|
||||||
-- @chatcmd remove_entities
|
-- @chatcmd remove_entities
|
||||||
-- @param entity Entity technical name.
|
-- @param entity Entity technical name.
|
||||||
-- @tparam[opt] int radius
|
-- @tparam[opt] int radius Search radius (default: 100).
|
||||||
|
-- @priv server
|
||||||
|
-- @usage
|
||||||
|
-- # remove all mobs:horse entities within a radius of 10 nodes
|
||||||
|
-- /remove_entities mobs:horse 10
|
||||||
core.register_chatcommand(cmd_repo.entity.cmd, {
|
core.register_chatcommand(cmd_repo.entity.cmd, {
|
||||||
privs = {server=true},
|
privs = {server=true},
|
||||||
description = S("Remove an entity from game.") .. "\n\n"
|
description = S("Remove an entity from game.") .. "\n\n"
|
||||||
@ -209,6 +241,11 @@ core.register_chatcommand(cmd_repo.entity.cmd, {
|
|||||||
err = cmd_repo.param.mal_radius
|
err = cmd_repo.param.mal_radius
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local radius, msg = check_radius(radius, name)
|
||||||
|
if msg then
|
||||||
|
core.chat_send_player(name, msg)
|
||||||
|
end
|
||||||
|
|
||||||
if err then
|
if err then
|
||||||
return false, err .. "\n\n" .. format_help(cmd_repo.entity.cmd)
|
return false, err .. "\n\n" .. format_help(cmd_repo.entity.cmd)
|
||||||
end
|
end
|
||||||
@ -240,7 +277,11 @@ core.register_chatcommand(cmd_repo.entity.cmd, {
|
|||||||
--
|
--
|
||||||
-- @chatcmd remove_nodes
|
-- @chatcmd remove_nodes
|
||||||
-- @param node Node technical name.
|
-- @param node Node technical name.
|
||||||
-- @tparam[opt] int radius
|
-- @tparam[opt] int radius Search radius (default: 5).
|
||||||
|
-- @priv server
|
||||||
|
-- @usage
|
||||||
|
-- # remove all default:dirt nodes within a radius of 10
|
||||||
|
-- /remove_nodes default:dirt 10
|
||||||
core.register_chatcommand(cmd_repo.rem_node.cmd, {
|
core.register_chatcommand(cmd_repo.rem_node.cmd, {
|
||||||
privs = {server=true},
|
privs = {server=true},
|
||||||
description = S("Remove a node from game.") .. "\n\n"
|
description = S("Remove a node from game.") .. "\n\n"
|
||||||
@ -264,6 +305,11 @@ core.register_chatcommand(cmd_repo.rem_node.cmd, {
|
|||||||
err = cmd_repo.param.mal_radius
|
err = cmd_repo.param.mal_radius
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local radius, msg = check_radius(radius, name)
|
||||||
|
if msg then
|
||||||
|
core.chat_send_player(name, msg)
|
||||||
|
end
|
||||||
|
|
||||||
if err then
|
if err then
|
||||||
return false, err .. "\n\n" .. format_help(cmd_repo.rem_node.cmd)
|
return false, err .. "\n\n" .. format_help(cmd_repo.rem_node.cmd)
|
||||||
end
|
end
|
||||||
@ -288,6 +334,10 @@ core.register_chatcommand(cmd_repo.rem_node.cmd, {
|
|||||||
-- @chatcmd replace_items
|
-- @chatcmd replace_items
|
||||||
-- @param old_item Technical name of item to replace.
|
-- @param old_item Technical name of item to replace.
|
||||||
-- @param new_item Technical name of item to be used in place.
|
-- @param new_item Technical name of item to be used in place.
|
||||||
|
-- @priv server
|
||||||
|
-- @usage
|
||||||
|
-- # replace default:sword_wood with default:sword_mese
|
||||||
|
-- /replace_items default:sword_wood default:sword_mese
|
||||||
core.register_chatcommand(cmd_repo.item.cmd, {
|
core.register_chatcommand(cmd_repo.item.cmd, {
|
||||||
privs = {server=true},
|
privs = {server=true},
|
||||||
description = S("Replace an item in game.") .. "\n\n"
|
description = S("Replace an item in game.") .. "\n\n"
|
||||||
@ -316,7 +366,11 @@ core.register_chatcommand(cmd_repo.item.cmd, {
|
|||||||
-- @chatcmd replace_nodes
|
-- @chatcmd replace_nodes
|
||||||
-- @param old_node Technical name of node to replace.
|
-- @param old_node Technical name of node to replace.
|
||||||
-- @param new_node Technical name of node to be used in place.
|
-- @param new_node Technical name of node to be used in place.
|
||||||
-- @tparam[opt] int radius
|
-- @tparam[opt] int radius Search radius (default: 5).
|
||||||
|
-- @priv server
|
||||||
|
-- @usage
|
||||||
|
-- # replace all default:dirt nodes with default:cobble within a radius of 10
|
||||||
|
-- /replace_nodes default:dirt default:cobble 10
|
||||||
core.register_chatcommand(cmd_repo.rep_node.cmd, {
|
core.register_chatcommand(cmd_repo.rep_node.cmd, {
|
||||||
privs = {server=true},
|
privs = {server=true},
|
||||||
description = S("Replace a node in game.") .. "\n\n"
|
description = S("Replace a node in game.") .. "\n\n"
|
||||||
@ -342,6 +396,11 @@ core.register_chatcommand(cmd_repo.rep_node.cmd, {
|
|||||||
return false, cmd_repo.param.mal_radius .. "\n\n" .. help
|
return false, cmd_repo.param.mal_radius .. "\n\n" .. help
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local radius, msg = check_radius(radius, name)
|
||||||
|
if msg then
|
||||||
|
core.chat_send_player(name, msg)
|
||||||
|
end
|
||||||
|
|
||||||
if not core.registered_nodes[tgt] then
|
if not core.registered_nodes[tgt] then
|
||||||
return false, S('Cannot use unknown node "@1" as replacement.', tgt)
|
return false, S('Cannot use unknown node "@1" as replacement.', tgt)
|
||||||
end
|
end
|
||||||
@ -366,7 +425,11 @@ core.register_chatcommand(cmd_repo.rep_node.cmd, {
|
|||||||
--- Checks for nearby unknown nodes.
|
--- Checks for nearby unknown nodes.
|
||||||
--
|
--
|
||||||
-- @chatcmd find_unknown_nodes
|
-- @chatcmd find_unknown_nodes
|
||||||
-- @tparam[opt] int radius Search radius.
|
-- @tparam[opt] int radius Search radius (default: 100).
|
||||||
|
-- @priv server
|
||||||
|
-- @usage
|
||||||
|
-- # print names of all unknown nodes within radius of 10
|
||||||
|
-- /find_unknown_nodes 10
|
||||||
core.register_chatcommand(cmd_repo.find_node.cmd, {
|
core.register_chatcommand(cmd_repo.find_node.cmd, {
|
||||||
privs = {server=true},
|
privs = {server=true},
|
||||||
description = S("Find names of unknown nodes.") .. "\n\n"
|
description = S("Find names of unknown nodes.") .. "\n\n"
|
||||||
@ -388,6 +451,11 @@ core.register_chatcommand(cmd_repo.find_node.cmd, {
|
|||||||
return false, cmd_repo.param.mal_radius .. "\n\n" .. help
|
return false, cmd_repo.param.mal_radius .. "\n\n" .. help
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local radius, msg = check_radius(radius, name)
|
||||||
|
if msg then
|
||||||
|
core.chat_send_player(name, msg)
|
||||||
|
end
|
||||||
|
|
||||||
local ppos = core.get_player_by_name(name):get_pos()
|
local ppos = core.get_player_by_name(name):get_pos()
|
||||||
|
|
||||||
local checked_nodes = {}
|
local checked_nodes = {}
|
||||||
@ -403,9 +471,9 @@ core.register_chatcommand(cmd_repo.find_node.cmd, {
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local msg
|
local node_count = #unknown_nodes
|
||||||
if #unknown_nodes > 0 then
|
if node_count > 0 then
|
||||||
msg = S("Found unknown nodes: @1", table.concat(unknown_nodes, ", "))
|
msg = S("Found unknown nodes: @1", node_count) .. "\n " .. table.concat(unknown_nodes, ", ")
|
||||||
else
|
else
|
||||||
msg = S("No unknown nodes found.")
|
msg = S("No unknown nodes found.")
|
||||||
end
|
end
|
||||||
@ -414,10 +482,71 @@ core.register_chatcommand(cmd_repo.find_node.cmd, {
|
|||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
--- Finds names of nearby nodes.
|
||||||
--- Unsafe commands.
|
|
||||||
--
|
--
|
||||||
-- Enabled with `cleaner.unsafe` setting.
|
-- @chatcmd find_nearby_nodes
|
||||||
|
-- @tparam[opt] int radius Search radius (default: 5).
|
||||||
|
-- @priv server
|
||||||
|
-- @usage
|
||||||
|
-- # print names of all node types found within radius of 10
|
||||||
|
-- /find_nearby_nodes 10
|
||||||
|
core.register_chatcommand(cmd_repo.near_node.cmd, {
|
||||||
|
privs = {server=true},
|
||||||
|
description = S("Find names of nearby nodes.") .. "\n\n"
|
||||||
|
.. format_params(cmd_repo.near_node.cmd),
|
||||||
|
params = cmd_repo.near_node.help.param_string,
|
||||||
|
func = function(name, param)
|
||||||
|
local help = format_help(cmd_repo.near_node.cmd)
|
||||||
|
|
||||||
|
if param:find(" ") then
|
||||||
|
return false, cmd_repo.param.excess .. "\n\n" .. help
|
||||||
|
end
|
||||||
|
|
||||||
|
local radius = cmd_repo.near_node.oparams.radius
|
||||||
|
if param and param:trim() ~= "" then
|
||||||
|
radius = tonumber(param)
|
||||||
|
end
|
||||||
|
|
||||||
|
if not radius then
|
||||||
|
return false, cmd_repo.param.mal_radius .. "\n\n" .. help
|
||||||
|
end
|
||||||
|
|
||||||
|
local radius, msg = check_radius(radius, name)
|
||||||
|
if msg then
|
||||||
|
core.chat_send_player(name, msg)
|
||||||
|
end
|
||||||
|
|
||||||
|
local ppos = core.get_player_by_name(name):get_pos()
|
||||||
|
|
||||||
|
local node_names = {}
|
||||||
|
for _, npos in ipairs(pos_list(ppos, radius)) do
|
||||||
|
local node = core.get_node_or_nil(npos)
|
||||||
|
if node and not node_names[node.name] then
|
||||||
|
node_names[node.name] = true
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local found_nodes = {}
|
||||||
|
for k, _ in pairs(node_names) do
|
||||||
|
table.insert(found_nodes, k)
|
||||||
|
end
|
||||||
|
|
||||||
|
local msg
|
||||||
|
local node_count = #found_nodes
|
||||||
|
if node_count > 0 then
|
||||||
|
msg = S("Nearby nodes: @1", node_count) .. "\n " .. table.concat(found_nodes, ", ")
|
||||||
|
else
|
||||||
|
msg = S("No nearby nodes found.")
|
||||||
|
end
|
||||||
|
|
||||||
|
return true, msg
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
--- Unsafe Commands.
|
||||||
|
--
|
||||||
|
-- Enabled with [cleaner.unsafe](settings.html#cleaner.unsafe) setting.
|
||||||
--
|
--
|
||||||
-- @section unsafe
|
-- @section unsafe
|
||||||
|
|
||||||
@ -427,6 +556,12 @@ if cleaner.unsafe then
|
|||||||
--
|
--
|
||||||
-- @chatcmd remove_ores
|
-- @chatcmd remove_ores
|
||||||
-- @param ore Ore technical name.
|
-- @param ore Ore technical name.
|
||||||
|
-- @priv server
|
||||||
|
-- @note This action is reverted after server restart. To make changes permanent,
|
||||||
|
-- use the [cleaner.json](config.html#cleaner.json) config.
|
||||||
|
-- @usage
|
||||||
|
-- # remove all registered ores that add default:stone_with_iron to world
|
||||||
|
-- /remove_ores default:stone_with_iron
|
||||||
core.register_chatcommand(cmd_repo.ore.cmd, {
|
core.register_chatcommand(cmd_repo.ore.cmd, {
|
||||||
privs = {server=true},
|
privs = {server=true},
|
||||||
description = S("Remove an ore from game.") .. "\n\n"
|
description = S("Remove an ore from game.") .. "\n\n"
|
||||||
@ -463,17 +598,24 @@ end
|
|||||||
--- @section end
|
--- @section end
|
||||||
|
|
||||||
|
|
||||||
--- Manages settings for wielded cleaner tool.
|
--- Manages settings for wielded [cleaner tool](tools.html).
|
||||||
--
|
--
|
||||||
-- @chatcmd cleaner
|
-- <h3>Required Privileges:</h3>
|
||||||
|
--
|
||||||
|
-- - server
|
||||||
|
--
|
||||||
|
-- @chatcmd ctool
|
||||||
-- @param action Action to execute. Can be "status", "setmode", or "setnode".
|
-- @param action Action to execute. Can be "status", "setmode", or "setnode".
|
||||||
-- @param value Mode or node to be set for tool.
|
-- @param value Mode or node to be set for tool (not required for "status" action).
|
||||||
core.register_chatcommand("cleaner", {
|
-- @usage
|
||||||
|
-- # while cleaner:pencil is wielded, configure to place default:dirt node when used
|
||||||
|
-- /ctool setmode write
|
||||||
|
-- /ctool setnode default:dirt
|
||||||
|
core.register_chatcommand(cmd_repo.tool.cmd, {
|
||||||
privs = {server=true},
|
privs = {server=true},
|
||||||
description = S("Manage settings for wielded cleaner tool.") .. "\n\n"
|
description = S("Manage settings for wielded cleaner tool.") .. "\n\n"
|
||||||
.. S("Params:") .. "\n action: Action to execute. Can be one of \"status\", \"setmode\", or \"setnode\"."
|
.. format_params(cmd_repo.tool.cmd),
|
||||||
.. "\n value: Mode or node to be set for tool.",
|
params = cmd_repo.tool.help.param_string,
|
||||||
params = "<action> <value>",
|
|
||||||
func = function(name, param)
|
func = function(name, param)
|
||||||
local action, value = param
|
local action, value = param
|
||||||
local idx = param:find(" ")
|
local idx = param:find(" ")
|
||||||
@ -483,23 +625,25 @@ core.register_chatcommand("cleaner", {
|
|||||||
value = param[2]
|
value = param[2]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local help = format_help(cmd_repo.tool.cmd)
|
||||||
|
|
||||||
local player = core.get_player_by_name(name)
|
local player = core.get_player_by_name(name)
|
||||||
local stack = player:get_wielded_item()
|
local stack = player:get_wielded_item()
|
||||||
local iname = aux.tool:format_name(stack)
|
local iname = aux.tool:format_name(stack)
|
||||||
local imeta = stack:get_meta()
|
local imeta = stack:get_meta()
|
||||||
|
|
||||||
if iname ~= "cleaner:pencil" then
|
if iname ~= "cleaner:pencil" then
|
||||||
return false, S("Unrecognized wielded item: @1", iname)
|
return false, S("Unrecognized wielded item: @1", iname) .. "\n\n" .. help
|
||||||
end
|
end
|
||||||
|
|
||||||
if action == "status" then
|
if action == "status" then
|
||||||
core.chat_send_player(name, iname .. ": "
|
core.chat_send_player(name, iname .. ": " .. S("mode") .. "=" .. imeta:get_string("mode")
|
||||||
.. S("mode=@1, node=@2", imeta:get_string("mode"), imeta:get_string("node")))
|
.. ", " .. S("node") .. "=" .. imeta:get_string("node"))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
if not action or not value then
|
if not action or not value then
|
||||||
return false, S("Missing parameter.")
|
return false, S("Missing parameter.") .. "\n\n" .. help
|
||||||
end
|
end
|
||||||
|
|
||||||
if action == "setmode" then
|
if action == "setmode" then
|
||||||
@ -507,7 +651,7 @@ core.register_chatcommand("cleaner", {
|
|||||||
elseif action == "setnode" then
|
elseif action == "setnode" then
|
||||||
stack = aux.tool:set_node(stack, value, name)
|
stack = aux.tool:set_node(stack, value, name)
|
||||||
else
|
else
|
||||||
return false, S("Unrecognized action: @1", action)
|
return false, S("Unrecognized action: @1", action) .. "\n\n" .. help
|
||||||
end
|
end
|
||||||
|
|
||||||
return player:set_wielded_item(stack)
|
return player:set_wielded_item(stack)
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
# chat commands
|
# chat commands
|
||||||
entity=entidad
|
entity=entidad
|
||||||
|
mode=modo
|
||||||
node=nodo
|
node=nodo
|
||||||
radius=radio
|
radius=radio
|
||||||
old_item=objeto_antiguo
|
old_item=objeto_antiguo
|
||||||
@ -12,6 +13,8 @@ new_item=objeto_nuevo
|
|||||||
old_node=nodo_antiguo
|
old_node=nodo_antiguo
|
||||||
new_node=nodo_nuevo
|
new_node=nodo_nuevo
|
||||||
ore=mineral
|
ore=mineral
|
||||||
|
action=acción
|
||||||
|
value=valor
|
||||||
Usage:=Uso:
|
Usage:=Uso:
|
||||||
Params:=Parámetros:
|
Params:=Parámetros:
|
||||||
default: @1=por defecto: @1
|
default: @1=por defecto: @1
|
||||||
@ -23,11 +26,14 @@ Technical name of node to be used in place.=Nombre técnico del nodo de reemplaz
|
|||||||
Technical name of item to be replaced.=Nombre técnico del objeto reemplazado.
|
Technical name of item to be replaced.=Nombre técnico del objeto reemplazado.
|
||||||
Technical name of item to be used in place.=Nombre técnico del objeto de reemplazo.
|
Technical name of item to be used in place.=Nombre técnico del objeto de reemplazo.
|
||||||
Ore technical name.=Nombre técnico de mineral.
|
Ore technical name.=Nombre técnico de mineral.
|
||||||
|
Action to execute. Can be one of "@1", "@2", or "@3".=La acción para ejecutar. Puede ser "@1", "@2", o "@3".
|
||||||
|
Mode or node to be set for tool (not required for "@1" action).=Modo o nodo para configurar a la herramienta (no se requiere para la acción de "@1").
|
||||||
Remove an entity from game.=Eliminar una entidad del juego.
|
Remove an entity from game.=Eliminar una entidad del juego.
|
||||||
Remove a node from game.=Eliminar un nodo del juego.
|
Remove a node from game.=Eliminar un nodo del juego.
|
||||||
Replace an item in game.=Sustituir un objecto del juego.
|
Replace an item in game.=Sustituir un objecto del juego.
|
||||||
Replace a node in game.=Sustituir un nodo del juego.
|
Replace a node in game.=Sustituir un nodo del juego.
|
||||||
Find names of unknown nodes.=Encontrar los nombres de nodos desconocidos.
|
Find names of unknown nodes.=Descubrir los nombres de nodos desconocidos.
|
||||||
|
Find names of nearby nodes.=Descubrir los nombres de nodos cercanos.
|
||||||
Remove an ore from game.=Eliminar un mineral del juego.
|
Remove an ore from game.=Eliminar un mineral del juego.
|
||||||
Missing parameter.=Parámetro extraviado.
|
Missing parameter.=Parámetro extraviado.
|
||||||
Too many parameters.=Demasiados parámetros.
|
Too many parameters.=Demasiados parámetros.
|
||||||
@ -39,6 +45,22 @@ Removed @1 nodes.=Se eliminaron @1 nodos.
|
|||||||
Removed @1 entities.=Se eliminaron @1 entidades.
|
Removed @1 entities.=Se eliminaron @1 entidades.
|
||||||
Found unknown nodes: @1=Se encontraron @1 nodos desconocidos.
|
Found unknown nodes: @1=Se encontraron @1 nodos desconocidos.
|
||||||
No unknown nodes found.=No se encontraron nodos desconocidos.
|
No unknown nodes found.=No se encontraron nodos desconocidos.
|
||||||
|
Nearby nodes: @1=Nodos cercanos: @1
|
||||||
|
No nearby nodes found.=No se encontraron nodos cercanos.
|
||||||
Ore "@1" not found, not unregistering.=No se encontró el mineral "@1", se mantiene registrado.
|
Ore "@1" not found, not unregistering.=No se encontró el mineral "@1", se mantiene registrado.
|
||||||
Unregistered @1 ores (this will be undone after server restart).=Se anuló @1 minerales del registro.
|
Unregistered @1 ores (this will be undone after server restart).=Se anuló @1 minerales del registro.
|
||||||
Success!=¡Éxito!
|
Success!=¡Éxito!
|
||||||
|
Manage settings for wielded cleaner tool.=Administrar a los ajustes de la herramienta cleaner empuñada.
|
||||||
|
Unrecognized wielded item: @1=Objeto empuñado desconocido: @1
|
||||||
|
Unrecognized action: @1=Acción desconocido: @1
|
||||||
|
You do not have permission to set radius that high. Reduced to @1.=No tienes permiso para poner al radio tan alto. Se reduce a @1.
|
||||||
|
Radius is too high. Reduced to @1.=El radio es demasiado alto. Se reduce a @1.
|
||||||
|
|
||||||
|
# tools:
|
||||||
|
@1: mode set to: @2=@1: modo configurado para: @2
|
||||||
|
@1: node set to: @2=@1: nodo configurado para: @2
|
||||||
|
Modes for tool "@1" not available.=Modos para herramienta "@1" no disponibles.
|
||||||
|
You do not have permission to use this item. Missing privs: @1=No tienes permiso para usar este objeto. Privs que faltan: @1
|
||||||
|
Unknown mode: @1=Modo desconocido: @1
|
||||||
|
Can't place node there.=No se puede poner nodo allí.
|
||||||
|
Cannot place unknown node: @1=No se puede poner nodo desconocido: @1
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
|
|
||||||
# chat commands
|
# chat commands
|
||||||
entity=
|
entity=
|
||||||
|
mode=
|
||||||
node=
|
node=
|
||||||
radius=
|
radius=
|
||||||
old_item=
|
old_item=
|
||||||
@ -12,6 +13,8 @@ new_item=
|
|||||||
old_node=
|
old_node=
|
||||||
new_node=
|
new_node=
|
||||||
ore=
|
ore=
|
||||||
|
action=
|
||||||
|
value=
|
||||||
Usage:=
|
Usage:=
|
||||||
Params:=
|
Params:=
|
||||||
default: @1=
|
default: @1=
|
||||||
@ -23,11 +26,14 @@ Technical name of node to be used in place.=
|
|||||||
Technical name of item to be replaced.=
|
Technical name of item to be replaced.=
|
||||||
Technical name of item to be used in place.=
|
Technical name of item to be used in place.=
|
||||||
Ore technical name.=
|
Ore technical name.=
|
||||||
|
Action to execute. Can be one of "@1", "@2", or "@3".=
|
||||||
|
Mode or node to be set for tool (not required for "@1" action).=
|
||||||
Remove an entity from game.=
|
Remove an entity from game.=
|
||||||
Remove a node from game.=
|
Remove a node from game.=
|
||||||
Replace an item in game.=
|
Replace an item in game.=
|
||||||
Replace a node in game.=
|
Replace a node in game.=
|
||||||
Find names of unknown nodes.=
|
Find names of unknown nodes.=
|
||||||
|
Find names of nearby nodes.=
|
||||||
Remove an ore from game.=
|
Remove an ore from game.=
|
||||||
Missing parameter.=
|
Missing parameter.=
|
||||||
Too many parameters.=
|
Too many parameters.=
|
||||||
@ -39,6 +45,22 @@ Removed @1 nodes.=
|
|||||||
Removed @1 entities.=
|
Removed @1 entities.=
|
||||||
Found unknown nodes: @1=
|
Found unknown nodes: @1=
|
||||||
No unknown nodes found.=
|
No unknown nodes found.=
|
||||||
|
Nearby nodes: @1=
|
||||||
|
No nearby nodes found.=
|
||||||
Ore "@1" not found, not unregistering.=
|
Ore "@1" not found, not unregistering.=
|
||||||
Unregistered @1 ores (this will be undone after server restart).=
|
Unregistered @1 ores (this will be undone after server restart).=
|
||||||
Success!=
|
Success!=
|
||||||
|
Manage settings for wielded cleaner tool.=
|
||||||
|
Unrecognized wielded item: @1=
|
||||||
|
Unrecognized action: @1=
|
||||||
|
You do not have permission to set radius that high. Reduced to @1.=
|
||||||
|
Radius is too high. Reduced to @1.=
|
||||||
|
|
||||||
|
# tools:
|
||||||
|
@1: mode set to: @2=
|
||||||
|
Modes for tool "@1" not available.=
|
||||||
|
@1: node set to: @2=
|
||||||
|
You do not have permission to use this item. Missing privs: @1=
|
||||||
|
Can't place node there.=
|
||||||
|
Unknown mode: @1=
|
||||||
|
Cannot place unknown node: @1=
|
||||||
|
@ -98,8 +98,7 @@ local tool = {
|
|||||||
imeta:set_string("mode", mode)
|
imeta:set_string("mode", mode)
|
||||||
|
|
||||||
if pname then
|
if pname then
|
||||||
core.chat_send_player(pname, iname .. ": "
|
core.chat_send_player(pname, S("@1: mode set to: @2", iname, imeta:get_string("mode")))
|
||||||
.. S("mode set to: @1", imeta:get_string("mode")))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local new_stack
|
local new_stack
|
||||||
@ -120,7 +119,7 @@ local tool = {
|
|||||||
local modes = self.modes[iname]
|
local modes = self.modes[iname]
|
||||||
|
|
||||||
if not modes then
|
if not modes then
|
||||||
return false, stack, "modes for tool \"" .. stack:get_name() .. "\" not available."
|
return false, stack, S('Modes for tool "@1" not available.', stack:get_name())
|
||||||
end
|
end
|
||||||
|
|
||||||
local imeta = stack:get_meta()
|
local imeta = stack:get_meta()
|
||||||
@ -145,20 +144,21 @@ local tool = {
|
|||||||
imeta:set_string("node", node)
|
imeta:set_string("node", node)
|
||||||
|
|
||||||
if pname then
|
if pname then
|
||||||
core.chat_send_player(pname, stack:get_name() .. ": "
|
core.chat_send_player(pname, S("@1: node set to: @2", stack:get_name(), imeta:get_string("node")))
|
||||||
.. S("node set to: @1", imeta:get_string("node")))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return stack
|
return stack
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local sound_handle
|
||||||
|
|
||||||
tool.on_use = function(stack, user, pointed_thing)
|
tool.on_use = function(stack, user, pointed_thing)
|
||||||
if not user:is_player() then return end
|
if not user:is_player() then return end
|
||||||
|
|
||||||
local pname = user:get_player_name()
|
local pname = user:get_player_name()
|
||||||
if not core.get_player_privs(pname).server then
|
if not core.get_player_privs(pname).server then
|
||||||
core.chat_send_player(pname, S("You do not have permission to use this item. Missing privs: server"))
|
core.chat_send_player(pname, S("You do not have permission to use this item. Missing privs: @1", "server"))
|
||||||
return stack
|
return stack
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -184,7 +184,7 @@ tool.on_use = function(stack, user, pointed_thing)
|
|||||||
elseif mode == "write" then
|
elseif mode == "write" then
|
||||||
local node_above = core.get_node_or_nil(pointed_thing.above)
|
local node_above = core.get_node_or_nil(pointed_thing.above)
|
||||||
if not node_above or node_above.name == "air" then
|
if not node_above or node_above.name == "air" then
|
||||||
core.place_node(pointed_thing.above, {name=new_node_name})
|
core.set_node(pointed_thing.above, {name=new_node_name})
|
||||||
sound_handle = core.sound_play("cleaner_pencil_write", {object=user})
|
sound_handle = core.sound_play("cleaner_pencil_write", {object=user})
|
||||||
else
|
else
|
||||||
core.chat_send_player(pname, S("Can't place node there."))
|
core.chat_send_player(pname, S("Can't place node there."))
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
name = cleaner
|
name = cleaner
|
||||||
description = A mod that can be used to remove/replace unknown entities, nodes, & items.
|
description = A mod that can be used to remove/replace unknown entities, nodes, & items.
|
||||||
version = 1.1
|
version = 1.2
|
||||||
license = MIT
|
license = MIT
|
||||||
author = PilzAdam, Jordan Irwin (AntumDeluge)
|
author = PilzAdam, Jordan Irwin (AntumDeluge)
|
||||||
min_minetest_version = 5.0
|
min_minetest_version = 5.0
|
||||||
|
BIN
mods/admin/cleaner/screenshot.png
Normal file
BIN
mods/admin/cleaner/screenshot.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 183 KiB |
@ -4,9 +4,10 @@
|
|||||||
-- @topic settings
|
-- @topic settings
|
||||||
|
|
||||||
|
|
||||||
--- Enables unsafe methods.
|
--- Enables unsafe methods & chat commands.
|
||||||
--
|
--
|
||||||
-- `cleaner.remove_ore`
|
-- - `cleaner.remove_ore`
|
||||||
|
-- - `/remove_ores`
|
||||||
--
|
--
|
||||||
-- @setting cleaner.unsafe
|
-- @setting cleaner.unsafe
|
||||||
-- @settype bool
|
-- @settype bool
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
# Enables unsafe methods.
|
# Enables unsafe methods & chat commands.
|
||||||
#
|
#
|
||||||
# - cleaner.remove_ore
|
# - cleaner.remove_ore
|
||||||
|
# - /remove_ores
|
||||||
cleaner.unsafe (Enable unsafe methods) bool false
|
cleaner.unsafe (Enable unsafe methods) bool false
|
||||||
|
@ -9,13 +9,11 @@ local S = core.get_translator(cleaner.modname)
|
|||||||
|
|
||||||
local aux = dofile(cleaner.modpath .. "/misc_functions.lua")
|
local aux = dofile(cleaner.modpath .. "/misc_functions.lua")
|
||||||
|
|
||||||
local sound_handle
|
|
||||||
|
|
||||||
--- Master Pencil
|
--- Master Pencil
|
||||||
--
|
--
|
||||||
-- @tool cleaner:pencil
|
-- @tool cleaner:pencil
|
||||||
-- @img cleaner_pencil.png
|
-- @img cleaner_pencil.png
|
||||||
-- @privs server
|
-- @priv server
|
||||||
-- @usage
|
-- @usage
|
||||||
-- place (right-click):
|
-- place (right-click):
|
||||||
-- - when not pointing at a node, changes modes
|
-- - when not pointing at a node, changes modes
|
||||||
|
@ -1644,9 +1644,10 @@ chatlog.disable (Disable chatlog) bool false
|
|||||||
|
|
||||||
[*cleaner]
|
[*cleaner]
|
||||||
|
|
||||||
# Enables unsafe methods.
|
# Enables unsafe methods & chat commands.
|
||||||
#
|
#
|
||||||
# - cleaner.remove_ore
|
# - cleaner.remove_ore
|
||||||
|
# - /remove_ores
|
||||||
cleaner.unsafe (Enable unsafe methods) bool false
|
cleaner.unsafe (Enable unsafe methods) bool false
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user