aboutsummaryrefslogtreecommitdiff
path: root/builtin/client
diff options
context:
space:
mode:
authorElias Fleckenstein <eliasfleckenstein@web.de>2020-07-18 13:20:08 +0200
committerElias Fleckenstein <eliasfleckenstein@web.de>2020-07-18 13:20:08 +0200
commit45aa2516b2fc675df7049bc9ed713600c95b6423 (patch)
treecd7d1f377789e56cfe624d8db542f32c7dd0bca4 /builtin/client
parentf22339ed891afddca53f7442c63aedd7aecc566d (diff)
downloaddragonfireclient-45aa2516b2fc675df7049bc9ed713600c95b6423.tar.xz
Added settings
Diffstat (limited to 'builtin/client')
-rw-r--r--builtin/client/chatcommands.lua31
-rw-r--r--builtin/client/death_formspec.lua33
-rw-r--r--builtin/client/init.lua3
-rw-r--r--builtin/client/util.lua (renamed from builtin/client/pos.lua)14
4 files changed, 12 insertions, 69 deletions
diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua
index f514f754b..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("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 0a4a98ea3..000000000
--- a/builtin/client/death_formspec.lua
+++ /dev/null
@@ -1,33 +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[2,3;3,0.5;btn_respawn;".. fgettext("Respawn") ..
- "]button_exit[6,3;3,0.5;btn_ghost_mode;".. fgettext("Ghost Mode") .."]"
- core.show_formspec("bultin:death", formspec)
-end)
-
-core.register_on_formspec_input(function(formname, fields)
- if formname == "bultin:death" then
- if fields.btn_ghost_mode then
- core.display_chat_message("You are in ghost mode. Use .respawn to Respawn")
- else
- core.send_respawn()
- end
- end
-end)
-
-core.register_chatcommand("respawn", {
- description = core.gettext("Respawn when in ghost mode"),
- func = function()
- if core.localplayer:get_hp() == 0 then
- core.send_respawn()
- core.display_chat_message("Respawned.")
- else
- core.display_chat_message("You are not in ghost mode.")
- end
- end
-})
diff --git a/builtin/client/init.lua b/builtin/client/init.lua
index f3c1a4c82..ee344e7bc 100644
--- a/builtin/client/init.lua
+++ b/builtin/client/init.lua
@@ -7,7 +7,6 @@ dofile(clientpath .. "register.lua")
dofile(commonpath .. "after.lua")
dofile(commonpath .. "chatcommands.lua")
dofile(commonpath .. "vector.lua")
-dofile(clientpath .. "death_formspec.lua")
+dofile(clientpath .. "util.lua")
dofile(clientpath .. "chatcommands.lua")
-dofile(clientpath .. "pos.lua")
diff --git a/builtin/client/pos.lua b/builtin/client/util.lua
index 618c142e7..595922262 100644
--- a/builtin/client/pos.lua
+++ b/builtin/client/util.lua
@@ -3,17 +3,21 @@ function core.parse_pos(param)
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] = core.localplayer:get_pos()[k]
+ p[k] = 0
else
p[k] = tonumber(v)
end
end
if p.x and p.y and p.z then
- local lm = 31000
- if p.x < -lm or p.x > lm or p.y < -lm or p.y > lm or p.z < -lm or p.z > lm then
- return false, "Position out of Map bounds."
- end
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")