UI Update; Added AutoTool
This commit is contained in:
parent
622d547262
commit
3bed0981d0
@ -20,6 +20,7 @@ core.cheats = {
|
||||
["NoHurtCam"] = "no_hurt_cam",
|
||||
["BrightNight"] = "no_night",
|
||||
["Coords"] = "coords",
|
||||
["Clouds"] = "enable_clouds",
|
||||
},
|
||||
["World"] = {
|
||||
["FastDig"] = "fastdig",
|
||||
@ -31,11 +32,6 @@ core.cheats = {
|
||||
["UnlimitedRange"] = "increase_tool_range_plus",
|
||||
["PointLiquids"] = "point_liquids",
|
||||
},
|
||||
["Misc"] = {
|
||||
["Enderchest"] = function()
|
||||
minetest.open_special_inventory()
|
||||
end,
|
||||
}
|
||||
}
|
||||
|
||||
function core.register_cheat(cheatname, category, func)
|
||||
|
36
clientmods/chat/init.lua
Normal file
36
clientmods/chat/init.lua
Normal file
@ -0,0 +1,36 @@
|
||||
chat = {}
|
||||
|
||||
chat.rainbow = dofile(minetest.get_modpath("chat") .. "/rainbow.lua")
|
||||
|
||||
function chat.send(message)
|
||||
local starts_with = message:sub(1,1) == "/"
|
||||
|
||||
if starts_with == "/" or starts_with == "." then return end
|
||||
|
||||
local reverse = minetest.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 color = minetest.settings:get("chat_color")
|
||||
|
||||
if color then
|
||||
local msg
|
||||
if color == "rainbow" then
|
||||
msg = chat.rainbow(message)
|
||||
else
|
||||
msg = minetest.colorize(color, message)
|
||||
end
|
||||
message = msg
|
||||
end
|
||||
|
||||
minetest.send_chat_message(message)
|
||||
return true
|
||||
end
|
||||
|
||||
minetest.register_on_sending_chat_message(chat.send)
|
61
clientmods/chat/rainbow.lua
Normal file
61
clientmods/chat/rainbow.lua
Normal file
@ -0,0 +1,61 @@
|
||||
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
|
||||
|
||||
return function(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 .. minetest.get_color_escape_sequence(color_from_hue(hue)) .. char
|
||||
end
|
||||
hue = hue + step
|
||||
end
|
||||
return output
|
||||
end
|
@ -1,21 +0,0 @@
|
||||
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.
|
@ -1,90 +0,0 @@
|
||||
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,
|
||||
})
|
@ -1,3 +0,0 @@
|
||||
name = colorchat
|
||||
author = red-001, Fleckenstein
|
||||
description = A minetest CSM mod for changing the color of text sent to the server.
|
@ -1,3 +0,0 @@
|
||||
name = enderchest
|
||||
author = Fleckenstein
|
||||
description = You can use this mod in MineClone2 to view you Enderinventory without an Ender Chest.
|
@ -24,15 +24,4 @@ function minetest.open_special_inventory()
|
||||
minetest.show_formspec("enderchest:enderchest", formspec)
|
||||
end
|
||||
|
||||
minetest.register_chatcommand("invhack", {
|
||||
func = function(player)
|
||||
minetest.show_formspec(
|
||||
"invhack:invhack",
|
||||
""
|
||||
.. "size[8,7.5]"
|
||||
.. "list[" .. player .. ";main;0,3.5;8,4;]"
|
||||
.. "list[" .. player .. ";craft;3,0;3,3;]"
|
||||
.. "list[" .. player .. ";craftpreview;7,1;1,1;]"
|
||||
)
|
||||
end
|
||||
})
|
||||
minetest.register_cheat("Enderchest", "Inventory", minetest.open_special_inventory)
|
56
clientmods/inventory/init.lua
Normal file
56
clientmods/inventory/init.lua
Normal file
@ -0,0 +1,56 @@
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
dofile(modpath .. "/invhack.lua")
|
||||
dofile(modpath .. "/enderchest.lua")
|
||||
|
||||
local elapsed_time = 0
|
||||
local tick_time = 0.05
|
||||
|
||||
minetest.register_globalstep(function(dtime)
|
||||
elapsed_time = elapsed_time + dtime
|
||||
if elapsed_time < tick_time then return end
|
||||
local player = minetest.localplayer
|
||||
if not player then return end
|
||||
local item = player:get_wielded_item()
|
||||
if item:get_count() == 0 and minetest.settings:get_bool("next_item") then
|
||||
local index = player:get_wield_index()
|
||||
player:set_wield_index(index + 1)
|
||||
end
|
||||
elapsed_time = 0
|
||||
end)
|
||||
|
||||
local function check_tool(groups, old_best_time)
|
||||
local toolcaps = minetest.localplayer:get_wielded_item():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 = 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
|
||||
|
||||
minetest.register_on_punchnode(function(pos, node)
|
||||
if not minetest.settings:get_bool("autotool") then return end
|
||||
local player = minetest.localplayer
|
||||
local groups = minetest.get_node_def(node.name).groups
|
||||
local new_index = player:get_wield_index()
|
||||
local better, best = check_tool(groups, math.huge)
|
||||
for i = 0, 35 do
|
||||
player:set_wield_index(i)
|
||||
better, best = check_tool(groups, best)
|
||||
if better then
|
||||
new_index = i
|
||||
end
|
||||
end
|
||||
player:set_wield_index(new_index)
|
||||
end)
|
||||
|
||||
minetest.register_cheat("NextItem", "Inventory", "next_item")
|
||||
minetest.register_cheat("AutoTool", "Inventory", "autotool")
|
13
clientmods/inventory/invhack.lua
Normal file
13
clientmods/inventory/invhack.lua
Normal file
@ -0,0 +1,13 @@
|
||||
minetest.register_chatcommand("invhack", {
|
||||
func = function(player)
|
||||
minetest.show_formspec(
|
||||
"invhack:invhack",
|
||||
""
|
||||
.. "size[8,7.5]"
|
||||
.. "list[" .. player .. ";main;0,3.5;8,4;]"
|
||||
.. "list[" .. player .. ";craft;3,0;3,3;]"
|
||||
.. "list[" .. player .. ";craftpreview;7,1;1,1;]"
|
||||
)
|
||||
end
|
||||
})
|
||||
|
@ -1,41 +0,0 @@
|
||||
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)
|
@ -1,10 +0,0 @@
|
||||
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")
|
||||
|
||||
|
@ -1,3 +0,0 @@
|
||||
name = mapbot
|
||||
author = Fleckenstein
|
||||
description = An API to create simple bots, optimized for map interaction
|
@ -1,30 +0,0 @@
|
||||
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)
|
@ -1,57 +0,0 @@
|
||||
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
|
||||
})
|
||||
|
||||
|
||||
|
@ -1,42 +0,0 @@
|
||||
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,
|
||||
})
|
||||
|
||||
|
@ -1,5 +0,0 @@
|
||||
local modname = minetest.get_current_modname()
|
||||
local modpath = minetest.get_modpath(modname)
|
||||
|
||||
dofile(modpath .. "/commands.lua")
|
||||
dofile(modpath .. "/buildbot.lua")
|
@ -1,3 +0,0 @@
|
||||
name = maputil
|
||||
author = Fleckenstein
|
||||
description = Includes commands and a advanced bot for map interaction
|
@ -1,2 +0,0 @@
|
||||
minetest.override_item("air", {liquids_pointable = true})
|
||||
|
@ -1,3 +0,0 @@
|
||||
name = misc
|
||||
author = Fleckenstein
|
||||
description = Misc cheats
|
@ -1,9 +1,6 @@
|
||||
load_mod_warp = true
|
||||
load_mod_world = true
|
||||
load_mod_respawn = true
|
||||
load_mod_colorchat = true
|
||||
load_mod_inventory = true
|
||||
load_mod_commands = true
|
||||
load_mod_maputil = true
|
||||
load_mod_enderchest = true
|
||||
load_mod_misc = true
|
||||
load_mod_mapbot = false
|
||||
load_mod_worldhacks = true
|
||||
load_mod_chat = true
|
||||
|
85
clientmods/world/init.lua
Normal file
85
clientmods/world/init.lua
Normal file
@ -0,0 +1,85 @@
|
||||
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 = minetest.localplayer:get_pos()
|
||||
local fpos = minetest.find_node_near(pos, radius, nodes, true)
|
||||
if fpos then
|
||||
return true, "Found " .. table.concat(nodes, " or ") .. " at " .. minetest.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,
|
||||
})
|
||||
|
||||
minetest.register_globalstep(function()
|
||||
local player = minetest.localplayer
|
||||
if not player then return end
|
||||
local pos = minetest.localplayer:get_pos()
|
||||
local wielditem = minetest.localplayer:get_wielded_item()
|
||||
if minetest.settings:get_bool("scaffold") then
|
||||
minetest.place_node(vector.add(pos, {x = 0, y = -0.6, z = 0}))
|
||||
end
|
||||
if minetest.settings:get_bool("highway_z") and wielditem then
|
||||
local z = pos.z
|
||||
local positions = {
|
||||
{x = 0, y = 0, z = z},
|
||||
{x = 1, y = 0, z = z},
|
||||
{x = 2, y = 1, z = z},
|
||||
{x = -2, y = 1, z = z},
|
||||
{x = -2, y = 0, z = z},
|
||||
{x = -1, y = 0, z = z},
|
||||
{x = 2, y = 0, z = z}
|
||||
}
|
||||
for _, p in pairs(positions) do
|
||||
local node = minetest.get_node_or_nil(p)
|
||||
if node and not minetest.get_node_def(node.name).walkable then
|
||||
minetest.place_node(p)
|
||||
end
|
||||
end
|
||||
end
|
||||
if minetest.settings:get_bool("fucker") then
|
||||
local p = minetest.find_node_near(pos, 5, "group:bed", true)
|
||||
if p then
|
||||
minetest.dig_node(p)
|
||||
end
|
||||
end
|
||||
if minetest.settings:get_bool("destroy_liquids") then
|
||||
local p = minetest.find_node_near(pos, 5, "mcl_core:water_source", true)
|
||||
if p then
|
||||
minetest.place_node(p)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_cheat("Scaffold", "World", "scaffold")
|
||||
minetest.register_cheat("HighwayZ", "World", "highway_z")
|
||||
minetest.register_cheat("Fucker", "World", "fucker")
|
||||
minetest.register_cheat("BlockWater", "World", "destroy_liquids")
|
@ -1,44 +0,0 @@
|
||||
minetest.register_globalstep(function()
|
||||
local player = minetest.localplayer
|
||||
if not player then return end
|
||||
local pos = minetest.localplayer:get_pos()
|
||||
local wielditem = minetest.localplayer:get_wielded_item()
|
||||
if minetest.settings:get_bool("scaffold") then
|
||||
minetest.place_node(vector.add(pos, {x = 0, y = -0.6, z = 0}))
|
||||
end
|
||||
if minetest.settings:get_bool("highway_z") and wielditem then
|
||||
local z = pos.z
|
||||
local positions = {
|
||||
{x = 0, y = 0, z = z},
|
||||
{x = 1, y = 0, z = z},
|
||||
{x = 2, y = 1, z = z},
|
||||
{x = -2, y = 1, z = z},
|
||||
{x = -2, y = 0, z = z},
|
||||
{x = -1, y = 0, z = z},
|
||||
{x = 2, y = 0, z = z}
|
||||
}
|
||||
for _, p in pairs(positions) do
|
||||
local node = minetest.get_node_or_nil(p)
|
||||
if node and not minetest.get_node_def(node.name).walkable then
|
||||
minetest.place_node(p)
|
||||
end
|
||||
end
|
||||
end
|
||||
if minetest.settings:get_bool("fucker") then
|
||||
local p = minetest.find_node_near(pos, 5, "group:bed", true)
|
||||
if p then
|
||||
minetest.dig_node(p)
|
||||
end
|
||||
end
|
||||
if minetest.settings:get_bool("destroy_liquids") then
|
||||
local p = minetest.find_node_near(pos, 5, "mcl_core:water_source", true)
|
||||
if p then
|
||||
minetest.place_node(p)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
minetest.register_cheat("Scaffold", "World", "scaffold")
|
||||
minetest.register_cheat("HighwayZ", "World", "highway_z")
|
||||
minetest.register_cheat("Fucker", "World", "fucker")
|
||||
minetest.register_cheat("DestroyWater", "World", "destroy_liquids")
|
@ -2290,7 +2290,7 @@ void Game::processPlayerInteraction(f32 dtime, bool show_hud, bool show_debug)
|
||||
f32 d = getToolRange(selected_def, hand_item.getDefinition(itemdef_manager));
|
||||
|
||||
if (g_settings->getBool("increase_tool_range"))
|
||||
d++;
|
||||
d += 2;
|
||||
if (g_settings->getBool("increase_tool_range_plus"))
|
||||
d = 1000;
|
||||
|
||||
|
@ -26,6 +26,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
#include "common/c_content.h"
|
||||
#include "client/client.h"
|
||||
#include "client/content_cao.h"
|
||||
#include "client/game.h"
|
||||
|
||||
LuaLocalPlayer::LuaLocalPlayer(LocalPlayer *m) : m_localplayer(m)
|
||||
{
|
||||
@ -86,6 +87,17 @@ int LuaLocalPlayer::l_get_wield_index(lua_State *L)
|
||||
return 1;
|
||||
}
|
||||
|
||||
// set_wield_index(self)
|
||||
int LuaLocalPlayer::l_set_wield_index(lua_State *L)
|
||||
{
|
||||
LocalPlayer *player = getobject(L, 1);
|
||||
u32 index = luaL_checkinteger(L, 2);
|
||||
|
||||
player->setWieldIndex(index);
|
||||
g_game->processItemSelection(&g_game->runData.new_playeritem);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// get_wielded_item(self)
|
||||
int LuaLocalPlayer::l_get_wielded_item(lua_State *L)
|
||||
{
|
||||
@ -468,6 +480,7 @@ const luaL_Reg LuaLocalPlayer::methods[] = {
|
||||
luamethod(LuaLocalPlayer, get_hp),
|
||||
luamethod(LuaLocalPlayer, get_name),
|
||||
luamethod(LuaLocalPlayer, get_wield_index),
|
||||
luamethod(LuaLocalPlayer, set_wield_index),
|
||||
luamethod(LuaLocalPlayer, get_wielded_item),
|
||||
luamethod(LuaLocalPlayer, is_attached),
|
||||
luamethod(LuaLocalPlayer, is_touching_ground),
|
||||
|
@ -43,6 +43,9 @@ private:
|
||||
|
||||
// get_wield_index(self)
|
||||
static int l_get_wield_index(lua_State *L);
|
||||
|
||||
// set_wield_index(self)
|
||||
static int l_set_wield_index(lua_State *L);
|
||||
|
||||
// get_wielded_item(self)
|
||||
static int l_get_wielded_item(lua_State *L);
|
||||
|
Loading…
x
Reference in New Issue
Block a user