!/mods/minetest/mods_here.txt
/worlds
/world/
-/clientmods/custom
-!/clientmods/preview/
/client/mod_storage/
## Configuration/log files
-- Minetest: builtin/client/chatcommands.lua
-
core.register_on_sending_chat_message(function(message)
if message:sub(1,2) == ".." then
return false
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
+
+
+++ /dev/null
--- 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
-})
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")
+++ /dev/null
-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] = core.localplayer:get_pos()[k]
- 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
--- /dev/null
+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")
[Cheats]
-fullbright (Enable fullbright) bool false
+fullbright (Fullbright) bool false
-xray (Enable xray, requires fullbright) bool false
+# Enable xray, requires fullbright
+xray (Xray) bool false
-xray_node (Texture to apply xray) string default:stone
+# Texture to apply xray
+xray_node (XrayTexture) string default:stone
-priv_bypass (Make the Client think it has all privs) bool true
+# Make the Client think it has all privs
+priv_bypass (PrivBypass) bool true
-fastdig (Fast Dig) bool false
+fastdig (FastDig) bool false
-prevent_natural_damage (Prevent Fall Damage) bool true
+prevent_natural_damage (NoFallDamage) bool true
-freecam (Move around freely) bool false
+freecam (Freecam) bool false
-killaura (Enable Killaura) bool false
+killaura (Killaura) bool false
-no_hurt_cam (No Hurt Cam) bool false
+no_hurt_cam (NoHurtCam) bool false
-increase_tool_range (Increase Tool Range) bool true
+increase_tool_range (Range) bool true
-hud_flags_bypass (Enable HUD Flags Bypass) bool true
+# HUD Flags Bypass
+hud_flags_bypass (HUDBypass) bool true
-antiknockback (Anti Knockback) bool false
+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
+++ /dev/null
-local function loop()
- local item = minetest.get_wielded_item():get_name()
- local pos = minetest.find_node_near(minetest.localplayer:get_pos(), 5, "mcl_farming:wheat", true)
- if item == "mcl_farming:wheat_seeds" and pos then
- minetest.dig_node(pos)
- minetest.place_node(pos)
- end
- minetest.after(0.1, loop)
-end
-
-minetest.register_on_connect(loop)
+++ /dev/null
-buildbot = {}
-
-local function build_y(callback)
- buildbot.pos.y = buildbot.pos.y - buildbot.step.y
- local function step()
- buildbot.pos.y = buildbot.pos.y + buildbot.step.y
- minetest.after(0.25, (buildbot.pos.y == buildbot.goal.y) and callback or step)
- minetest.place_node(buildbot.pos)
- local player_pos = minetest.find_node_near(buildbot.pos, 2, "air")
- if player_pos then
- minetest.localplayer:set_pos(player_pos)
- end
- end
- minetest.after(0.25, step)
-end
-
-local function build_z(callback)
- buildbot.pos.z = buildbot.pos.z - buildbot.step.z
- local function step()
- buildbot.start.y, buildbot.goal.y = buildbot.goal.y, buildbot.start.y
- buildbot.step.y = (buildbot.goal.y > buildbot.pos.y) and 1 or -1
- buildbot.pos.z = buildbot.pos.z + buildbot.step.z
- build_y((buildbot.pos.z == buildbot.goal.z) and callback or step)
- end
- minetest.after(0.25, step)
-end
-
-local function build_x(callback)
- buildbot.pos.x = buildbot.pos.x - buildbot.step.x
- local function step()
- buildbot.start.z, buildbot.goal.z = buildbot.goal.z, buildbot.start.z
- buildbot.step.z = (buildbot.goal.z > buildbot.pos.z) and 1 or -1
- buildbot.pos.x = buildbot.pos.x + buildbot.step.x
- build_z((buildbot.pos.x == buildbot.goal.x) and callback or step)
- end
- minetest.after(0.25, step)
-end
-
-minetest.register_chatcommand("build", {
- func = function(param)
- local sucess
- buildbot.start = vector.round(minetest.localplayer:get_pos())
- buildbot.pos = vector.new(buildbot.start)
- success, buildbot.goal = minetest.parse_pos(param)
- if success then
- buildbot.step = {}
- buildbot.step.x = (buildbot.goal.x > buildbot.start.x) and 1 or -1
- buildbot.start.z, buildbot.goal.z = buildbot.goal.z, buildbot.start.z
- buildbot.start.y, buildbot.goal.y = buildbot.goal.y, buildbot.start.y
- build_x(function() minetest.display_chat_message("Done.") end)
- end
- return false, buildbot.goal
- end
-})
-
-local keep_digging = false
-
-core.register_chatcommand("keepdigging", {
- params = "<X>,<Y>,<Z>",
- description = "Dig node again and again",
- func = function(param)
- local success, pos = core.parse_pos(param)
- if success then
- keep_digging = true
- local function loop()
- core.dig_node(pos)
- if keep_digging then
- core.after(0.1, loop)
- end
- end
- loop()
- end
- end,
-})
-
-core.register_chatcommand("stopdigging", {
- description = "Stop diggin",
- func = function()
- keep_digging = false
- end,
-})
-
-
-core.register_chatcommand("digaround", {
- description = "Automatically dig nodes around you",
- param = "<node1> [<node2>] ...",
- func = function(param)
- local nodes = param:split(" ")
- local function loop()
- local fpos = core.find_node_near(core.localplayer:get_pos(), 5, nodes, true)
- if fpos then core.dig_node(fpos) end
- core.after(0, loop)
- end
- loop()
- end,
-})
--- /dev/null
+MIT License
+
+Copyright (c) 2018 red-001
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
--- /dev/null
+local modstorage = minetest.get_mod_storage()
+
+local register_on_message = minetest.register_on_sending_chat_message
+if minetest.register_on_sending_chat_messages then
+ register_on_message = minetest.register_on_sending_chat_messages
+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
+
+register_on_message(function(message)
+ if message:sub(1,1) == "/" or modstorage:get_string("color") == "" or modstorage:get_string("color") == "white" then
+ return false
+ end
+
+ minetest.send_chat_message(minetest.get_color_escape_sequence(modstorage:get_string("color")) .. message)
+ return true
+end)
+
+minetest.register_chatcommand("set_color", {
+ description = minetest.gettext("Change chat color"),
+ func = function(colour)
+ modstorage:set_string("color", colour)
+ return true, "Chat color changed."
+ end,
+})
+
+minetest.register_chatcommand("rainbow", {
+ description = minetest.gettext("rainbow text"),
+ func = function(param)
+ local step = 360 / param:len()
+ local hue = 0
+ -- iterate the whole 360 degrees
+ local output = ""
+ for i = 1, param:len() do
+ local char = param:sub(i,i)
+ if char:match("%s") then
+ output = output .. char
+ else
+ output = output .. minetest.get_color_escape_sequence(color_from_hue(hue)) .. char
+ end
+ hue = hue + step
+ end
+ minetest.send_chat_message(output)
+ return true
+end,
+})
+
--- /dev/null
+name = colorchat
+author = red-001, Fleckenstein
+description = A minetest CSM mod for changing the color of text sent to the server.
+++ /dev/null
-MIT License
-
-Copyright (c) 2018 red-001
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
+++ /dev/null
-# colour_chat
-A minetest CSM mod for changing the colour of text sent to the server.
-
-### Usage
-Use .set_colour to set the colour of chat sent to the server, you can use either HTML named colours or HTML hexdecimal colour codes. Use .rainbow to generate rainbow text
+++ /dev/null
-local modstorage = core.get_mod_storage()
-
-local register_on_message = core.register_on_sending_chat_message
-if core.register_on_sending_chat_messages then
- register_on_message = core.register_on_sending_chat_messages
-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
-
-local function canTalk()
- if core.get_privilege_list then
- return core.get_privilege_list().shout
- else
- return true
- end
-end
-
-local function say(message)
- if not canTalk() then
- minetest.display_chat_message("You need 'shout' in order to talk")
- return
- end
- minetest.send_chat_message(message)
- if minetest.get_server_info().protocol_version < 29 then
- local name = minetest.localplayer:get_name()
- minetest.display_chat_message("<"..name.."> " .. message)
- end
-end
-
-register_on_message(function(message)
- if message:sub(1,1) == "/" or modstorage:get_string("colour") == "" or modstorage:get_string("colour") == "white" then
- return false
- end
-
- say(core.get_color_escape_sequence(modstorage:get_string("colour")) .. message)
- return true
-end)
-
-core.register_chatcommand("set_colour", {
- description = core.gettext("Change chat colour"),
- func = function(colour)
- modstorage:set_string("colour", colour)
- return true, "Chat colour changed."
- end,
-})
-
-core.register_chatcommand("rainbow", {
- description = core.gettext("rainbow text"),
- func = function(param)
- if not canTalk() then
- return false, "You need 'shout' in order to use this command"
- end
- local step = 360 / param:len()
- local hue = 0
- -- iterate the whole 360 degrees
- local output = ""
- for i = 1, param:len() do
- local char = param: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
- say(output)
- return true
-end,
-})
-
-core.register_chatcommand("say", {
- description = core.gettext("Send text without applying colour to it"),
- func = function(text)
- say(text)
- return true
- end,
-})
-core.register_chatcommand("place", {
- params = "<X>,<Y>,<Z>",
- description = "Place wielded item",
- func = function(param)
- local success, pos = core.parse_pos(param)
- if success then
- core.place_node(pos)
- return true, "Node placed at " .. core.pos_to_string(pos)
- end
- return false, pos
+minetest.register_chatcommand("say", {
+ description = "Send raw text",
+ func = function(text)
+ minetest.send_chat_message(text)
+ return true
end,
})
-core.register_chatcommand("dig", {
+minetest.register_chatcommand("teleport", {
params = "<X>,<Y>,<Z>",
- description = "Dig node",
+ description = "Teleport to position. " .. (core.anticheat_protection and "Only works for short distances." or ""),
func = function(param)
local success, pos = core.parse_pos(param)
if success then
- core.dig_node(pos)
- return true, "Node at " .. core.pos_to_string(pos) .. " dug"
+ core.localplayer:set_pos(pos)
+ return true, "Teleporting to " .. core.pos_to_string(pos)
end
return false, pos
end,
})
-core.register_chatcommand("kill", {
- description = "Kill yourself",
- func = function(param)
- core.send_damage(core.localplayer:get_hp())
- end,
+minetest.register_chatcommand("wielded", {
+ description = "Print itemstring of wieleded item",
+ func = function()
+ return true, minetest.get_wielded_item():get_name()
+ end
})
-core.register_chatcommand("scan", {
- description = "Scan for one or multible nodes in a radius around you",
- param = "<radius> node1[,node2...]",
+minetest.register_chatcommand("disconnect", {
+ description = "Exit to main menu",
func = function(param)
- local radius = tonumber(param:split(" ")[1])
- local nodes = param:split(" ")[2]:split(",")
- local pos = core.localplayer:get_pos()
- local fpos = core.find_node_near(pos, radius, nodes, true)
- if fpos then
- return true, "Found " .. table.concat(nodes, " or ") .. " at " .. core.pos_to_string(fpos)
- end
- return false, "None of " .. table.concat(nodes, " or ") .. " found in a radius of " .. tostring(radius)
+ minetest.disconnect()
end,
})
-local function teleport(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)
+minetest.register_chatcommand("players", {
+ description = "List online players",
+ func = function(param)
+ return true, "Online players: " .. table.concat(minetest.get_player_names(), ", ")
end
- return false, pos
-end
+})
-core.register_chatcommand("teleport", {
- params = "<X>,<Y>,<Z>",
- description = "Teleport to position",
- func = function(param)
- return teleport(param)
+minetest.register_chatcommand("kill", {
+ description = "Kill yourself",
+ func = function()
+ minetest.send_damage(minetest.localplayer:get_hp())
end,
})
-core.register_chatcommand("tpoff", {
- params = "<X>,<Y>,<Z>",
- description = "Teleport to position and log out immediately",
+minetest.register_chatcommand("set", {
+ params = "([-n] <name> <value>) | <name>",
+ description = "Set or read client configuration setting",
func = function(param)
- teleport(param)
- minetest.disconnect()
- end,
-})
+ local arg, setname, setvalue = string.match(param, "(-[n]) ([^ ]+) (.+)")
+ if arg and arg == "-n" and setname and setvalue then
+ minetest.settings:set(setname, setvalue)
+ return true, setname .. " = " .. setvalue
+ end
-minetest.register_chatcommand("wielded", {
- description = "Print itemstring of wieleded item",
- func = function()
- return true, minetest.get_wielded_item():get_name()
- end
+ setname, setvalue = string.match(param, "([^ ]+) (.+)")
+ if setname and setvalue then
+ if not minetest.settings:get(setname) then
+ return false, "Failed. Use '.set -n <name> <value>' to create a new setting."
+ end
+ minetest.settings:set(setname, setvalue)
+ return true, setname .. " = " .. setvalue
+ end
+
+ setname = string.match(param, "([^ ]+)")
+ if setname then
+ setvalue = minetest.settings:get(setname)
+ if not setvalue then
+ setvalue = "<not set>"
+ end
+ return true, setname .. " = " .. setvalue
+ end
+
+ return false, "Invalid parameters (see .help set)."
+ end,
})
+
--- /dev/null
+name = commands
+author = Fleckenstein
+description = Misc cheat commands
+++ /dev/null
-minetest.override_item("air", {liquids_pointable = true})
-local destroy_water = false
-
-local function loop()
- if destroy_water then
- local pos = minetest.find_node_near(minetest.localplayer:get_pos(), 5, "mcl_core:water_source", true)
- if pos then
- minetest.place_node(pos)
- end
- end
- minetest.after(0, loop)
-end
-
-minetest.after(1, loop)
-
-minetest.register_chatcommand("destroywater", {
- param = "true|false",
- description = "Turn destroy water on/off",
- func = function(param)
- destroy_water = minetest.is_yes(param)
- end
-})
+++ /dev/null
-
-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 formspec_ender_chest = "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]"
-
-minetest.register_chatcommand("echest", {
- func = function()
- minetest.show_formspec("echest:enderchest", formspec_ender_chest)
- end
-})
--- /dev/null
+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 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 minetest.show_extra_inventory()
+ minetest.show_formspec("enderchest:enderchest", formspec)
+end
--- /dev/null
+name = enderchest
+author = Fleckenstein
+description = You can use this mod in MineClone2 to view you Enderinventory without an Ender Chest.
--- /dev/null
+mapbot.bots = {}
+
+mapbot.paramtypes = {
+ ["pos"] = {
+ "<X>,<Y>,<Z>",
+ function (param)
+ local _, pos = minetest.parse_relative_pos(param)
+ return pos
+ end
+ },
+ ["nodes"] = {
+ "<node1> [<node2>] ...",
+ function (param)
+ return param:split(" ")
+ end
+ },
+}
+
+function mapbot.register_bot(name, description, paramtype, func)
+ local pt = mapbot.paramtypes[paramtype]
+ if not pt then return end
+ minetest.register_chatcommand(name, {
+ param = pt[1],
+ description = description .. " Empty parameter to stop.",
+ func = function(param)
+ mapbot.storage:set_string(name, param)
+ return true, "Changed " .. name .. " config."
+ end
+ })
+ table.insert(mapbot.bots, {name, pt, func})
+end
+
+function mapbot.loop()
+ for _, bot in pairs(mapbot.bots) do
+ local param = mapbot.storage:get_string(bot[1])
+ param = (param == "") and nil or bot[2][2](param)
+ if param and bot[3](param) end
+ end
+end
+
+minetest.register_on_connect(mapbot.loop)
--- /dev/null
+mapbot = {}
+
+local modname = minetest.get_modname()
+local modpath = minetest.get_modpath(modname)
+mapbot.storage = minetest.get_mod_storage()
+
+dofile(modpath .. "/api.lua")
+dofile(modpath .. "/simple_bots.lua")
+
+
--- /dev/null
+name = misc
+author = Fleckenstein
+description = An API to create simple bots, optimized for map interaction
--- /dev/null
+mapbot.register_bot("place_into", "Automatically place wielditem into specified nodes.", "nodes", function(nodes)
+ local pos = minetest.find_node_near(minetest.localplayer:get_pos(), 5, nodes, true)
+ if pos then
+ minetest.place_node(pos)
+ end
+end)
+
+mapbot.register_bot("dig_nodes", "Automatically dig specified nodes.", "nodes", function(nodes)
+ local pos = minetest.find_node_near(minetest.localplayer:get_pos(), 5, nodes, true)
+ if pos then
+ minetest.dig_node(pos)
+ end
+end)
+
+mapbot.register_bot("place_into_pos", "Automatically place wielditem at specified pos.", "pos", minetest.place_node)
+
+mapbot.register_bot("dig_pos", "Automatically dig node at specified pos.", "pos", minetest.dig_node)
+
+mapbot.register_bot("dig_place_nodes", "Automatically dig specified nodes and immediately place wielditem there.", "nodes", function (nodes)
+ local pos = minetest.find_node_near(minetest.localplayer:get_pos(), 5, nodes, true)
+ if pos then
+ minetest.dig_node(pos)
+ minetest.place_node(pos)
+ end
+end)
+
+mapbot.register_bot("dig_place_pos", "Automatically dig node at specified pos and immediately place wielditem there.", "pos", function (pos)
+ minetest.dig_node(pos)
+ minetest.place_node(pos)
+end)
--- /dev/null
+local build = {}
+
+local function build_y(callback)
+ build.pos.y = build.pos.y - build.step.y
+ local function step()
+ build.pos.y = build.pos.y + build.step.y
+ minetest.after(0.25, (build.pos.y == build.goal.y) and callback or step)
+ minetest.place_node(build.pos)
+ local player_pos = minetest.find_node_near(build.pos, 2, "air")
+ if player_pos then
+ minetest.localplayer:set_pos(player_pos)
+ end
+ end
+ minetest.after(0.25, step)
+end
+
+local function build_z(callback)
+ build.pos.z = build.pos.z - build.step.z
+ local function step()
+ build.start.y, build.goal.y = build.goal.y, build.start.y
+ build.step.y = (build.goal.y > build.pos.y) and 1 or -1
+ build.pos.z = build.pos.z + build.step.z
+ build_y((build.pos.z == build.goal.z) and callback or step)
+ end
+ minetest.after(0.25, step)
+end
+
+local function build_x(callback)
+ build.pos.x = build.pos.x - build.step.x
+ local function step()
+ build.start.z, build.goal.z = build.goal.z, build.start.z
+ build.step.z = (build.goal.z > build.pos.z) and 1 or -1
+ build.pos.x = build.pos.x + build.step.x
+ build_z((build.pos.x == build.goal.x) and callback or step)
+ end
+ minetest.after(0.25, step)
+end
+
+minetest.register_chatcommand("build", {
+ func = function(param)
+ local sucess
+ build.start = vector.round(minetest.localplayer:get_pos())
+ build.pos = vector.new(build.start)
+ success, build.goal = minetest.parse_relative_pos(param)
+ if success then
+ build.step = {}
+ build.step.x = (build.goal.x > build.start.x) and 1 or -1
+ build.start.z, build.goal.z = build.goal.z, build.start.z
+ build.start.y, build.goal.y = build.goal.y, build.start.y
+ build_x(function() minetest.display_chat_message("Done.") end)
+ end
+ return false, build.goal
+ end
+})
+
+
+
--- /dev/null
+minetest.register_chatcommand("findnodes", {
+ description = "Scan for one or multible nodes in a radius around you",
+ param = "<radius> <node1>[,<node2>...]",
+ func = function(param)
+ local radius = tonumber(param:split(" ")[1])
+ local nodes = param:split(" ")[2]:split(",")
+ local pos = core.localplayer:get_pos()
+ local fpos = core.find_node_near(pos, radius, nodes, true)
+ if fpos then
+ return true, "Found " .. table.concat(nodes, " or ") .. " at " .. core.pos_to_string(fpos)
+ end
+ return false, "None of " .. table.concat(nodes, " or ") .. " found in a radius of " .. tostring(radius)
+ end,
+})
+
+minetest.register_chatcommand("place", {
+ params = "<X>,<Y>,<Z>",
+ description = "Place wielded item",
+ func = function(param)
+ local success, pos = minetest.parse_relative_pos(param)
+ if success then
+ minetest.place_node(pos)
+ return true, "Node placed at " .. minetest.pos_to_string(pos)
+ end
+ return false, pos
+ end,
+})
+
+minetest.register_chatcommand("dig", {
+ params = "<X>,<Y>,<Z>",
+ description = "Dig node",
+ func = function(param)
+ local success, pos = minetest.parse_relative_pos(param)
+ if success then
+ minetest.dig_node(pos)
+ return true, "Node at " .. minetest.pos_to_string(pos) .. " dug"
+ end
+ return false, pos
+ end,
+})
+
+
--- /dev/null
+local modname = minetest.get_current_modname()
+local modpath = minetest.get_modpath(modname)
+
+dofile(modpath .. "/commands.lua")
+dofile(modpath .. "/buildbot.lua")
--- /dev/null
+name = maputil
+author = Fleckenstein
+description = Includes commands and a advanced bot for map interaction
--- /dev/null
+minetest.override_item("air", {liquids_pointable = true})
+
--- /dev/null
+name = misc
+author = Fleckenstein
+description = Misc cheats
+++ /dev/null
-load_mod_set = true
-load_mod_buildbot = true
-load_mod_colour_chat = true
-load_mod_custom = true
-load_mod_echest = true
-load_mod_commands = true
-load_mod_test = false
-load_mod_destroyliquids = true
-load_mod_autofarm = false
--- /dev/null
+local warp = warp or {set_here = function() return false end}
+
+local 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]"
+
+minetest.register_on_death(function()
+ local warp_success, warp_msg = warp.set_here("death")
+ if warp_success then
+ minetest.display_chat_message(warp_msg)
+ else
+ minetest.display_chat_message("You died at " .. minetest.pos_to_string(minetest.localplayer:get_pos()) .. ".")
+ end
+ if minetest.settings:get_bool("autorespawn") then
+ minetest.send_respawn()
+ else
+ minetest.show_formspec("respawn:death", formspec)
+end)
+
+minetest.register_on_formspec_input(function(formname, fields)
+ if formname == "respawn:death" then
+ if fields.btn_ghost_mode then
+ minetest.display_chat_message("You are in ghost mode. Use .respawn to Respawn.")
+ else
+ minetest.send_respawn()
+ end
+ end
+end)
+
+minetest.register_chatcommand("respawn", {
+ description = "Respawn when in ghost mode",
+ func = function()
+ if minetest.localplayer:get_hp() == 0 then
+ minetest.send_respawn()
+ minetest.display_chat_message("Respawned.")
+ else
+ minetest.display_chat_message("You are not in ghost mode.")
+ end
+ end
+})
--- /dev/null
+name = respawn
+author = Fleckenstein
+description = Extended respawn behaviour
+optional_depends = warp
+++ /dev/null
-core.register_chatcommand("set", {
- params = "([-n] <name> <value>) | <name>",
- description = "Set or read client configuration setting",
- privs = {server=true},
- 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,
-})
-
+++ /dev/null
-minetest.override_item("air", {liquids_pointable = true})
--- /dev/null
+warp = {}
+
+local storage = minetest.get_mod_storage()
+
+function warp.set(warp, pos)
+ if warp == "" or not pos then return false, "Missing parameter." end
+ local posstr = minetest.pos_to_string(pos)
+ storage:set_string(warp, posstr)
+ return true, "Warp " .. warp .. " set to " .. posstr .. "."
+end
+
+function warp.set_here(param)
+ local success, message = warp.set(param, vector.round(minetest.localplayer:get_pos()))
+ return success, message
+end
+
+function warp.get(param)
+ if param == "" then return false, "Missing parameter." end
+ local pos = storage:get_string(param)
+ if pos == "" then return false, "Warp " .. param .. " not set." end
+ return true, "Warp " .. param .. " is set to " .. pos .. ".", minetest.string_to_pos(pos)
+end
+
+function warp.delete(param)
+ if param == "" then return false, "Missing parameter." end
+ storage:set_string(param, "")
+ return true, "Deleted warp " .. param .. "."
+end
+
+minetest.register_chatcommand("setwarp", {
+ params = "<warp>",
+ description = "Set a warp to your current position.",
+ func = warp.set_here,
+})
+
+minetest.register_chatcommand("readwarp", {
+ params = "<warp>",
+ description = "Print the coordinates of a warp.",
+ func = warp.get,
+})
+
+minetest.register_chatcommand("deletewarp", {
+ params = "<warp>",
+ description = "Delete a warp.",
+ func = warp.delete,
+})
+
+minetest.register_chatcommand("warp", {
+ params = "<pos>|<warp>",
+ description = "Warp to a set warp or a position. " .. (core.anticheat_protection and "You have to be attached for this to work (sitting in a boat or similar) and you will be disconnected and have to rejoin." or ""),
+ func = function(param)
+ if param == "" then return false, "Missing parameter." end
+ local success, pos = minetest.parse_pos(param)
+ if not success then
+ local msg
+ success, msg, pos = warp.get(param)
+ if not success then
+ return false, msg
+ end
+ end
+ minetest.localplayer:set_pos(pos)
+ if core.anticheat_protection then
+ minetest.disconnect()
+ end
+ return true, "Warped to " .. minetest.pos_to_string(pos)
+ end
+})
+
+
--- /dev/null
+name = warp
+author = Fleckenstein
+description = Set custom warps and use the teleport exploit