Prepare for merge

Move builtin cheats to Dragonfire modpack
wsc-master-rebase
cron 2020-12-09 07:06:09 +00:00
parent 8f3061cd89
commit 33a69f694a
10 changed files with 4 additions and 491 deletions

View File

@ -1,12 +1,8 @@
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",
},
@ -17,8 +13,6 @@ core.cheats = {
["AutoJump"] = "autojump",
["Jesus"] = "jesus",
["NoSlow"] = "no_slow",
["AutoSneak"] = "autosneak",
["AutoSprint"] = "autosprint",
["SpeedOverride"] = "override_speed",
["JumpOverride"] = "override_jump",
["GravityOverride"] = "override_gravity",
@ -39,7 +33,6 @@ core.cheats = {
["PlayerTracers"] = "enable_player_tracers",
["NodeESP"] = "enable_node_esp",
["NodeTracers"] = "enable_node_tracers",
["NoWeather"] = "noweather",
},
["World"] = {
["FastDig"] = "fastdig",
@ -47,12 +40,6 @@ core.cheats = {
["AutoDig"] = "autodig",
["AutoPlace"] = "autoplace",
["InstantBreak"] = "instant_break",
["Scaffold"] = "scaffold",
["ScaffoldPlus"] = "scaffold_plus",
["BlockWater"] = "block_water",
["PlaceOnTop"] = "autotnt",
["Replace"] = "replace",
["Nuke"] = "nuke",
},
["Exploit"] = {
["EntitySpeed"] = "entity_speed",
@ -65,35 +52,12 @@ core.cheats = {
["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",
}
["Chat"] = {},
["Inventory"] = {}
}
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")

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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
})

View File

@ -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)

View File

@ -1,74 +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
elseif core.settings:get_bool("scaffold_plus") then
local z = pos.z
local positions = {
{x = 0, y = -0.6, z = 0},
{x = 1, y = -0.6, z = 0},
{x = -1, y = -0.6, z = 0},
{x = -1, y = -0.6, z = -1},
{x = 0, y = -0.6, z = -1},
{x = 1, y = -0.6, z = -1},
{x = -1, y = -0.6, z = 1},
{x = 0, y = -0.6, z = 1},
{x = 1, y = -0.6, z = 1}
}
for i, p in pairs(positions) do
core.place_node(vector.add(pos, p))
end
elseif core.settings:get_bool("block_water") then
local positions = core.find_nodes_near(pos, 5, {"mcl_core:water_source", "mcl_core:water_floating"}, true)
for i, p in pairs(positions) do
if i > nodes_per_tick then return end
core.place_node(p)
end
elseif core.settings:get_bool("autotnt") then
local positions = core.find_nodes_near_under_air_except(pos, 5, item:get_name(), true)
for i, p in pairs(positions) do
if i > nodes_per_tick then return end
core.place_node(vector.add(p, {x = 0, y = 1, z = 0}))
end
end
end
if core.settings:get_bool("nuke") then
local i = 0
for x = pos.x - 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)

View File

@ -9,5 +9,5 @@ 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 .. "cheats.lua")

View File

@ -413,7 +413,7 @@ void set_default_settings(Settings *settings)
settings->setDefault("chat_font_size", "0"); // Default "font_size"
// ContentDB
settings->setDefault("contentdb_url", "http://cheatdb.elidragon.com");
settings->setDefault("contentdb_url", "127.0.0.1"); // http://cheatdb.elidragon.com in DF
settings->setDefault("contentdb_max_concurrent_downloads", "3");
#ifdef __ANDROID__