Ignore calls to time chatcommand if params == ""

- Set a check before throttling the time loop due to a time chatcommand
   input so that it doesn't recompute the ratio'd time speeds from an
   already ratio'd timespeed (small ratios would have time speeds
   exponentially bigger, and bigger ratios, exponentially slower time
   speeds)
 - For MinetestForFun/server-minetestforfun-skyblock#202
This commit is contained in:
LeMagnesium 2017-02-06 21:09:56 +01:00
parent cef840ae04
commit a73fd72805
No known key found for this signature in database
GPG Key ID: A54DDB5272C51E8B
1 changed files with 7 additions and 7 deletions

View File

@ -57,13 +57,13 @@ end
-- Crappy overrides -- Crappy overrides
local old_settime_func = core.chatcommands["time"].func local old_settime_func = core.chatcommands["time"].func
core.chatcommands["time"].func = function(...) core.chatcommands["time"].func = function(name, params)
local res, msg = old_settime_func(...) local res, msg = old_settime_func(name, params)
if res and time_reg.status == time_reg.STATUS_ACTIVE then if params ~= "" and res and time_reg.status == time_reg.STATUS_ACTIVE then
time_reg.log("Settime override : updating regulation", "verbose") time_reg.log("Settime override : updating regulation", "verbose")
time_reg.loop(false, true) time_reg.loop(false, true)
end end
return res, msg return res, msg
end end
local old_set_func = core.chatcommands["set"].func local old_set_func = core.chatcommands["set"].func