aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/client/chatcommands.lua31
-rw-r--r--builtin/client/death_formspec.lua16
-rw-r--r--builtin/client/init.lua5
-rw-r--r--builtin/client/register.lua20
-rw-r--r--builtin/client/util.lua23
-rw-r--r--builtin/common/misc_helpers.lua10
-rw-r--r--builtin/mainmenu/init.lua1
-rw-r--r--builtin/mainmenu/tab_credits.lua5
-rw-r--r--builtin/settingtypes.txt37
9 files changed, 101 insertions, 47 deletions
diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua
index 5cb1b40bb..83b7f7b14 100644
--- a/builtin/client/chatcommands.lua
+++ b/builtin/client/chatcommands.lua
@@ -1,6 +1,5 @@
-- Minetest: builtin/client/chatcommands.lua
-
core.register_on_sending_chat_message(function(message)
if message:sub(1,2) == ".." then
return false
@@ -37,34 +36,8 @@ core.register_on_sending_chat_message(function(message)
return true
end)
-core.register_chatcommand("list_players", {
- description = core.gettext("List online players"),
- func = function(param)
- local player_names = core.get_player_names()
- if not player_names then
- return false, core.gettext("This command is disabled by server.")
- end
-
- local players = table.concat(player_names, ", ")
- return true, core.gettext("Online players: ") .. players
- end
-})
-
-core.register_chatcommand("disconnect", {
- description = core.gettext("Exit to main menu"),
- func = function(param)
- core.disconnect()
- end,
-})
-
-core.register_chatcommand("clear_chat_queue", {
- description = core.gettext("Clear the out chat queue"),
- func = function(param)
- core.clear_out_chat_queue()
- return true, core.gettext("The out chat queue is now empty")
- end,
-})
-
function core.run_server_chatcommand(cmd, param)
core.send_chat_message("/" .. cmd .. " " .. param)
end
+
+
diff --git a/builtin/client/death_formspec.lua b/builtin/client/death_formspec.lua
deleted file mode 100644
index e755ac5c1..000000000
--- a/builtin/client/death_formspec.lua
+++ /dev/null
@@ -1,16 +0,0 @@
--- CSM death formspec. Only used when clientside modding is enabled, otherwise
--- handled by the engine.
-
-core.register_on_death(function()
- core.display_chat_message("You died.")
- local formspec = "size[11,5.5]bgcolor[#320000b4;true]" ..
- "label[4.85,1.35;" .. fgettext("You died") ..
- "]button_exit[4,3;3,0.5;btn_respawn;".. fgettext("Respawn") .."]"
- core.show_formspec("bultin:death", formspec)
-end)
-
-core.register_on_formspec_input(function(formname, fields)
- if formname == "bultin:death" then
- core.send_respawn()
- end
-end)
diff --git a/builtin/client/init.lua b/builtin/client/init.lua
index 9633a7c71..ee344e7bc 100644
--- a/builtin/client/init.lua
+++ b/builtin/client/init.lua
@@ -6,6 +6,7 @@ local commonpath = scriptpath.."common"..DIR_DELIM
dofile(clientpath .. "register.lua")
dofile(commonpath .. "after.lua")
dofile(commonpath .. "chatcommands.lua")
-dofile(clientpath .. "chatcommands.lua")
dofile(commonpath .. "vector.lua")
-dofile(clientpath .. "death_formspec.lua")
+dofile(clientpath .. "util.lua")
+dofile(clientpath .. "chatcommands.lua")
+
diff --git a/builtin/client/register.lua b/builtin/client/register.lua
index c1b4965c1..071220a43 100644
--- a/builtin/client/register.lua
+++ b/builtin/client/register.lua
@@ -40,6 +40,26 @@ function core.run_callbacks(callbacks, mode, ...)
return ret
end
+function core.override_item(name, redefinition)
+ if redefinition.name ~= nil then
+ error("Attempt to redefine name of "..name.." to "..dump(redefinition.name), 2)
+ end
+ if redefinition.type ~= nil then
+ error("Attempt to redefine type of "..name.." to "..dump(redefinition.type), 2)
+ end
+ local itemdef = core.get_item_def(name)
+ if not itemdef then
+ error("Attempt to override non-existent item "..name, 2)
+ end
+ local nodedef = core.get_node_def(name)
+ table.combine(itemdef, nodedef)
+
+ for k, v in pairs(redefinition) do
+ rawset(itemdef, k, v)
+ end
+ core.register_item_raw(itemdef)
+end
+
--
-- Callback registration
--
diff --git a/builtin/client/util.lua b/builtin/client/util.lua
new file mode 100644
index 000000000..595922262
--- /dev/null
+++ b/builtin/client/util.lua
@@ -0,0 +1,23 @@
+function core.parse_pos(param)
+ local p = {}
+ p.x, p.y, p.z = string.match(param, "^([~|%d.-]+)[, ] *([~|%d.-]+)[, ] *([~|%d.-]+)$")
+ for k, v in pairs(p) do
+ if p[k] == "~" then
+ p[k] = 0
+ else
+ p[k] = tonumber(v)
+ end
+ end
+ if p.x and p.y and p.z then
+ return true, p
+ end
+ return false, "Invalid position (" .. param .. ")"
+end
+
+function core.parse_relative_pos(param)
+ local success, pos = core.parse_pos(param)
+ if success then pos = vector.round(vector.add(core.localplayer:get_pos(), pos)) end
+ return success, pos
+end
+
+core.anticheat_protection = minetest.settings:get_bool("anticheat_protection")
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index e29a9f422..bd27a01dc 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -516,6 +516,16 @@ function table.shuffle(t, from, to, random)
end
end
+function table.combine(t, other)
+ other = other or {}
+ for k, v in pairs(other) do
+ if type(v) == "table" and type(t[k]) == "table" then
+ table.combine(t[k], v)
+ else
+ t[k] = v
+ end
+ end
+end
--------------------------------------------------------------------------------
-- mainmenu only functions
diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua
index c17e79270..ae9ae8853 100644
--- a/builtin/mainmenu/init.lua
+++ b/builtin/mainmenu/init.lua
@@ -156,3 +156,4 @@ local function init_globals()
end
init_globals()
+
diff --git a/builtin/mainmenu/tab_credits.lua b/builtin/mainmenu/tab_credits.lua
index c2b7e503a..14fcda0da 100644
--- a/builtin/mainmenu/tab_credits.lua
+++ b/builtin/mainmenu/tab_credits.lua
@@ -16,6 +16,9 @@
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------------
+local hackers = {
+ "Elias Fleckenstein <eliasfleckenstein@web.de>"
+}
local core_developers = {
"Perttu Ahola (celeron55) <celeron55@gmail.com>",
@@ -106,6 +109,8 @@ return {
"tablecolumns[color;text]" ..
"tableoptions[background=#00000000;highlight=#00000000;border=false]" ..
"table[3.5,-0.25;8.5,6.05;list_credits;" ..
+ "#FFFF00," .. fgettext("Hackers") .. ",," ..
+ buildCreditList(hackers) .. ",,," ..
"#FFFF00," .. fgettext("Core Developers") .. ",," ..
buildCreditList(core_developers) .. ",,," ..
"#FFFF00," .. fgettext("Active Contributors") .. ",," ..
diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt
index c0620542d..2a53a3315 100644
--- a/builtin/settingtypes.txt
+++ b/builtin/settingtypes.txt
@@ -2200,3 +2200,40 @@ contentdb_url (ContentDB URL) string https://content.minetest.net
# These flags are independent from Minetest versions,
# so see a full list at https://content.minetest.net/help/content_flags/
contentdb_flag_blacklist (ContentDB Flag Blacklist) string nonfree, desktop_default
+
+[Cheats]
+
+fullbright (Fullbright) bool false
+
+# Enable xray, requires fullbright
+xray (Xray) bool false
+
+# Texture to apply xray
+xray_node (XrayTexture) string default:stone
+
+# Make the Client think it has all privs
+priv_bypass (PrivBypass) bool true
+
+fastdig (FastDig) bool false
+
+prevent_natural_damage (NoFallDamage) bool true
+
+freecam (Freecam) bool false
+
+killaura (Killaura) bool false
+
+no_hurt_cam (NoHurtCam) bool false
+
+increase_tool_range (Range) bool true
+
+# HUD Flags Bypass
+hud_flags_bypass (HUDBypass) bool true
+
+antiknockback (AntiKnockback) bool false
+
+# Set to true if AntiCheat is enabled on server
+anticheat_protection (AnticheatProtection) bool true
+
+autorespawn (AutoRespawn) bool false
+
+show_cheat_hud (CheatHUD) bool true