aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/client/chatcommands.lua151
-rw-r--r--builtin/client/cheats/chat.lua43
-rw-r--r--builtin/client/cheats/combat.lua77
-rw-r--r--builtin/client/cheats/init.lua98
-rw-r--r--builtin/client/cheats/inventory.lua147
-rw-r--r--builtin/client/cheats/movement.lua41
-rw-r--r--builtin/client/cheats/player.lua39
-rw-r--r--builtin/client/cheats/render.lua2
-rw-r--r--builtin/client/cheats/world.lua74
-rw-r--r--builtin/client/death_formspec.lua16
-rw-r--r--builtin/client/init.lua6
-rw-r--r--builtin/client/register.lua22
-rw-r--r--builtin/client/util.lua52
-rw-r--r--builtin/common/chatcommands.lua45
-rw-r--r--builtin/common/misc_helpers.lua84
-rw-r--r--builtin/game/item.lua13
-rw-r--r--builtin/init.lua1
-rw-r--r--builtin/mainmenu/dlg_settings_advanced.lua30
-rw-r--r--builtin/mainmenu/init.lua1
-rw-r--r--builtin/mainmenu/tab_credits.lua11
-rw-r--r--builtin/settingtypes.txt173
21 files changed, 1078 insertions, 48 deletions
diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua
index 0e8d4dd03..a45a76dfe 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
@@ -42,34 +41,154 @@ core.register_on_sending_chat_message(function(message)
return true
end)
-core.register_chatcommand("list_players", {
- description = core.gettext("List online players"),
+function core.run_server_chatcommand(cmd, param)
+ core.send_chat_message("/" .. cmd .. " " .. param)
+end
+
+core.register_chatcommand("say", {
+ description = "Send raw text",
+ func = function(text)
+ core.send_chat_message(text)
+ return true
+ end,
+})
+
+core.register_chatcommand("teleport", {
+ params = "<X>,<Y>,<Z>",
+ description = "Teleport to coordinates.",
+ func = function(param)
+ local success, pos = core.parse_pos(param)
+ if success then
+ core.localplayer:set_pos(pos)
+ return true, "Teleporting to " .. core.pos_to_string(pos)
+ end
+ return false, pos
+ end,
+})
+
+core.register_chatcommand("teleportjump", {
+ params = "<X>,<Y>,<Z>",
+ description = "Teleport to relative coordinates.",
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.")
+ local success, pos = core.parse_relative_pos(param)
+ if success then
+ core.localplayer:set_pos(pos)
+ return true, "Teleporting to " .. core.pos_to_string(pos)
end
+ return false, pos
+ end,
+})
- local players = table.concat(player_names, ", ")
- return true, core.gettext("Online players: ") .. players
+core.register_chatcommand("wielded", {
+ description = "Print itemstring of wieleded item",
+ func = function()
+ return true, core.localplayer:get_wielded_item():get_name()
end
})
core.register_chatcommand("disconnect", {
- description = core.gettext("Exit to main menu"),
+ description = "Exit to main menu",
func = function(param)
core.disconnect()
end,
})
-core.register_chatcommand("clear_chat_queue", {
- description = core.gettext("Clear the out chat queue"),
+core.register_chatcommand("players", {
+ description = "List online players",
func = function(param)
- core.clear_out_chat_queue()
- return true, core.gettext("The out chat queue is now empty")
+ return true, "Online players: " .. table.concat(core.get_player_names(), ", ")
+ end
+})
+
+core.register_chatcommand("kill", {
+ description = "Kill yourself",
+ func = function()
+ core.send_damage(10000)
end,
})
-function core.run_server_chatcommand(cmd, param)
- core.send_chat_message("/" .. cmd .. " " .. param)
-end
+core.register_chatcommand("set", {
+ params = "([-n] <name> <value>) | <name>",
+ description = "Set or read client configuration setting",
+ func = function(param)
+ local arg, setname, setvalue = string.match(param, "(-[n]) ([^ ]+) (.+)")
+ if arg and arg == "-n" and setname and setvalue then
+ core.settings:set(setname, setvalue)
+ return true, setname .. " = " .. setvalue
+ end
+
+ setname, setvalue = string.match(param, "([^ ]+) (.+)")
+ if setname and setvalue then
+ if not core.settings:get(setname) then
+ return false, "Failed. Use '.set -n <name> <value>' to create a new setting."
+ end
+ core.settings:set(setname, setvalue)
+ return true, setname .. " = " .. setvalue
+ end
+
+ setname = string.match(param, "([^ ]+)")
+ if setname then
+ setvalue = core.settings:get(setname)
+ if not setvalue then
+ setvalue = "<not set>"
+ end
+ return true, setname .. " = " .. setvalue
+ end
+
+ return false, "Invalid parameters (see .help set)."
+ end,
+})
+
+core.register_chatcommand("place", {
+ params = "<X>,<Y>,<Z>",
+ description = "Place wielded item",
+ func = function(param)
+ local success, pos = core.parse_relative_pos(param)
+ if success then
+ core.place_node(pos)
+ return true, "Node placed at " .. core.pos_to_string(pos)
+ end
+ return false, pos
+ end,
+})
+
+core.register_chatcommand("dig", {
+ params = "<X>,<Y>,<Z>",
+ description = "Dig node",
+ func = function(param)
+ local success, pos = core.parse_relative_pos(param)
+ if success then
+ core.dig_node(pos)
+ return true, "Node at " .. core.pos_to_string(pos) .. " dug"
+ end
+ return false, pos
+ end,
+})
+
+core.register_chatcommand("setyaw", {
+ params = "<yaw>",
+ description = "Set your yaw",
+ func = function(param)
+ local yaw = tonumber(param)
+ if yaw then
+ core.localplayer:set_yaw(yaw)
+ return true
+ else
+ return false, "Invalid usage (See /help setyaw)"
+ end
+ end
+})
+
+core.register_chatcommand("setpitch", {
+ params = "<pitch>",
+ description = "Set your pitch",
+ func = function(param)
+ local pitch = tonumber(param)
+ if pitch then
+ core.localplayer:set_pitch(pitch)
+ return true
+ else
+ return false, "Invalid usage (See /help setpitch)"
+ end
+ end
+})
diff --git a/builtin/client/cheats/chat.lua b/builtin/client/cheats/chat.lua
new file mode 100644
index 000000000..0763909df
--- /dev/null
+++ b/builtin/client/cheats/chat.lua
@@ -0,0 +1,43 @@
+core.register_on_receiving_chat_message(function(message)
+ if message:sub(1, 1) == "#" and core.settings:get_bool("ignore_status_messages") ~= false then
+ return true
+ elseif message:find('\1b@mcl_death_messages\1b') and core.settings:get_bool("mark_deathmessages") ~= false then
+ core.display_chat_message(core.colorize("#F25819", "[Deathmessage] ") .. message)
+ return true
+ end
+end)
+
+function core.send_colorized(message)
+ local starts_with = message:sub(1, 1)
+
+ if starts_with == "/" or starts_with == "." then return end
+
+ local reverse = core.settings:get_bool("chat_reverse")
+
+ if reverse then
+ local msg = ""
+ for i = 1, #message do
+ msg = message:sub(i, i) .. msg
+ end
+ message = msg
+ end
+
+ local use_chat_color = core.settings:get_bool("use_chat_color")
+ local color = core.settings:get("chat_color")
+
+ if use_chat_color and color then
+ local msg
+ if color == "rainbow" then
+ msg = core.rainbow(message)
+ else
+ msg = core.colorize(color, message)
+ end
+ message = msg
+ end
+
+ core.send_chat_message(message)
+ return true
+end
+
+core.register_on_sending_chat_message(core.send_colorized)
+
diff --git a/builtin/client/cheats/combat.lua b/builtin/client/cheats/combat.lua
new file mode 100644
index 000000000..4904d8c52
--- /dev/null
+++ b/builtin/client/cheats/combat.lua
@@ -0,0 +1,77 @@
+local placed_crystal
+local switched_to_totem = 0
+local used_sneak = true
+local totem_move_action = InventoryAction("move")
+totem_move_action:to("current_player", "main", 9)
+
+core.register_list_command("friend", "Configure Friend List (friends dont get attacked by Killaura or Forcefield)", "friendlist")
+
+core.register_globalstep(function(dtime)
+ local player = core.localplayer
+ if not player then return end
+ local control = player:get_control()
+ local pointed = core.get_pointed_thing()
+ local item = player:get_wielded_item():get_name()
+ if core.settings:get_bool("killaura") or core.settings:get_bool("forcefield") and control.LMB then
+ local friendlist = core.settings:get("friendlist"):split(",")
+ for _, obj in ipairs(core.get_objects_inside_radius(player:get_pos(), 5)) do
+ local do_attack = true
+ if obj:is_local_player() then
+ do_attack = false
+ else
+ for _, friend in ipairs(friendlist) do
+ if obj:get_name() == friend or obj:get_nametag() == friend then
+ do_attack = false
+ break
+ end
+ end
+ end
+ if do_attack then
+ obj:punch()
+ end
+ end
+ elseif core.settings:get_bool("crystal_pvp") then
+ if placed_crystal then
+ if core.switch_to_item("mobs_mc:totem") then
+ switched_to_totem = 5
+ end
+ placed_crystal = false
+ elseif switched_to_totem > 0 then
+ if item ~= "mobs_mc:totem" then
+ switched_to_totem = 0
+ elseif pointed and pointed.type == "object" then
+ pointed.ref:punch()
+ switched_to_totem = 0
+ else
+ switched_to_totem = switched_to_totem
+ end
+ elseif control.RMB and item == "mcl_end:crystal" then
+ placed_crystal = true
+ elseif control.sneak then
+ if pointed and pointed.type == "node" and not used_sneak then
+ local pos = core.get_pointed_thing_position(pointed)
+ local node = core.get_node_or_nil(pos)
+ if node and (node.name == "mcl_core:obsidian" or node.name == "mcl_core:bedrock") then
+ core.switch_to_item("mcl_end:crystal")
+ core.place_node(pos)
+ placed_crystal = true
+ end
+ end
+ used_sneak = true
+ else
+ used_sneak = false
+ end
+ end
+
+ if core.settings:get_bool("autototem") then
+ local totem_stack = core.get_inventory("current_player").main[9]
+ if totem_stack and totem_stack:get_name() ~= "mobs_mc:totem" then
+ local totem_index = core.find_item("mobs_mc:totem")
+ if totem_index then
+ totem_move_action:from("current_player", "main", totem_index)
+ totem_move_action:apply()
+ player:set_wield_index(9)
+ end
+ end
+ end
+end)
diff --git a/builtin/client/cheats/init.lua b/builtin/client/cheats/init.lua
new file mode 100644
index 000000000..4f4d33d86
--- /dev/null
+++ b/builtin/client/cheats/init.lua
@@ -0,0 +1,98 @@
+core.cheats = {
+ ["Combat"] = {
+ ["Killaura"] = "killaura",
+ ["Forcefield"] = "forcefield",
+ ["AntiKnockback"] = "antiknockback",
+ ["FastHit"] = "spamclick",
+ ["AttachmentFloat"] = "float_above_parent",
+ ["CrystalPvP"] = "crystal_pvp",
+ ["AutoTotem"] = "autototem",
+ ["ThroughWalls"] = "dont_point_nodes",
+ ["OnlyTracePlayers"] = "only_trace_players",
+ ["AutoHit"] = "autohit",
+ },
+ ["Movement"] = {
+ ["Freecam"] = "freecam",
+ ["AutoForward"] = "continuous_forward",
+ ["PitchMove"] = "pitch_move",
+ ["AutoJump"] = "autojump",
+ ["Jesus"] = "jesus",
+ ["NoSlow"] = "no_slow",
+ ["AutoSneak"] = "autosneak",
+ ["AutoSprint"] = "autosprint",
+ ["SpeedOverride"] = "override_speed",
+ ["JumpOverride"] = "override_jump",
+ ["GravityOverride"] = "override_gravity",
+ ["JetPack"] = "jetpack",
+ ["AntiSlip"] = "antislip",
+ },
+ ["Render"] = {
+ ["Xray"] = "xray",
+ ["Fullbright"] = "fullbright",
+ ["HUDBypass"] = "hud_flags_bypass",
+ ["NoHurtCam"] = "no_hurt_cam",
+ ["BrightNight"] = "no_night",
+ ["Coords"] = "coords",
+ ["Tracers"] = "enable_tracers",
+ ["ESP"] = "enable_esp",
+ ["NodeTracers"] = "enable_node_tracers",
+ ["NodeESP"] = "enable_node_esp",
+ ["CheatHUD"] = "cheat_hud",
+ },
+ ["World"] = {
+ ["FastDig"] = "fastdig",
+ ["FastPlace"] = "fastplace",
+ ["AutoDig"] = "autodig",
+ ["AutoPlace"] = "autoplace",
+ ["InstantBreak"] = "instant_break",
+ ["Scaffold"] = "scaffold",
+ ["ScaffoldPlus"] = "scaffold_plus",
+ ["BlockWater"] = "block_water",
+ ["PlaceOnTop"] = "autotnt",
+ ["Replace"] = "replace",
+ ["Nuke"] = "nuke",
+ },
+ ["Exploit"] = {
+ ["EntitySpeed"] = "entity_speed",
+ ["ParticleExploit"] = "log_particles",
+ },
+ ["Player"] = {
+ ["NoFallDamage"] = "prevent_natural_damage",
+ ["NoForceRotate"] = "no_force_rotate",
+ ["IncreasedRange"] = "increase_tool_range",
+ ["UnlimitedRange"] = "increase_tool_range_plus",
+ ["PointLiquids"] = "point_liquids",
+ ["PrivBypass"] = "priv_bypass",
+ ["AutoRespawn"] = "autorespawn",
+ },
+ ["Chat"] = {
+ ["IgnoreStatus"] = "ignore_status_messages",
+ ["Deathmessages"] = "mark_deathmessages",
+ ["ColoredChat"] = "use_chat_color",
+ ["ReversedChat"] = "chat_reverse",
+ },
+ ["Inventory"] = {
+ ["AutoEject"] = "autoeject",
+ ["AutoTool"] = "autotool",
+ ["Enderchest"] = function() core.open_enderchest() end,
+ ["HandSlot"] = function() core.open_handslot() end,
+ ["NextItem"] = "next_item",
+ ["Strip"] = "strip",
+ ["AutoRefill"] = "autorefill",
+ }
+}
+
+function core.register_cheat(cheatname, category, func)
+ core.cheats[category] = core.cheats[category] or {}
+ core.cheats[category][cheatname] = func
+end
+
+local cheatpath = core.get_builtin_path() .. "client" .. DIR_DELIM .. "cheats" .. DIR_DELIM
+
+dofile(cheatpath .. "chat.lua")
+dofile(cheatpath .. "combat.lua")
+dofile(cheatpath .. "inventory.lua")
+dofile(cheatpath .. "movement.lua")
+dofile(cheatpath .. "player.lua")
+dofile(cheatpath .. "render.lua")
+dofile(cheatpath .. "world.lua")
diff --git a/builtin/client/cheats/inventory.lua b/builtin/client/cheats/inventory.lua
new file mode 100644
index 000000000..b9943f507
--- /dev/null
+++ b/builtin/client/cheats/inventory.lua
@@ -0,0 +1,147 @@
+local elapsed_time = 0
+local tick_time = 0.05
+local drop_action = InventoryAction("drop")
+
+local strip_move_act = InventoryAction("move")
+strip_move_act:to("current_player", "craft", 1)
+local strip_craft_act = InventoryAction("craft")
+strip_craft_act:craft("current_player")
+local strip_move_back_act = InventoryAction("move")
+strip_move_back_act:from("current_player", "craftresult", 1)
+
+core.register_globalstep(function(dtime)
+ local player = core.localplayer
+ if not player then return end
+ local item = player:get_wielded_item()
+ local itemdef = core.get_item_def(item:get_name())
+ local wieldindex = player:get_wield_index()
+ -- AutoRefill
+ if core.settings:get_bool("autorefill") and itemdef then
+ local space = item:get_free_space()
+ local i = core.find_item(item:get_name(), wieldindex + 1)
+ if i and space > 0 then
+ local move_act = InventoryAction("move")
+ move_act:to("current_player", "main", wieldindex)
+ move_act:from("current_player", "main", i)
+ move_act:set_count(space)
+ move_act:apply()
+ end
+ end
+ -- Strip
+ if core.settings:get_bool("strip") then
+ if itemdef and itemdef.groups.tree and player:get_control().RMB then
+ strip_move_act:from("current_player", "main", wieldindex)
+ strip_move_back_act:to("current_player", "main", wieldindex)
+ strip_move_act:apply()
+ strip_craft_act:apply()
+ strip_move_back_act:apply()
+ end
+ end
+ -- AutoEject
+ if core.settings:get_bool("autoeject") then
+ local list = (core.settings:get("eject_items") or ""):split(",")
+ local inventory = core.get_inventory("current_player")
+ for index, stack in pairs(inventory.main) do
+ if table.indexof(list, stack:get_name()) ~= -1 then
+ drop_action:from("current_player", "main", index)
+ drop_action:apply()
+ end
+ end
+ end
+ -- NextItem
+ if core.settings:get_bool("next_item") then
+ elapsed_time = elapsed_time + dtime
+ if elapsed_time < tick_time then return end
+ if item:get_count() == 0 then
+ player:set_wield_index(wieldindex + 1)
+ end
+ elapsed_time = 0
+ end
+end)
+
+core.register_list_command("eject", "Configure AutoEject", "eject_items")
+
+-- AutoTool
+
+local function check_tool(stack, node_groups, old_best_time)
+ local toolcaps = stack:get_tool_capabilities()
+ if not toolcaps then return end
+ local best_time = old_best_time
+ for group, groupdef in pairs(toolcaps.groupcaps) do
+ local level = node_groups[group]
+ if level then
+ local this_time = groupdef.times[level]
+ if this_time < best_time then
+ best_time = this_time
+ end
+ end
+ end
+ return best_time < old_best_time, best_time
+end
+
+core.register_on_punchnode(function(pos, node)
+ if not minetest.settings:get_bool("autotool") then return end
+ local player = minetest.localplayer
+ local inventory = minetest.get_inventory("current_player")
+ local node_groups = minetest.get_node_def(node.name).groups
+ local new_index = player:get_wield_index()
+ local is_better, best_time = false, math.huge
+ is_better, best_time = check_tool(player:get_wielded_item(), node_groups, best_time)
+ is_better, best_time = check_tool(inventory.hand[1], node_groups, best_time)
+ for index, stack in pairs(inventory.main) do
+ is_better, best_time = check_tool(stack, node_groups, best_time)
+ if is_better then
+ new_index = index
+ end
+ end
+ player:set_wield_index(new_index)
+end)
+
+-- Enderchest
+
+function get_itemslot_bg(x, y, w, h)
+ local out = ""
+ for i = 0, w - 1, 1 do
+ for j = 0, h - 1, 1 do
+ out = out .."image["..x+i..","..y+j..";1,1;mcl_formspec_itemslot.png]"
+ end
+ end
+ return out
+end
+
+local enderchest_formspec = "size[9,8.75]"..
+ "label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", "Ender Chest")).."]"..
+ "list[current_player;enderchest;0,0.5;9,3;]"..
+ get_itemslot_bg(0,0.5,9,3)..
+ "label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", "Inventory")).."]"..
+ "list[current_player;main;0,4.5;9,3;9]"..
+ get_itemslot_bg(0,4.5,9,3)..
+ "list[current_player;main;0,7.74;9,1;]"..
+ get_itemslot_bg(0,7.74,9,1)..
+ "listring[current_player;enderchest]"..
+ "listring[current_player;main]"
+
+function core.open_enderchest()
+ core.show_formspec("__builtin__:enderchest", enderchest_formspec)
+end
+
+-- HandSlot
+
+local hand_formspec = "size[9,8.75]"..
+ "label[0,0;"..minetest.formspec_escape(minetest.colorize("#313131", "Hand")).."]"..
+ "list[current_player;hand;0,0.5;1,1;]"..
+ get_itemslot_bg(0,0.5,1,1)..
+ "label[0,4.0;"..minetest.formspec_escape(minetest.colorize("#313131", "Inventory")).."]"..
+ "list[current_player;main;0,4.5;9,3;9]"..
+ get_itemslot_bg(0,4.5,9,3)..
+ "list[current_player;main;0,7.74;9,1;]"..
+ get_itemslot_bg(0,7.74,9,1)..
+ "listring[current_player;hand]"..
+ "listring[current_player;main]"
+
+function core.open_handslot()
+ minetest.show_formspec("__builtin__:hand", hand_formspec)
+end
+
+
+
diff --git a/builtin/client/cheats/movement.lua b/builtin/client/cheats/movement.lua
new file mode 100644
index 000000000..33a46fca0
--- /dev/null
+++ b/builtin/client/cheats/movement.lua
@@ -0,0 +1,41 @@
+local function register_keypress_cheat(cheat, keyname, condition)
+ local was_active = false
+ core.register_globalstep(function()
+ local is_active = core.settings:get_bool(cheat) and (not condition or condition())
+ if is_active then
+ core.set_keypress(keyname, true)
+ elseif was_active then
+ core.set_keypress(keyname, false)
+ end
+ was_active = is_active
+ end)
+end
+
+register_keypress_cheat("autosneak", "sneak", function()
+ return core.localplayer:is_touching_ground()
+end)
+register_keypress_cheat("autosprint", "special1")
+
+local legit_override
+
+local function get_override_factor(name)
+ if core.settings:get_bool("override_" .. name) then
+ return tonumber(core.settings:get("override_" .. name .. "_factor")) or 1
+ else
+ return 1.0
+ end
+end
+
+core.register_globalstep(function()
+ if not legit_override then return end
+ local override = table.copy(legit_override)
+ override.speed = override.speed * get_override_factor("speed")
+ override.jump = override.jump * get_override_factor("jump")
+ override.gravity = override.gravity * get_override_factor("gravity")
+ core.localplayer:set_physics_override(override)
+end)
+
+core.register_on_recieve_physics_override(function(override)
+ legit_override = override
+ return true
+end)
diff --git a/builtin/client/cheats/player.lua b/builtin/client/cheats/player.lua
new file mode 100644
index 000000000..499ed47f3
--- /dev/null
+++ b/builtin/client/cheats/player.lua
@@ -0,0 +1,39 @@
+local death_formspec = ""
+ .. "size[11,5.5]"
+ .. "bgcolor[#320000b4;true]"
+ .. "label[4.85,1.35;" .. "You died" .. "]"
+ .. "button_exit[2,3;3,0.5;btn_respawn;" .. "Respawn" .. "]"
+ .. "button_exit[6,3;3,0.5;btn_ghost_mode;" .. "Ghost Mode" .. "]"
+ .. "set_focus[btn_respawn;true]"
+
+core.register_on_death(function()
+ core.display_chat_message("You died at " .. core.pos_to_string(vector.round(core.localplayer:get_pos())) .. ".")
+ if core.settings:get_bool("autorespawn") then
+ core.send_respawn()
+ else
+ core.show_formspec("__builtin__:death", death_formspec)
+ end
+end)
+
+core.register_on_formspec_input(function(formname, fields)
+ if formname == "__builtin__: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 = "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/cheats/render.lua b/builtin/client/cheats/render.lua
new file mode 100644
index 000000000..6402246f3
--- /dev/null
+++ b/builtin/client/cheats/render.lua
@@ -0,0 +1,2 @@
+core.register_list_command("xray", "Configure X-Ray", "xray_nodes")
+core.register_list_command("search", "Configure NodeESP", "node_esp_nodes")
diff --git a/builtin/client/cheats/world.lua b/builtin/client/cheats/world.lua
new file mode 100644
index 000000000..1a86e0703
--- /dev/null
+++ b/builtin/client/cheats/world.lua
@@ -0,0 +1,74 @@
+core.register_on_dignode(function(pos)
+ if core.settings:get_bool("replace") then
+ core.after(0, minetest.place_node, pos)
+ end
+end)
+
+local etime = 0
+
+core.register_globalstep(function(dtime)
+ etime = etime + dtime
+ if etime < 1 then return end
+ local player = core.localplayer
+ if not player then return end
+ local pos = player:get_pos()
+ local item = player:get_wielded_item()
+ local def = core.get_item_def(item:get_name())
+ local nodes_per_tick = tonumber(minetest.settings:get("nodes_per_tick")) or 8
+ if item and item:get_count() > 0 and def and def.node_placement_prediction ~= "" then
+ if core.settings:get_bool("scaffold") then
+ local p = vector.round(vector.add(pos, {x = 0, y = -0.6, z = 0}))
+ local node = minetest.get_node_or_nil(p)
+ if not node or minetest.get_node_def(node.name).buildable_to then
+ core.place_node(p)
+ end
+ elseif core.settings:get_bool("scaffold_plus") then
+ local z = pos.z
+ local positions = {
+ {x = 0, y = -0.6, z = 0},
+ {x = 1, y = -0.6, z = 0},
+ {x = -1, y = -0.6, z = 0},
+ {x = -1, y = -0.6, z = -1},
+ {x = 0, y = -0.6, z = -1},
+ {x = 1, y = -0.6, z = -1},
+ {x = -1, y = -0.6, z = 1},
+ {x = 0, y = -0.6, z = 1},
+ {x = 1, y = -0.6, z = 1}
+ }
+ for i, p in pairs(positions) do
+ core.place_node(vector.add(pos, p))
+ end
+ elseif core.settings:get_bool("block_water") then
+ local positions = core.find_nodes_near(pos, 5, {"mcl_core:water_source", "mcl_core:water_floating"}, true)
+ for i, p in pairs(positions) do
+ if i > nodes_per_tick then return end
+ core.place_node(p)
+ end
+ elseif core.settings:get_bool("autotnt") then
+ local positions = core.find_nodes_near_under_air_except(pos, 5, item:get_name(), true)
+ for i, p in pairs(positions) do
+ if i > nodes_per_tick then return end
+ core.place_node(vector.add(p, {x = 0, y = 1, z = 0}))
+ end
+ end
+ end
+ if core.settings:get_bool("nuke") then
+ local i = 0
+ for x = pos.x - 5, pos.x + 5 do
+ for y = pos.y - 5, pos.y + 5 do
+ for z = pos.z - 5, pos.z + 5 do
+ local p = vector.new(x, y, z)
+ local node = core.get_node_or_nil(p)
+ local def = node and core.get_node_def(node.name)
+ if def and def.diggable then
+ if i > nodes_per_tick then return end
+ core.dig_node(p)
+ i = i + 1
+ end
+ end
+ end
+ end
+ end
+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..40acf3b9b 100644
--- a/builtin/client/init.lua
+++ b/builtin/client/init.lua
@@ -6,6 +6,8 @@ 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")
+dofile(clientpath .. "cheats"..DIR_DELIM.."init.lua")
+
diff --git a/builtin/client/register.lua b/builtin/client/register.lua
index 27a6b02d9..03dc41f71 100644
--- a/builtin/client/register.lua
+++ b/builtin/client/register.lua
@@ -47,6 +47,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
--
@@ -82,3 +102,5 @@ core.registered_on_item_use, core.register_on_item_use = make_registration()
core.registered_on_modchannel_message, core.register_on_modchannel_message = make_registration()
core.registered_on_modchannel_signal, core.register_on_modchannel_signal = make_registration()
core.registered_on_inventory_open, core.register_on_inventory_open = make_registration()
+core.registered_on_recieve_physics_override, core.register_on_recieve_physics_override = make_registration()
+core.registered_on_play_sound, core.register_on_play_sound = make_registration()
diff --git a/builtin/client/util.lua b/builtin/client/util.lua
new file mode 100644
index 000000000..783d0ceb1
--- /dev/null
+++ b/builtin/client/util.lua
@@ -0,0 +1,52 @@
+function core.parse_pos(param)
+ local p = {}
+ local playerpos = core.localplayer:get_pos()
+ 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] = playerpos[k]
+ else
+ p[k] = tonumber(v)
+ end
+ end
+ if p.x and p.y and p.z then
+ return true, vector.round(p)
+ end
+ return false, "Invalid position (" .. param .. ")"
+end
+
+function core.parse_relative_pos(param)
+ local success, pos = core.parse_pos(param:gsub("~", "0"))
+ if success then pos = vector.round(vector.add(core.localplayer:get_pos(), pos)) end
+ return success, pos
+end
+
+function core.find_item(item, mini, maxi)
+ for index, stack in ipairs(core.get_inventory("current_player").main) do
+ if (not mini or index >= mini) and (not maxi or index <= maxi) and stack:get_name() == item then
+ return index
+ end
+ end
+end
+
+function core.switch_to_item(item)
+ local i = core.find_item(item)
+ if i then
+ core.localplayer:set_wield_index(i)
+ return true
+ else
+ return false
+ end
+end
+
+function core.get_pointed_thing()
+ local pos = core.camera:get_pos()
+ local pos2 = vector.add(pos, vector.multiply(core.camera:get_look_dir(), 5))
+ local player = core.localplayer
+ if not player then return end
+ local item = player:get_wielded_item()
+ if not item then return end
+ local def = core.get_item_def(item:get_name())
+ local ray = core.raycast(pos, pos2, true, core.settings:get_bool("point_liquids") or def and def.liquids_pointable)
+ return ray and ray:next()
+end
diff --git a/builtin/common/chatcommands.lua b/builtin/common/chatcommands.lua
index 52edda659..bf989db7d 100644
--- a/builtin/common/chatcommands.lua
+++ b/builtin/common/chatcommands.lua
@@ -29,6 +29,51 @@ function core.override_chatcommand(name, redefinition)
core.registered_chatcommands[name] = chatcommand
end
+if INIT == "client" then
+ function core.register_list_command(command, desc, setting)
+ local def = {}
+ def.description = desc
+ def.params = "del <item> | add <item> | list"
+ function def.func(param)
+ local list = (minetest.settings:get(setting) or ""):split(",")
+ if param == "list" then
+ return true, table.concat(list, ", ")
+ else
+ local sparam = param:split(" ")
+ local cmd = sparam[1]
+ local item = sparam[2]
+ if cmd == "del" then
+ if not item then
+ return false, "Missing item."
+ end
+ local i = table.indexof(list, item)
+ if i == -1 then
+ return false, item .. " is not on the list."
+ else
+ table.remove(list, i)
+ core.settings:set(setting, table.concat(list, ","))
+ return true, "Removed " .. item .. " from the list."
+ end
+ elseif cmd == "add" then
+ if not item then
+ return false, "Missing item."
+ end
+ local i = table.indexof(list, item)
+ if i ~= -1 then
+ return false, item .. " is already on the list."
+ else
+ table.insert(list, item)
+ core.settings:set(setting, table.concat(list, ","))
+ return true, "Added " .. item .. " to the list."
+ end
+ end
+ end
+ return false, "Invalid usage. (See .help " .. command .. ")"
+ end
+ core.register_chatcommand(command, def)
+ end
+end
+
local cmd_marker = "/"
local function gettext(...)
diff --git a/builtin/common/misc_helpers.lua b/builtin/common/misc_helpers.lua
index e29a9f422..64d67bc72 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
@@ -584,6 +594,67 @@ function core.colorize(color, message)
return table.concat(lines, "\n") .. core.get_color_escape_sequence("#ffffff")
end
+local function rgb_to_hex(rgb)
+ local hexadecimal = '#'
+
+ for key, value in pairs(rgb) do
+ local hex = ''
+
+ while(value > 0)do
+ local index = math.fmod(value, 16) + 1
+ value = math.floor(value / 16)
+ hex = string.sub('0123456789ABCDEF', index, index) .. hex
+ end
+
+ if(string.len(hex) == 0)then
+ hex = '00'
+
+ elseif(string.len(hex) == 1)then
+ hex = '0' .. hex
+ end
+
+ hexadecimal = hexadecimal .. hex
+ end
+
+ return hexadecimal
+end
+
+local function color_from_hue(hue)
+ local h = hue / 60
+ local c = 255
+ local x = (1 - math.abs(h%2 - 1)) * 255
+
+ local i = math.floor(h);
+ if (i == 0) then
+ return rgb_to_hex({c, x, 0})
+ elseif (i == 1) then
+ return rgb_to_hex({x, c, 0})
+ elseif (i == 2) then
+ return rgb_to_hex({0, c, x})
+ elseif (i == 3) then
+ return rgb_to_hex({0, x, c});
+ elseif (i == 4) then
+ return rgb_to_hex({x, 0, c});
+ else
+ return rgb_to_hex({c, 0, x});
+ end
+end
+
+function core.rainbow(input)
+ local step = 360 / input:len()
+ local hue = 0
+ local output = ""
+ for i = 1, input:len() do
+ local char = input:sub(i,i)
+ if char:match("%s") then
+ output = output .. char
+ else
+ output = output .. core.get_color_escape_sequence(color_from_hue(hue)) .. char
+ end
+ hue = hue + step
+ end
+ return output
+end
function core.strip_foreground_colors(str)
return (str:gsub(ESCAPE_CHAR .. "%(c@[^)]+%)", ""))
@@ -637,6 +708,19 @@ function core.get_translator(textdomain)
return function(str, ...) return core.translate(textdomain or "", str, ...) end
end
+function core.get_pointed_thing_position(pointed_thing, above)
+ if pointed_thing.type == "node" then
+ if above then
+ -- The position where a node would be placed
+ return pointed_thing.above
+ end
+ -- The position where a node would be dug
+ return pointed_thing.under
+ elseif pointed_thing.type == "object" then
+ return pointed_thing.ref and pointed_thing.ref:get_pos()
+ end
+end
+
--------------------------------------------------------------------------------
-- Returns the exact coordinate of a pointed surface
--------------------------------------------------------------------------------
diff --git a/builtin/game/item.lua b/builtin/game/item.lua
index 109712b42..768df847b 100644
--- a/builtin/game/item.lua
+++ b/builtin/game/item.lua
@@ -24,19 +24,6 @@ function core.inventorycube(img1, img2, img3)
.. "{" .. img3:gsub("%^", "&")
end
-function core.get_pointed_thing_position(pointed_thing, above)
- if pointed_thing.type == "node" then
- if above then
- -- The position where a node would be placed
- return pointed_thing.above
- end
- -- The position where a node would be dug
- return pointed_thing.under
- elseif pointed_thing.type == "object" then
- return pointed_thing.ref and pointed_thing.ref:get_pos()
- end
-end
-
function core.dir_to_facedir(dir, is6d)
--account for y if requested
if is6d and math.abs(dir.y) > math.abs(dir.x) and math.abs(dir.y) > math.abs(dir.z) then
diff --git a/builtin/init.lua b/builtin/init.lua
index 75bb3db85..f76174be7 100644
--- a/builtin/init.lua
+++ b/builtin/init.lua
@@ -36,7 +36,6 @@ dofile(commonpath .. "misc_helpers.lua")
if INIT == "game" then
dofile(gamepath .. "init.lua")
- assert(not core.get_http_api)
elseif INIT == "mainmenu" then
local mm_script = core.settings:get("main_menu_script")
if mm_script and mm_script ~= "" then
diff --git a/builtin/mainmenu/dlg_settings_advanced.lua b/builtin/mainmenu/dlg_settings_advanced.lua
index c16e4aad0..d82ae6263 100644
--- a/builtin/mainmenu/dlg_settings_advanced.lua
+++ b/builtin/mainmenu/dlg_settings_advanced.lua
@@ -400,6 +400,36 @@ local function parse_config_file(read_all, parse_mods)
file:close()
end
end
+
+ -- Parse clientmods
+ local clientmods_category_initialized = false
+ local clientmods = {}
+ get_mods(core.get_clientmodpath(), clientmods)
+ for _, clientmod in ipairs(clientmods) do
+ local path = clientmod.path .. DIR_DELIM .. FILENAME
+ local file = io.open(path, "r")
+ if file then
+ if not clientmods_category_initialized then
+ fgettext_ne("Clientmods") -- not used, but needed for xgettext
+ table.insert(settings, {
+ name = "Clientmods",
+ level = 0,
+ type = "category",
+ })
+ clientmods_category_initialized = true
+ end
+
+ table.insert(settings, {
+ name = clientmod.name,
+ level = 1,
+ type = "category",
+ })
+
+ parse_single_file(file, path, read_all, settings, 2, false)
+
+ file:close()
+ end
+ end
end
return settings
diff --git a/builtin/mainmenu/init.lua b/builtin/mainmenu/init.lua
index 96d02d06c..b7e867d2e 100644
--- a/builtin/mainmenu/init.lua
+++ b/builtin/mainmenu/init.lua
@@ -114,3 +114,4 @@ local function init_globals()
end
init_globals()
+
diff --git a/builtin/mainmenu/tab_credits.lua b/builtin/mainmenu/tab_credits.lua
index c2b7e503a..617823319 100644
--- a/builtin/mainmenu/tab_credits.lua
+++ b/builtin/mainmenu/tab_credits.lua
@@ -16,6 +16,15 @@
--51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
--------------------------------------------------------------------------------
+local dragonfire_team = {
+ "Elias Fleckenstein [Main Developer]",
+ "cora [Core Developer]",
+ "emilia [Core Developer]",
+ "oneplustwo [Developer]",
+ "joshia_wi [Developer]",
+ "Code-Sploit [Developer]",
+ "DerZombiiie [User Support]",
+}
local core_developers = {
"Perttu Ahola (celeron55) <celeron55@gmail.com>",
@@ -106,6 +115,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("Dragonfire Team") .. ",," ..
+ buildCreditList(dragonfire_team) .. ",,," ..
"#FFFF00," .. fgettext("Core Developers") .. ",," ..
buildCreditList(core_developers) .. ",,," ..
"#FFFF00," .. fgettext("Active Contributors") .. ",," ..
diff --git a/builtin/settingtypes.txt b/builtin/settingtypes.txt
index dd4914201..49a15f4ff 100644
--- a/builtin/settingtypes.txt
+++ b/builtin/settingtypes.txt
@@ -194,6 +194,10 @@ keymap_place (Place key) key KEY_RBUTTON
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
keymap_inventory (Inventory key) key KEY_KEY_I
+# Key for opening the special inventory.
+# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
+keymap_special_inventory (Special inventory key) key KEY_KEY_O
+
# Key for moving fast in fast mode.
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
keymap_special1 (Special key) key KEY_KEY_E
@@ -274,6 +278,14 @@ keymap_drop (Drop item key) key KEY_KEY_Q
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
keymap_zoom (View zoom key) key KEY_KEY_Z
+# Key for toggling Killaura.
+# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
+keymap_toggle_killaura (Killaura key) key KEY_KEY_X
+
+# Key for toggling Freecam.
+# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
+keymap_toggle_freecam (Freecam key) key KEY_KEY_G
+
# Key for selecting the first hotbar slot.
# See http://irrlicht.sourceforge.net/docu/namespaceirr.html#a54da2a0e231901735e3da1b0edf72eb3
keymap_slot1 (Hotbar slot 1 key) key KEY_KEY_1
@@ -2189,3 +2201,164 @@ contentdb_flag_blacklist (ContentDB Flag Blacklist) string nonfree, desktop_defa
# Maximum number of concurrent downloads. Downloads exceeding this limit will be queued.
contentdb_max_concurrent_downloads (ContentDB Max Concurrent Downloads) int 3
+
+[Cheat Menu]
+
+# Font to use for cheat menu
+cheat_menu_font (MenuFont) enum FM_Mono FM_Standard,FM_Mono,FM_Fallback,FM_Simple,FM_SimpleMono,FM_MaxMode,FM_Unspecified
+
+# (RGB value)
+cheat_menu_bg_color (Cell background color) v3f 255, 145, 88
+
+cheat_menu_bg_color_alpha (Cell background color alpha) int 192
+
+# (RGB value)
+cheat_menu_active_bg_color (Active cell background color) v3f 255, 87, 53
+
+cheat_menu_active_bg_color_alpha (Active cell background color alpha) int 192
+
+# (RGB value)
+cheat_menu_font_color (Font color) v3f 0, 0, 0
+
+cheat_menu_font_color_alpha (Font color alpha) int 255
+
+# (RGB value)
+cheat_menu_selected_font_color (Selected font color) v3f 255, 252, 88
+
+cheat_menu_selected_font_color_alpha (Selected font color alpha) int 255
+
+[Cheats]
+
+fullbright (Fullbright) bool false
+
+xray (XRay) bool false
+
+xray_nodes (XRay Nodes) string default:stone,mcl_core:stone
+
+priv_bypass (PrivBypass) bool true
+
+fastdig (FastDig) bool false
+
+fastplace (FastPlace) bool false
+
+autodig (AutoDig) bool false
+
+autoplace (AutoPlace) 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 (IncreasedRange) bool true
+
+increase_tool_range_plus (IncreasedRangePlus) bool true
+
+hud_flags_bypass (HUDBypass) bool true
+
+antiknockback (AntiKnockback) bool false
+
+entity_speed (GodMode) bool false
+
+jesus (Jesus) bool false
+
+instant_break (InstantBreak) bool false
+
+no_night (BrightNight) bool false
+
+coords (Coords) bool false
+
+point_liquids (PointLiquids) bool false
+
+log_particles (ParticleExploit) bool false
+
+spamclick (FastHit) bool false
+
+no_force_rotate (NoForceRotate) bool false
+
+enable_tracers (Tracers) bool false
+
+enable_esp (ESP) bool false
+
+no_slow (NoSlow) bool false
+
+ignore_status_messages (IgnoreStatus) bool true
+
+mark_deathmessages (Deathmessages) bool true
+
+autosneak (AutoSneak) bool false
+
+autoeject (AutoEject) bool false
+
+eject_items (AutoEject Items) string
+
+autotool (AutoTool) bool false
+
+autorespawn (AutoRespawn) bool false
+
+next_item (NextItem) bool false
+
+scaffold (Scaffold) bool false
+
+scaffold_plus (ScaffoldPlus) bool false
+
+block_water (BlockWater) bool false
+
+autotnt (PlaceOnTop) bool false
+
+replace (Replace) bool false
+
+crystal_pvp (CrystalPvP) bool false
+
+autototem (AutoTotem) bool false
+
+dont_point_nodes (ThroughWalls) bool false
+
+strip (Strip) bool false
+
+autorefill (AutoRefill) bool false
+
+nuke (Nuke) bool false
+
+chat_color (Chat Color) string rainbow
+
+use_chat_color (ColoredChat) bool false
+
+chat_reverse (ReversedChat) bool false
+
+forcefield (Forcefield) bool false
+
+friendlist (Killaura / Forcefield Friendlist) string
+
+cheat_hud (CheatHUD) bool true
+
+enable_node_esp (NodeESP) bool false
+
+enable_node_tracers (NodeTracers) bool false
+
+node_esp_nodes (NodeESP Nodes) string
+
+only_trace_players (OnlyTracePlayers) bool false
+
+autosprint (AutoSprint) bool false
+
+override_speed (SpeedOverride) bool false
+
+override_jump (JumpOverride) bool false
+
+override_gravity (GravityOverride) bool false
+
+override_speed_factor (SpeedOverride Factor) float 1.2
+
+override_jump_factor (JumpOverride Factor) float 2.0
+
+override_gravity_factor (GravityOverride) float 0.8
+
+jetpack (JetPack) bool false
+
+autohit (AutoHit) bool false
+
+antislip (AntiSlip) bool false