mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-21 11:55:43 +02:00
Cherry-pick most commits since 15c0376
Commits not directly related to network changes were cherry-picked on a best-effort basis, as some cause difficult merge conflicts. Commits skipped over:0d1eedcccc
aa474e4501
82482ecd9d
b214cde5b4
2066655aae
7e088fdfe3
40bf1d7b5f
1b2f64473e
7e56637ed0
64ff966bae
51057a56f5
009149a073
cf4045ff0f
e357577cb2
49f84b76bc
b019221c30
7880ff74b6
146f77fdb7
a704c04f00
Commits with conflicts:038d3a31df
e9eda2b0d0
708337dfc2
~~ modified client.cpp manually; shadow changes to packethandlers/client.cpp36e8ba9ce2
~~ modified main.cpp manually; add ALLOW_ZWRITE_ON_TRANSPARENT set3b6480c5b0
~~ modified server.cpp manually; change wrapDegrees -> modulo360f5a5854ea9d
c09d026f05
3c91ad8fc2
This commit is contained in:
@@ -229,21 +229,28 @@ core.register_chatcommand("setpassword", {
|
||||
if not toname then
|
||||
return false, "Name field required"
|
||||
end
|
||||
local actstr = "?"
|
||||
local act_str_past = "?"
|
||||
local act_str_pres = "?"
|
||||
if not raw_password then
|
||||
core.set_player_password(toname, "")
|
||||
actstr = "cleared"
|
||||
act_str_past = "cleared"
|
||||
act_str_pres = "clears"
|
||||
else
|
||||
core.set_player_password(toname,
|
||||
core.get_password_hash(toname,
|
||||
raw_password))
|
||||
actstr = "set"
|
||||
act_str_past = "set"
|
||||
act_str_pres = "sets"
|
||||
end
|
||||
if toname ~= name then
|
||||
core.chat_send_player(toname, "Your password was "
|
||||
.. actstr .. " by " .. name)
|
||||
.. act_str_past .. " by " .. name)
|
||||
end
|
||||
return true, "Password of player \"" .. toname .. "\" " .. actstr
|
||||
|
||||
core.log("action", name .. " " .. act_str_pres
|
||||
.. " password of " .. toname .. ".")
|
||||
|
||||
return true, "Password of player \"" .. toname .. "\" " .. act_str_past
|
||||
end,
|
||||
})
|
||||
|
||||
@@ -257,6 +264,9 @@ core.register_chatcommand("clearpassword", {
|
||||
return false, "Name field required"
|
||||
end
|
||||
core.set_player_password(toname, '')
|
||||
|
||||
core.log("action", name .. " clears password of " .. toname .. ".")
|
||||
|
||||
return true, "Password of player \"" .. toname .. "\" cleared"
|
||||
end,
|
||||
})
|
||||
@@ -404,13 +414,14 @@ core.register_chatcommand("set", {
|
||||
})
|
||||
|
||||
core.register_chatcommand("deleteblocks", {
|
||||
params = "[here] [<pos1> <pos2>]",
|
||||
params = "(here [radius]) | (<pos1> <pos2>)",
|
||||
description = "delete map blocks contained in area pos1 to pos2",
|
||||
privs = {server=true},
|
||||
func = function(name, param)
|
||||
local p1 = {}
|
||||
local p2 = {}
|
||||
if param == "here" then
|
||||
local args = param:split(" ")
|
||||
if args[1] == "here" then
|
||||
local player = core.get_player_by_name(name)
|
||||
if player == nil then
|
||||
core.log("error", "player is nil")
|
||||
@@ -418,6 +429,12 @@ core.register_chatcommand("deleteblocks", {
|
||||
end
|
||||
p1 = player:getpos()
|
||||
p2 = p1
|
||||
|
||||
if #args >= 2 then
|
||||
local radius = tonumber(args[2]) or 0
|
||||
p1 = vector.add(p1, radius)
|
||||
p2 = vector.subtract(p2, radius)
|
||||
end
|
||||
else
|
||||
local pos1, pos2 = unpack(param:split(") ("))
|
||||
if pos1 == nil or pos2 == nil then
|
||||
@@ -570,6 +587,9 @@ core.register_chatcommand("rollback_check", {
|
||||
.. " seconds=86400=24h, limit=5)",
|
||||
privs = {rollback=true},
|
||||
func = function(name, param)
|
||||
if not core.setting_getbool("enable_rollback_recording") then
|
||||
return false, "Rollback functions are disabled."
|
||||
end
|
||||
local range, seconds, limit =
|
||||
param:match("(%d+) *(%d*) *(%d*)")
|
||||
range = tonumber(range) or 0
|
||||
@@ -583,6 +603,10 @@ core.register_chatcommand("rollback_check", {
|
||||
local name = puncher:get_player_name()
|
||||
core.chat_send_player(name, "Checking " .. core.pos_to_string(pos) .. "...")
|
||||
local actions = core.rollback_get_node_actions(pos, range, seconds, limit)
|
||||
if not actions then
|
||||
core.chat_send_player(name, "Rollback functions are disabled")
|
||||
return
|
||||
end
|
||||
local num_actions = #actions
|
||||
if num_actions == 0 then
|
||||
core.chat_send_player(name, "Nobody has touched"
|
||||
@@ -614,6 +638,9 @@ core.register_chatcommand("rollback", {
|
||||
description = "revert actions of a player; default for <seconds> is 60",
|
||||
privs = {rollback=true},
|
||||
func = function(name, param)
|
||||
if not core.setting_getbool("enable_rollback_recording") then
|
||||
return false, "Rollback functions are disabled."
|
||||
end
|
||||
local target_name, seconds = string.match(param, ":([^ ]+) *(%d*)")
|
||||
if not target_name then
|
||||
local player_name = nil
|
||||
|
Reference in New Issue
Block a user