Hotfix for set_sky packet storm

Some mods (e.g. catrealm_core) set the sky with some values that
don't match the way minetest's get_sky now returns the sky table,
e.g. colors in "#xxxxxx" string vs {r,g,b,a} table format.  When
we were comparing the new sky against the old one according to the
engine, this caused a mismatch on every step when this condition
was true, causing a sky change packet every step.

Instead of comparing against the engine's internal copy, just
do that for the first run, and then use the last sky definition we
requested after that, under the assumption that the engine did
correctly set it when we called set_sky last.  This should prevent
mismatches when mods disagree with the engine about preferred
format, though only if the mods are themselves consistent.
This commit is contained in:
Aaron Suen 2024-05-11 20:17:58 -04:00
parent 7d6eef2557
commit 8e0b9e168b

View File

@ -104,7 +104,7 @@ local function step_player(player, dtime)
local orig_phys = clone(data.physics)
data.properties = player:get_properties()
local orig_props = clone(data.properties)
data.sky = player:get_sky(true)
data.sky = data.sky or player:get_sky(true)
local orig_sky = clone(data.sky)
data.daynight = player:get_day_night_ratio()
local orig_daynight = clone(data.daynight)