Skip to main content

GetTimecycle

This function was added in DSL 10

Description

Returns a timecycle object corresponding to the specified hour, season, and weather conditions. A distinct timecycle exists for each combination of hour (0–23), season (0–3), and weather type (0–5). To easily retrieve the current season, you may use the SeasonGet function in conjunction with this function.

The returned object is a reference to the actual timecycle data. Therefore, any modifications made to this object will take an immediate effect to the game. If you intend to configure a timecycle without applying the changes instantly, you can copy the timecycle using the CopyTimecycle function or create a new one using the CreateTimecycle function.

Some fields within the timecycle structure are color values, represented as tc_color objects. These can be modified either by assigning a table containing RGB values (e.g., tc.Amb_World = {255, 255, 255}) or by indexing the color object directly (e.g., tc.Amb_World.r = 255).

Fields:

NameDescription
Amb_Propstc_color
Amb_Worldtc_color
Amb_Pedstc_color
SunRGBtc_color
Backtc_color
BackIntfloat
NightFactorfloat
lowcloudsRGBtc_color [0.0, 1.0]
TopCloudRGBtc_color
BottomCloudRGBtc_color
GlowThreshinteger
GlowStrengthinteger
SKYTOPtc_color
Skybottc_color
SunRGBcoretc_color
SunRGBcoronatc_color
SunRGBszfloat
Sprszfloat
Sprbrghtfloat
Shdwinteger
Lightshdfloat
Poleshdfloat
Farclipinteger
Fogstinteger
Unknown1integer
Unknown2integer
CloudSpeedfloat
CloudTopRGBtc_color
CloudBotRGBtc_color
ColFilterModeinteger
ColFilterRGBAtc_color with alpha
AmbLRangefloat
AmbHRangefloat
SunLRangefloat
SunHRangefloat
BackLRangefloat
BackHRangefloat
NearFarRatiointeger
function GetTimecycle(hour, season, weather) --[[ ... ]] end

Parameters

  • hour: number - An integer value ranging from 0 to 23.
  • season: number - An integer value ranging from 0 to 3.
  • weather: number - An integer value ranging from 0 to 5.

Return Values

  • timecycle: userdata - A timecycle userdata.

Example

Instantly changes the current cloud speed:

local TC = GetTimecycle(ClockGet(), SeasonGet(), WeatherGet())
TC.CloudSpeed = 1.2

Turns the game into eternal night:

-- Arg/Param 1: 2 --> means 2 AM
-- Arg/Param 2: 0 --> means Summer
-- Arg/Param 3: 4 --> means Normal
local TC = CopyTimecycle(GetTimecycle(2, 0, 4))

-- Apply the same timecycle to all hours, seasons, and weather conditions (exterior only)
for Hour = 0, 23 do
for Season = 0, 3 do
for Weather = 0, 5 do
SetTimecycle(Hour, Season, Weather, TC)
end
end
end