]> git.lizzy.rs Git - dragonfireclient.git/commitdiff
New Cheat Philosophy
authorElias Fleckenstein <eliasfleckenstein@web.de>
Fri, 11 Dec 2020 16:11:22 +0000 (17:11 +0100)
committerElias Fleckenstein <eliasfleckenstein@web.de>
Fri, 11 Dec 2020 16:11:22 +0000 (17:11 +0100)
15 files changed:
builtin/client/chatcommands.lua
builtin/client/cheats.lua [new file with mode: 0644]
builtin/client/cheats/chat.lua [deleted file]
builtin/client/cheats/combat.lua [deleted file]
builtin/client/cheats/init.lua [deleted file]
builtin/client/cheats/inventory.lua [deleted file]
builtin/client/cheats/movement.lua [deleted file]
builtin/client/cheats/player.lua [deleted file]
builtin/client/cheats/render.lua [deleted file]
builtin/client/cheats/world.lua [deleted file]
builtin/client/death_formspec.lua [new file with mode: 0644]
builtin/client/init.lua
doc/lua_api.txt
src/client/clientenvironment.cpp
src/defaultsettings.cpp

index a45a76dfedde417b9657b057b4ad18f1924c96bb..fc6ed5b2bfdecf008c51c188a2b03bc571f19dad 100644 (file)
@@ -66,19 +66,6 @@ core.register_chatcommand("teleport", {
        end,
 })
 
-core.register_chatcommand("teleportjump", {
-       params = "<X>,<Y>,<Z>",
-       description = "Teleport to relative coordinates.",
-       func = function(param)
-               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,
-})
-
 core.register_chatcommand("wielded", {
        description = "Print itemstring of wieleded item",
        func = function()
@@ -174,7 +161,7 @@ core.register_chatcommand("setyaw", {
                        core.localplayer:set_yaw(yaw)
                        return true
                else
-                       return false, "Invalid usage (See /help setyaw)"
+                       return false, "Invalid usage (See .help setyaw)"
                end
        end
 })
@@ -188,7 +175,10 @@ core.register_chatcommand("setpitch", {
                        core.localplayer:set_pitch(pitch)
                        return true
                else
-                       return false, "Invalid usage (See /help setpitch)"
+                       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 (file)
index 0000000..42f7abb
--- /dev/null
@@ -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/cheats/chat.lua b/builtin/client/cheats/chat.lua
deleted file mode 100644 (file)
index 0763909..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-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
deleted file mode 100644 (file)
index 4b753ea..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-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.dig 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.place 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
deleted file mode 100644 (file)
index 3dc8490..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-core.cheats = {
-       ["Combat"] = {
-               ["Killaura"] = "killaura",
-               ["Forcefield"] = "forcefield",
-               ["AntiKnockback"] = "antiknockback",
-               ["FastHit"] = "spamclick",
-               ["AttachmentFloat"] = "float_above_parent",
-               ["CrystalPvP"] = "crystal_pvp",
-               ["AutoTotem"] = "autototem",
-               ["ThroughWalls"] = "dont_point_nodes",
-               ["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",
-               ["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",
-               ["NoWeather"] = "noweather",
-       },
-       ["World"] = {
-               ["FastDig"] = "fastdig",
-               ["FastPlace"] = "fastplace",
-               ["AutoDig"] = "autodig",
-               ["AutoPlace"] = "autoplace",
-               ["InstantBreak"] = "instant_break",
-               ["Scaffold"] = "scaffold",
-               ["ScaffoldPlus"] = "scaffold_plus",
-               ["BlockWater"] = "block_water",
-               ["BlockLava"] = "block_lava",
-               ["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,
-               ["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
deleted file mode 100644 (file)
index 024bc5e..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-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().place 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
-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
-
-local function find_best_tool(nodename)
-       local player = core.localplayer
-       local inventory = core.get_inventory("current_player")
-       local node_groups = core.get_node_def(nodename).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 ipairs(inventory.main) do
-               is_better, best_time = check_tool(stack, node_groups, best_time)
-               if is_better then
-                       new_index = index
-               end
-       end
-       return new_index
-end
-
-function core.select_best_tool(nodename)
-       core.localplayer:set_wield_index(find_best_tool(nodename))
-end
-
-local new_index, old_index, pointed_pos
-
-core.register_on_punchnode(function(pos, node)
-       if core.settings:get_bool("autotool") then
-               pointed_pos = pos
-               old_index = old_index or core.localplayer:get_wield_index()
-               new_index = find_best_tool(node.name)
-       end
-end)
-
-core.register_globalstep(function()
-       local player = core.localplayer
-       if not new_index then return end
-       if core.settings:get_bool("autotool") then
-               local pt = core.get_pointed_thing()
-               if pt and pt.type == "node" and vector.equals(core.get_pointed_thing_position(pt), pointed_pos) and player:get_control().dig then
-                       player:set_wield_index(new_index)
-                       return
-               end
-       end
-       player:set_wield_index(old_index)
-       new_index, old_index, pointed_pos = nil
-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()
-       core.show_formspec("__builtin__:hand", hand_formspec)
-end
-
-
-
diff --git a/builtin/client/cheats/movement.lua b/builtin/client/cheats/movement.lua
deleted file mode 100644 (file)
index 33a46fc..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-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
deleted file mode 100644 (file)
index 499ed47..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-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
deleted file mode 100644 (file)
index dc3f712..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-core.register_list_command("xray", "Configure X-Ray", "xray_nodes") 
-core.register_list_command("search", "Configure NodeESP", "node_esp_nodes") 
-
-core.register_on_spawn_particle(function(particle)
-       if core.settings:get_bool("noweather") and particle.texture:sub(1, 12) == "weather_pack" then
-               return true
-       end
-end)
-
-core.register_on_play_sound(function(sound)
-       if core.settings:get_bool("noweather") and sound.name == "weather_rain" then
-               return true
-       end
-end)
diff --git a/builtin/client/cheats/world.lua b/builtin/client/cheats/world.lua
deleted file mode 100644 (file)
index df44617..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-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
-               end
-               if 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
-               end
-               if 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
-               end
-               if core.settings:get_bool("block_lava") then
-                       local positions = core.find_nodes_near(pos, 5, {"mcl_core:lava_source", "mcl_core:lava_floating"}, true)
-                       for i, p in pairs(positions) do
-                               if i > nodes_per_tick then return end
-                               core.place_node(p)
-                       end
-               end
-               if 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 - 4, pos.x + 4 do
-                       for y = pos.y - 4, pos.y + 4 do
-                               for z = pos.z - 4, pos.z + 4 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
new file mode 100644 (file)
index 0000000..499ed47
--- /dev/null
@@ -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
+})
index 40acf3b9bb607748469ac791a62c35ae7bceb32a..8c6512ec1b576b77c7595ff1e1e10151d3ce2405 100644 (file)
@@ -9,5 +9,6 @@ dofile(commonpath .. "chatcommands.lua")
 dofile(commonpath .. "vector.lua")
 dofile(clientpath .. "util.lua")
 dofile(clientpath .. "chatcommands.lua")
-dofile(clientpath .. "cheats"..DIR_DELIM.."init.lua")
+dofile(clientpath .. "death_formspec.lua")
+dofile(clientpath .. "cheats.lua")
 
index 0fe5240354d20e6f69f6c3a9643a00eb19f17f0d..adaaf61801729bbdbd953be6875956552851b4ee 100644 (file)
@@ -5549,72 +5549,28 @@ Schematics
 
 HTTP Requests
 -------------
-* `minetest.get_http_api()`
-    * returns `HTTPApiTable` containing http functions.
-    * The returned table contains the functions `fetch_sync`, `fetch_async` and
+
+* `minetest.request_http_api()`:
+    * returns `HTTPApiTable` containing http functions if the calling mod has
+      been granted access by being listed in the `secure.http_mods` or
+      `secure.trusted_mods` setting, otherwise returns `nil`.
+    * The returned table contains the functions `fetch`, `fetch_async` and
       `fetch_async_get` described below.
+    * Only works at init time and must be called from the mod's main scope
+      (not from a function).
     * Function only exists if minetest server was built with cURL support.
-* `HTTPApiTable.fetch_sync(HTTPRequest req)`: returns HTTPRequestResult
-    * Performs given request synchronously
+    * **DO NOT ALLOW ANY OTHER MODS TO ACCESS THE RETURNED TABLE, STORE IT IN
+      A LOCAL VARIABLE!**
+* `HTTPApiTable.fetch(HTTPRequest req, callback)`
+    * Performs given request asynchronously and calls callback upon completion
+    * callback: `function(HTTPRequestResult res)`
+    * Use this HTTP function if you are unsure, the others are for advanced use
 * `HTTPApiTable.fetch_async(HTTPRequest req)`: returns handle
     * Performs given request asynchronously and returns handle for
       `HTTPApiTable.fetch_async_get`
 * `HTTPApiTable.fetch_async_get(handle)`: returns HTTPRequestResult
     * Return response data for given asynchronous HTTP request
 
-### `HTTPRequest` definition
-
-Used by `HTTPApiTable.fetch` and `HTTPApiTable.fetch_async`.
-
-    {
-        url = "http://example.org",
-
-        timeout = 10,
-        -- Timeout for connection in seconds. Default is 3 seconds.
-
-        post_data = "Raw POST request data string" OR {field1 = "data1", field2 = "data2"},
-        -- Optional, if specified a POST request with post_data is performed.
-        -- Accepts both a string and a table. If a table is specified, encodes
-        -- table as x-www-form-urlencoded key-value pairs.
-        -- If post_data is not specified, a GET request is performed instead.
-
-        user_agent = "ExampleUserAgent",
-        -- Optional, if specified replaces the default minetest user agent with
-        -- given string
-
-        extra_headers = { "Accept-Language: en-us", "Accept-Charset: utf-8" },
-        -- Optional, if specified adds additional headers to the HTTP request.
-        -- You must make sure that the header strings follow HTTP specification
-        -- ("Key: Value").
-
-        multipart = boolean
-        -- Optional, if true performs a multipart HTTP request.
-        -- Default is false.
-    }
-
-### `HTTPRequestResult` definition
-
-Passed to `HTTPApiTable.fetch` callback. Returned by
-`HTTPApiTable.fetch_async_get`.
-
-    {
-        completed = true,
-        -- If true, the request has finished (either succeeded, failed or timed
-        -- out)
-
-        succeeded = true,
-        -- If true, the request was successful
-
-        timeout = false,
-        -- If true, the request timed out
-
-        code = 200,
-        -- HTTP status code
-
-        data = "response"
-    }
-
-
 Storage API
 -----------
 
index be2b358c5e52bed046ac5887bb81a1b978308049..7ac9cd2d4fb5eff98cf4642cfbfc995c0b0d0d99 100644 (file)
@@ -349,8 +349,6 @@ u16 ClientEnvironment::addActiveObject(ClientActiveObject *object)
 {
        GenericCAO *gcao = dynamic_cast<GenericCAO *>(object);
        aabb3f box;
-       if (gcao && g_settings->getBool("noobject") && ! gcao->getSelectionBox(&box) && ! gcao->getParent())
-               return 0;
 
        // Register object. If failed return zero id
        if (!m_ao_manager.registerObject(object))
index ef6a6482dddd2fbe4aadadb4c0e105b111456599..e1cee9a485c194c806fc3f78268d384e50567a94 100644 (file)
@@ -98,43 +98,13 @@ void set_default_settings(Settings *settings)
        settings->setDefault("no_night", "false");
        settings->setDefault("coords", "false");
        settings->setDefault("point_liquids", "false");
-       settings->setDefault("log_particles", "false");
        settings->setDefault("spamclick", "false");
        settings->setDefault("no_force_rotate", "false");
        settings->setDefault("no_slow", "false");
        settings->setDefault("float_above_parent", "false");
-       settings->setDefault("ignore_status_messages", "true");
-       settings->setDefault("mark_deathmessages", "true");
-       settings->setDefault("autosneak", "false");
-       settings->setDefault("autoeject", "false");
-       settings->setDefault("eject_items", "");
-       settings->setDefault("autotool", "false");
-       settings->setDefault("autorespawn", "false");
-       settings->setDefault("scaffold", "false");
-       settings->setDefault("scaffold_plus", "false");
-       settings->setDefault("block_water", "false");
-       settings->setDefault("autotnt", "false");
-       settings->setDefault("replace", "false");
-       settings->setDefault("crystal_pvp", "false");
-       settings->setDefault("autototem", "false");
        settings->setDefault("dont_point_nodes", "false");
-       settings->setDefault("strip", "false");
-       settings->setDefault("autorefill", "false");
-       settings->setDefault("nuke", "false");
-       settings->setDefault("chat_color", "rainbow");
-       settings->setDefault("use_chat_color", "false");
-       settings->setDefault("chat_reverse", "false");
-       settings->setDefault("forcefield", "false");
-       settings->setDefault("friendlist", "");
        settings->setDefault("cheat_hud", "true");
        settings->setDefault("node_esp_nodes", "");
-       settings->setDefault("autosprint", "false");
-       settings->setDefault("override_speed", "false");
-       settings->setDefault("override_jump", "false");
-       settings->setDefault("override_gravity", "false");
-       settings->setDefault("override_speed_factor", "1.2");
-       settings->setDefault("override_jump_factor", "2.0");
-       settings->setDefault("override_gravity_factor", "0.9");
        settings->setDefault("jetpack", "false");
        settings->setDefault("autohit", "false");
        settings->setDefault("antislip", "false");
@@ -146,8 +116,7 @@ void set_default_settings(Settings *settings)
        settings->setDefault("enable_node_tracers", "false");
        settings->setDefault("entity_esp_color", "(255, 255, 255)");
        settings->setDefault("player_esp_color", "(0, 255, 0)");        
-       settings->setDefault("noweather", "false");     
-       settings->setDefault("noobject", "false");      
+       settings->setDefault("scaffold", "false");                                                      // For now      
 
        // Keymap
        settings->setDefault("remote_port", "30000");