From 8e0b9e168b4266b2feed6b58ff6bf721fa0d2f8f Mon Sep 17 00:00:00 2001 From: Aaron Suen Date: Sat, 11 May 2024 20:17:58 -0400 Subject: [PATCH] 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. --- mods/nc_api_active/playerstep.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mods/nc_api_active/playerstep.lua b/mods/nc_api_active/playerstep.lua index b1147017..c03c308d 100644 --- a/mods/nc_api_active/playerstep.lua +++ b/mods/nc_api_active/playerstep.lua @@ -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)