mirror of
https://github.com/luanti-org/luanti.git
synced 2025-12-22 22:55:28 +01: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:0d1eedccccaa474e450182482ecd9db214cde5b42066655aae7e088fdfe340bf1d7b5f1b2f64473e7e56637ed064ff966bae51057a56f5009149a073cf4045ff0fe357577cb249f84b76bcb019221c307880ff74b6146f77fdb7a704c04f00Commits with conflicts:038d3a31dfe9eda2b0d0708337dfc2~~ 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 -> modulo360f5a5854ea9dc09d026f053c91ad8fc2
This commit is contained in:
@@ -545,12 +545,11 @@ function table.copy(t, seen)
|
||||
seen = seen or {}
|
||||
seen[t] = n
|
||||
for k, v in pairs(t) do
|
||||
n[type(k) ~= "table" and k or seen[k] or table.copy(k, seen)] =
|
||||
type(v) ~= "table" and v or seen[v] or table.copy(v, seen)
|
||||
n[(type(k) == "table" and (seen[k] or table.copy(k, seen))) or k] =
|
||||
(type(v) == "table" and (seen[v] or table.copy(v, seen))) or v
|
||||
end
|
||||
return n
|
||||
end
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
-- mainmenu only functions
|
||||
--------------------------------------------------------------------------------
|
||||
@@ -565,7 +564,7 @@ if INIT == "mainmenu" then
|
||||
return nil
|
||||
end
|
||||
|
||||
function fgettext(text, ...)
|
||||
function fgettext_ne(text, ...)
|
||||
text = core.gettext(text)
|
||||
local arg = {n=select('#', ...), ...}
|
||||
if arg.n >= 1 then
|
||||
@@ -587,7 +586,11 @@ if INIT == "mainmenu" then
|
||||
end
|
||||
text = result
|
||||
end
|
||||
return core.formspec_escape(text)
|
||||
return text
|
||||
end
|
||||
|
||||
function fgettext(text, ...)
|
||||
return core.formspec_escape(fgettext_ne(text, ...))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -115,11 +115,20 @@ function core.serialize(x)
|
||||
function dump_val(x)
|
||||
local tp = type(x)
|
||||
if x == nil then return "nil"
|
||||
elseif tp == "number" then return string.format("%d", x)
|
||||
elseif tp == "string" then return string.format("%q", x)
|
||||
elseif tp == "boolean" then return x and "true" or "false"
|
||||
elseif tp == "function" then
|
||||
return string.format("loadstring(%q)", string.dump(x))
|
||||
elseif tp == "number" then
|
||||
-- Serialize integers with string.format to prevent
|
||||
-- scientific notation, which doesn't preserve
|
||||
-- precision and breaks things like node position
|
||||
-- hashes. Serialize floats normally.
|
||||
if math.floor(x) == x then
|
||||
return string.format("%d", x)
|
||||
else
|
||||
return tostring(x)
|
||||
end
|
||||
elseif tp == "table" then
|
||||
local vals = {}
|
||||
local idx_dumped = {}
|
||||
|
||||
Reference in New Issue
Block a user