[General] Use different timescales for day and night

This commit is contained in:
David Cernat
2019-05-01 01:19:35 +03:00
parent 6cbaf2b517
commit 25f1c70daf
5 changed files with 47 additions and 10 deletions
+15 -4
View File
@@ -740,13 +740,24 @@ function commandHandler.ProcessCommand(pid, cmd)
elseif cmd[1] == "settimescale" and moderator then
local inputValue = tonumber(cmd[2])
local inputPeriod = string.lower(tostring(cmd[2]))
local inputValue = tonumber(cmd[3])
if tableHelper.containsValue({"day", "night", "both"}, inputPeriod) and type(inputValue) == "number" then
if inputPeriod == "day" or inputPeriod == "both" then
WorldInstance.data.time.dayTimeScale = inputValue
end
if inputPeriod == "night" or inputPeriod == "both" then
WorldInstance.data.time.nightTimeScale = inputValue
end
if type(inputValue) == "number" then
WorldInstance.data.time.timeScale = inputValue
WorldInstance:QuicksaveToDrive()
WorldInstance:UpdateFrametimeMultiplier()
WorldInstance:LoadTime(pid, true)
frametimeMultiplier = inputValue / WorldInstance.defaultTimeScale
else
tes3mp.SendMessage(pid, "Invalid input! Please use /settimescale day/night/both <value>\n", false)
end
elseif cmd[1] == "setcollision" and admin then