Weather (tm.weather)
Client side only. Read-only queries about the weather the game is showing right now.
Functions
| Call | Returns |
|---|---|
tm.weather.get() | The current weather as a hash (compare with joaat('RAIN')). |
tm.weather.getName() | The current weather as a name such as 'RAIN', or nil for a type the game does not list. |
tm.weather.is(weatherType) | true when the current weather is the named type. Case does not matter. |
tm.weather.isRaining() | RAIN, THUNDER or THUNDERSTORM. |
tm.weather.isFoggy() | FOGGY or SMOG. |
tm.weather.isClear() | CLEAR, EXTRASUNNY or NEUTRAL. |
tm.weather.isSnowy() | SNOW, SNOWLIGHT, BLIZZARD or XMAS. |
lua
if tm.weather.is('RAIN') then
-- it is raining
end
if tm.weather.isSnowy() then
-- apply an ice traction penalty
endWeather types
EXTRASUNNY, CLEAR, NEUTRAL, SMOG, FOGGY, OVERCAST, CLOUDS, CLEARING, RAIN, THUNDER, SNOW, BLIZZARD, SNOWLIGHT, XMAS, HALLOWEEN.
Notes
get()readsGetPrevWeatherTypeHashName, the weather the game last settled on. It returns a hash, not a string. UsegetName()when you need text.