aboutsummaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/client/chatcommands.lua141
-rw-r--r--builtin/client/cheats.lua58
-rw-r--r--builtin/client/death_formspec.lua40
-rw-r--r--builtin/client/init.lua5
-rw-r--r--builtin/client/register.lua23
-rw-r--r--builtin/client/util.lua56
-rw-r--r--builtin/common/chatcommands.lua45
-rw-r--r--builtin/common/misc_helpers.lua85
-rw-r--r--builtin/game/item.lua13
-rw-r--r--builtin/init.lua1
-rw-r--r--builtin/mainmenu/dlg_contentstore.lua8
-rw-r--r--builtin/mainmenu/dlg_settings_advanced.lua30
-rw-r--r--builtin/mainmenu/init.lua1
-rw-r--r--builtin/mainmenu/pkgmgr.lua56
-rw-r--r--builtin/mainmenu/tab_content.lua88
-rw-r--r--builtin/mainmenu/tab_credits.lua11
-rw-r--r--builtin/settingtypes.txt113
17 files changed, 725 insertions, 49 deletions
diff --git a/builtin/client/chatcommands.lua b/builtin/client/chatcommands.lua
index 0e8d4dd03..0da3dab1b 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,144 @@ 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 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_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
+})
+
+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.lua b/builtin/client/cheats.lua
new file mode 100644
index 000000000..1abc2c8ef
--- /dev/null
+++ b/builtin/client/cheats.lua
@@ -0,0 +1,58 @@
+core.cheats = {
+ ["Combat"] = {
+ ["AntiKnockback"] = "antiknockback",
+ ["FastHit"] = "spamclick",
+ ["AttachmentFloat"] = "float_above_parent",
+ ["ThroughWalls"] = "dont_point_nodes",
+ ["AutoHit"] = "autohit",
+ },
+ ["Movement"] = {
+ ["Freecam"] = "freecam",
+ ["AutoForward"] = "continuous_forward",
+ ["PitchMove"] = "pitch_move",
+ ["AutoJump"] = "autojump",
+ ["Jesus"] = "jesus",
+ ["NoSlow"] = "no_slow",
+ ["JetPack"] = "jetpack",
+ ["AntiSlip"] = "antislip",
+ },
+ ["Render"] = {
+ ["Xray"] = "xray",
+ ["Fullbright"] = "fullbright",
+ ["HUDBypass"] = "hud_flags_bypass",
+ ["NoHurtCam"] = "no_hurt_cam",
+ ["BrightNight"] = "no_night",
+ ["Coords"] = "coords",
+ ["CheatHUD"] = "cheat_hud",
+ ["EntityESP"] = "enable_entity_esp",
+ ["EntityTracers"] = "enable_entity_tracers",
+ ["PlayerESP"] = "enable_player_esp",
+ ["PlayerTracers"] = "enable_player_tracers",
+ ["NodeESP"] = "enable_node_esp",
+ ["NodeTracers"] = "enable_node_tracers",
+ },
+ ["World"] = {
+ ["FastDig"] = "fastdig",
+ ["FastPlace"] = "fastplace",
+ ["AutoDig"] = "autodig",
+ ["AutoPlace"] = "autoplace",
+ ["InstantBreak"] = "instant_break",
+ },
+ ["Exploit"] = {
+ ["EntitySpeed"] = "entity_speed",
+ },
+ ["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",
+ },
+}
+
+function core.register_cheat(cheatname, category, func)
+ core.cheats[category] = core.cheats[category] or {}
+ core.cheats[category][cheatname] = func
+end
diff --git a/builtin/client/death_formspec.lua b/builtin/client/death_formspec.lua
index e755ac5c1..7b8530440 100644
--- a/builtin/client/death_formspec.lua
+++ b/builtin/client/death_formspec.lua
@@ -1,16 +1,38 @@
--- CSM death formspec. Only used when clientside modding is enabled, otherwise
--- handled by the engine.
+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.")
- 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)
+ 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 == "bultin:death" then
- core.send_respawn()
+ 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/init.lua b/builtin/client/init.lua
index 9633a7c71..8c6512ec1 100644
--- a/builtin/client/init.lua
+++ b/builtin/client/init.lua
@@ -6,6 +6,9 @@ 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 .. "util.lua")
+dofile(clientpath .. "chatcommands.lua")
dofile(clientpath .. "death_formspec.lua")
+dofile(clientpath .. "cheats.lua")
+
diff --git a/builtin/client/register.lua b/builtin/client/register.lua
index 27a6b02d9..de5d89909 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,6 @@ 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()
+core.registered_on_spawn_particle, core.register_on_spawn_particle = make_registration()
diff --git a/builtin/client/util.lua b/builtin/client/util.lua
new file mode 100644
index 000000000..e85727436
--- /dev/null
+++ b/builtin/client/util.lua
@@ -0,0 +1,56 @@
+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(), 7))
+ 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
+
+function core.close_formspec(formname)
+ return core.show_formspec(formname, "")
+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..db94e7073 100644
--- a/builtin/common/misc_helpers.lua
+++ b/builtin/common/misc_helpers.lua
@@ -517,6 +517,17 @@ function table.shuffle(t, from, to, random)
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 +595,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 +709,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_contentstore.lua b/builtin/mainmenu/dlg_contentstore.lua
index 6525f6013..b3616bfc8 100644
--- a/builtin/mainmenu/dlg_contentstore.lua
+++ b/builtin/mainmenu/dlg_contentstore.lua
@@ -40,8 +40,8 @@ local num_per_page = 5
local filter_type = 1
local filter_types_titles = {
fgettext("All packages"),
- fgettext("Games"),
- fgettext("Mods"),
+-- fgettext("Games"),
+ fgettext("Clientmods"),
fgettext("Texture packs"),
}
@@ -50,7 +50,7 @@ local download_queue = {}
local filter_types_type = {
nil,
- "game",
+-- "game",
"mod",
"txp",
}
@@ -254,7 +254,7 @@ end
function store.update_paths()
local mod_hash = {}
pkgmgr.refresh_globals()
- for _, mod in pairs(pkgmgr.global_mods:get_list()) do
+ for _, mod in pairs(pkgmgr.clientmods:get_list()) do
if mod.author then
mod_hash[mod.author:lower() .. "/" .. mod.name] = mod
end
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/pkgmgr.lua b/builtin/mainmenu/pkgmgr.lua
index 5b8807310..d4acb2b6a 100644
--- a/builtin/mainmenu/pkgmgr.lua
+++ b/builtin/mainmenu/pkgmgr.lua
@@ -592,7 +592,7 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
clean_path = get_last_folder(cleanup_path(basefolder.path))
end
if clean_path then
- targetpath = core.get_modpath() .. DIR_DELIM .. clean_path
+ targetpath = core.get_clientmodpath() .. DIR_DELIM .. clean_path
else
return nil,
fgettext("Install Mod: Unable to find suitable folder name for modpack $1",
@@ -619,7 +619,7 @@ function pkgmgr.install_dir(type, path, basename, targetpath)
end
if targetfolder ~= nil and pkgmgr.isValidModname(targetfolder) then
- targetpath = core.get_modpath() .. DIR_DELIM .. targetfolder
+ targetpath = core.get_clientmodpath() .. DIR_DELIM .. targetfolder
else
return nil, fgettext("Install Mod: Unable to find real mod name for: $1", path)
end
@@ -671,6 +671,54 @@ function pkgmgr.install(type, modfilename, basename, dest)
end
--------------------------------------------------------------------------------
+function pkgmgr.prepareclientmodlist(data)
+ local retval = {}
+
+ local clientmods = {}
+
+ --read clientmods
+ local modpath = core.get_clientmodpath()
+
+ if modpath ~= nil and
+ modpath ~= "" then
+ get_mods(modpath,clientmods)
+ end
+
+ for i=1,#clientmods,1 do
+ clientmods[i].type = "mod"
+ clientmods[i].loc = "global"
+ clientmods[i].is_clientside = true
+ retval[#retval + 1] = clientmods[i]
+ end
+
+ --read mods configuration
+ local filename = modpath ..
+ DIR_DELIM .. "mods.conf"
+
+ local conffile = Settings(filename)
+
+ for key,value in pairs(conffile:to_table()) do
+ if key:sub(1, 9) == "load_mod_" then
+ key = key:sub(10)
+ local element = nil
+ for i=1,#retval,1 do
+ if retval[i].name == key and
+ not retval[i].is_modpack then
+ element = retval[i]
+ break
+ end
+ end
+ if element ~= nil then
+ element.enabled = value ~= "false" and value ~= "nil" and value
+ else
+ core.log("info", "Clientmod: " .. key .. " " .. dump(value) .. " but not found")
+ end
+ end
+ end
+
+ return retval
+end
+
function pkgmgr.preparemodlist(data)
local retval = {}
@@ -813,6 +861,10 @@ function pkgmgr.refresh_globals()
pkgmgr.comparemod, is_equal, nil, {})
pkgmgr.global_mods:add_sort_mechanism("alphabetic", sort_mod_list)
pkgmgr.global_mods:set_sortmode("alphabetic")
+ pkgmgr.clientmods = filterlist.create(pkgmgr.prepareclientmodlist,
+ pkgmgr.comparemod, is_equal, nil, {})
+ pkgmgr.clientmods:add_sort_mechanism("alphabetic", sort_mod_list)
+ pkgmgr.clientmods:set_sortmode("alphabetic")
end
--------------------------------------------------------------------------------
diff --git a/builtin/mainmenu/tab_content.lua b/builtin/mainmenu/tab_content.lua
index 336730bf4..a76fee864 100644
--- a/builtin/mainmenu/tab_content.lua
+++ b/builtin/mainmenu/tab_content.lua
@@ -19,6 +19,10 @@
local packages_raw
local packages
+local function modname_valid(name)
+ return not name:find("[^a-z0-9_]")
+end
+
--------------------------------------------------------------------------------
local function get_formspec(tabview, name, tabdata)
if pkgmgr.global_mods == nil then
@@ -33,6 +37,7 @@ local function get_formspec(tabview, name, tabdata)
table.insert_all(packages_raw, pkgmgr.games)
table.insert_all(packages_raw, pkgmgr.get_texture_packs())
table.insert_all(packages_raw, pkgmgr.global_mods:get_list())
+ table.insert_all(packages_raw, pkgmgr.clientmods:get_list())
local function get_data()
return packages_raw
@@ -45,6 +50,38 @@ local function get_formspec(tabview, name, tabdata)
packages = filterlist.create(get_data, pkgmgr.compare_package,
is_equal, nil, {})
+
+ local filename = core.get_clientmodpath() .. DIR_DELIM .. "mods.conf"
+
+ local conffile = Settings(filename)
+ local mods = conffile:to_table()
+
+ for i = 1, #packages_raw do
+ local mod = packages_raw[i]
+ if mod.is_clientside and not mod.is_modpack then
+ if modname_valid(mod.name) then
+ conffile:set("load_mod_" .. mod.name,
+ mod.enabled and "true" or "false")
+ elseif mod.enabled then
+ gamedata.errormessage = fgettext_ne("Failed to enable clientmo" ..
+ "d \"$1\" as it contains disallowed characters. " ..
+ "Only characters [a-z0-9_] are allowed.",
+ mod.name)
+ end
+ mods["load_mod_" .. mod.name] = nil
+ end
+ end
+
+ -- Remove mods that are not present anymore
+ for key in pairs(mods) do
+ if key:sub(1, 9) == "load_mod_" then
+ conffile:remove(key)
+ end
+ end
+
+ if not conffile:write() then
+ core.log("error", "Failed to write clientmod config file")
+ end
end
if tabdata.selected_pkg == nil then
@@ -94,9 +131,21 @@ local function get_formspec(tabview, name, tabdata)
if selected_pkg.type == "mod" then
if selected_pkg.is_modpack then
- retval = retval ..
- "button[8.65,4.65;3.25,1;btn_mod_mgr_rename_modpack;" ..
- fgettext("Rename") .. "]"
+ if selected_pkg.is_clientside then
+ if pkgmgr.is_modpack_entirely_enabled({list = packages}, selected_pkg.name) then
+ retval = retval ..
+ "button[8.65,4.65;3.25,1;btn_mod_mgr_mp_disable;" ..
+ fgettext("Disable modpack") .. "]"
+ else
+ retval = retval ..
+ "button[8.65,4.65;3.25,1;btn_mod_mgr_mp_enable;" ..
+ fgettext("Enable modpack") .. "]"
+ end
+ else
+ retval = retval ..
+ "button[8.65,4.65;3.25,1;btn_mod_mgr_rename_modpack;" ..
+ fgettext("Rename") .. "]"
+ end
else
--show dependencies
desc = desc .. "\n\n"
@@ -117,6 +166,17 @@ local function get_formspec(tabview, name, tabdata)
"\n" .. toadd_soft
end
end
+ if selected_pkg.is_clientside then
+ if selected_pkg.enabled then
+ retval = retval ..
+ "button[8.65,4.65;3.25,1;btn_mod_mgr_disable_mod;" ..
+ fgettext("Disable") .. "]"
+ else
+ retval = retval ..
+ "button[8.65,4.65;3.25,1;btn_mod_mgr_enable_mod;" ..
+ fgettext("Enable") .. "]"
+ end
+ end
end
else
@@ -150,6 +210,28 @@ local function handle_buttons(tabview, fields, tabname, tabdata)
if fields["pkglist"] ~= nil then
local event = core.explode_table_event(fields["pkglist"])
tabdata.selected_pkg = event.row
+ local mod = packages:get_list()[tabdata.selected_pkg]
+
+ if event.type == "DCL" and mod.is_clientside then
+ pkgmgr.enable_mod({data = {list = packages, selected_mod = tabdata.selected_pkg}})
+ packages = nil
+ end
+ return true
+ end
+
+ if fields.btn_mod_mgr_mp_enable ~= nil or
+ fields.btn_mod_mgr_mp_disable ~= nil then
+ pkgmgr.enable_mod({data = {list = packages, selected_mod = tabdata.selected_pkg}},
+ fields.btn_mod_mgr_mp_enable ~= nil)
+ packages = nil
+ return true
+ end
+
+ if fields.btn_mod_mgr_enable_mod ~= nil or
+ fields.btn_mod_mgr_disable_mod ~= nil then
+ pkgmgr.enable_mod({data = {list = packages, selected_mod = tabdata.selected_pkg}},
+ fields.btn_mod_mgr_enable_mod ~= nil)
+ packages = nil
return true
end
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 c9f16578c..0d4985138 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,104 @@ 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
+
+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 (EntitySpeed) 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
+
+spamclick (FastHit) bool false
+
+no_force_rotate (NoForceRotate) bool false
+
+no_slow (NoSlow) bool false
+
+cheat_hud (CheatHUD) bool true
+
+node_esp_nodes (NodeESP Nodes) string
+
+jetpack (JetPack) bool false
+
+autohit (AutoHit) bool false
+
+antislip (AntiSlip) bool false
+
+enable_entity_tracers (EntityTracers) bool false
+
+enable_entity_esp (EntityESP) bool false
+
+enable_player_tracers (PlayerTracers) bool false
+
+enable_player_esp (PlayerESP) bool false
+
+enable_node_esp (NodeESP) bool false
+
+enable_node_tracers (NodeTracers) bool false
+
+entity_esp_color (EntityESP Color) v3f 255, 255, 255
+
+player_esp_color (PlayerESP Color) v3f 0, 255, 0