40 lines
2.3 KiB
Text
40 lines
2.3 KiB
Text
# queries.ludic - what the world asks the sky
|
|
export function weather_state(weather_st: WeatherState) -> int { return weather_st.wx_state }
|
|
export function weather_next(weather_st: WeatherState) -> int { return weather_st.wx_next }
|
|
export function weather_left(weather_st: WeatherState) -> float { return weather_st.wx_left }
|
|
export function weather_amount(weather_st: WeatherState) -> float { return weather_st.wx_amount }
|
|
export function weather_forecast(weather_st: WeatherState) -> int { return weather_st.wx_forecast }
|
|
export function weather_forced(weather_st: WeatherState) -> bool { return weather_st.wx_forced }
|
|
export function weather_wind(weather_st: WeatherState) -> float { return weather_st.wx_wind }
|
|
export function weather_dir(weather_st: WeatherState) -> float { return weather_st.wx_dir }
|
|
export function weather_ground_wet(weather_st: WeatherState) -> float { return weather_st.wx_ground }
|
|
export function weather_flash(weather_st: WeatherState) -> float { return weather_st.wx_flash }
|
|
|
|
# rain or snow is falling, and more than a spit of it
|
|
export function weather_wet(weather_st: WeatherState) -> bool {
|
|
if weather_kind_count(weather_st) == 0 { return false }
|
|
return weather_st.wx_kinds[weather_st.wx_state].wet and weather_st.wx_amount > 0.3
|
|
}
|
|
|
|
export function weather_overcast(weather_st: WeatherState) -> float {
|
|
if weather_kind_count(weather_st) == 0 { return 0.0 }
|
|
return weather_st.wx_kinds[weather_st.wx_state].overcast * weather_st.wx_amount
|
|
}
|
|
|
|
export function weather_cold(weather_st: WeatherState) -> float {
|
|
if weather_kind_count(weather_st) == 0 { return 0.0 }
|
|
return weather_st.wx_kinds[weather_st.wx_state].cold * weather_st.wx_amount
|
|
}
|
|
|
|
export function weather_name(weather_st: WeatherState, k: int) -> string {
|
|
if k < 0 or k >= weather_kind_count(weather_st) { return "" }
|
|
if weather_st.wx_kinds[k].name == null { return "" }
|
|
@alloc_ok("a cast: a key's marked text, nothing is made")
|
|
return string(weather_st.wx_kinds[k].name)
|
|
}
|
|
|
|
# the half hour after a front goes through, when the air is glass-clear
|
|
export function weather_after_front(weather_st: WeatherState) -> bool { return weather_st.wx_clear_t > 0.0 }
|
|
|
|
# yesterday had rain or snow in it (the valley's fog pools after a wet day)
|
|
export function weather_wet_yesterday(weather_st: WeatherState) -> bool { return weather_st.wx_wet_yesterday }
|