Merge pull request 'Commands Refactoring part2' (#1257) from AFCMS/MineClone2:commands-refactoring-2 into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/1257
This commit is contained in:
Elias Fleckenstein 2021-03-05 16:08:52 +00:00
commit 95111e1d8d
2 changed files with 12 additions and 6 deletions

View file

@ -1,21 +1,24 @@
local S = minetest.get_translator("mcl_commands") local S = minetest.get_translator("mcl_commands")
local minecraftaliases = true
local function register_chatcommand_alias(alias, cmd) local function register_chatcommand_alias(alias, cmd)
local def = minetest.chatcommands[cmd] local def = minetest.chatcommands[cmd]
minetest.register_chatcommand(alias, def) minetest.register_chatcommand(alias, def)
end end
if minecraftaliases then local function rename_chatcommand(newname, cmd)
local def = minetest.chatcommands[cmd]
minetest.register_chatcommand(newname, def)
minetest.unregister_chatcommand(cmd)
end
if minetest.settings:get_bool("mcl_builtin_commands_overide", true) then
register_chatcommand_alias("?", "help") register_chatcommand_alias("?", "help")
register_chatcommand_alias("who", "list")
register_chatcommand_alias("pardon", "unban") register_chatcommand_alias("pardon", "unban")
register_chatcommand_alias("stop", "shutdown") rename_chatcommand("stop", "shutdown")
register_chatcommand_alias("tell", "msg") register_chatcommand_alias("tell", "msg")
register_chatcommand_alias("w", "msg") register_chatcommand_alias("w", "msg")
register_chatcommand_alias("tp", "teleport") register_chatcommand_alias("tp", "teleport")
register_chatcommand_alias("clear", "clearinv") rename_chatcommand("clear", "clearinv")
minetest.register_chatcommand("banlist", { minetest.register_chatcommand("banlist", {
description = S("List bans"), description = S("List bans"),

View file

@ -136,6 +136,9 @@ mcl_generate_ores (Generate Ores) bool true
# game by a lot. # game by a lot.
mcl_node_particles (Block particles detail level) enum none high,medium,low,none mcl_node_particles (Block particles detail level) enum none high,medium,low,none
# Enable hard overiding of builtin commands.
mcl_builtin_commands_overide (Enable hard overiding of builtin commands.) bool true
# If enabled, this will substitute a few blocks in village schematics so they blend into normal, snowy, and sandy areas. Defaults to true. # If enabled, this will substitute a few blocks in village schematics so they blend into normal, snowy, and sandy areas. Defaults to true.
basic_pseudobiome_villages (Enables very basic, and experimental "pseudobiome-based" villages) bool true basic_pseudobiome_villages (Enables very basic, and experimental "pseudobiome-based" villages) bool true