Set time_speed to normal value on shutdown

- For #4
This commit is contained in:
LeMagnesium 2016-05-16 14:14:48 +02:00
parent e9787b55aa
commit 5faec7598f

View File

@ -3,12 +3,12 @@
-- By Mg/LeMagnesium
-- License: WTFPL
-- Last modification :
-- 05/12/16 @ 12:20PM GMT+1 (Mg)
-- 05/16/16 @ 02:14PM GMT+1 (Mg)
--
-- Namespace first, with basic informations
time_reg = {}
time_reg.version = "00.01.24"
time_reg.version = "00.01.25"
time_reg.authors = {"Mg/LeMagnesium"}
-- Definitions
@ -367,6 +367,15 @@ function time_reg.init()
time_reg.log("\tNight: " .. 1440 / time_reg.night_time_speed .. " minutes")
end
-- Shutdown
-- Sometimes MT will shutdown and write current time_speed in minetest.conf; we need to change the value back to normal before it happens
function time_reg.on_shutdown()
minetest.setting_set("time_speed", time_reg.time_speed)
time_reg.log("Time speed set back to " .. time_reg.time_speed)
end
minetest.register_on_shutdown(time_reg.on_shutdown)
-- --[[ NOW WE SHALL START ]]-- --
time_reg.log("Thank you for using TimeRegulation v" .. time_reg.version .. " by " .. table.concat(time_reg.authors, ", "))