From 53cecf7b417c50b45f013f12aa169f6c28041b2a Mon Sep 17 00:00:00 2001 From: kay27 Date: Fri, 18 Feb 2022 17:43:28 +0400 Subject: [PATCH] Reduce the number of time_speed less than 1 warnings logged --- mods/CORE/mcl_time/init.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mods/CORE/mcl_time/init.lua b/mods/CORE/mcl_time/init.lua index 31bcbbe295..b90f624385 100644 --- a/mods/CORE/mcl_time/init.lua +++ b/mods/CORE/mcl_time/init.lua @@ -14,11 +14,21 @@ local last_save_seconds_irl = seconds_irl_public local next_save_seconds_irl = last_save_seconds_irl + save_to_storage_interval local previous_seconds_irl = -2 +local time_speed_is_ok = true + local function get_seconds_irl() local time_speed = tonumber(minetest.settings:get("time_speed") or default_time_speed) if time_speed < 1 then - minetest.log("warning", "[mcl_time] time_speed < 1 - please increase to make mcl_time api work (default: " .. default_time_speed .. ")") + if time_speed_is_ok then + minetest.log("warning", "[mcl_time] time_speed < 1 - please increase to make mcl_time api work (default: " .. default_time_speed .. ")") + time_speed_is_ok = false + end return 0 + else + if not time_speed_is_ok then + minetest.log("warning", "[mcl_time] time_speed is now " .. time_speed) + time_speed_is_ok = true + end end local irl_multiplier = 86400 / time_speed local day_count = minetest.get_day_count()