# config.ludic - the kinds the game hands in, the wind's daily turn, and the port's defaults # the kinds, in the game's order; the first `clear` one is where a new trip starts export function weather_kinds(weather_st: mut WeatherState, kinds: []WeatherKind) -> void { weather_st.wx_kinds = kinds } export function weather_kind_count(weather_st: WeatherState) -> int { if weather_st.wx_kinds == null { return 0 } return len(weather_st.wx_kinds) } export function weather_kind(weather_st: WeatherState, k: int) -> WeatherKind { return weather_st.wx_kinds[k] } # a valley's wind: down it by night, up it from `up_from` to `up_to` while the slopes are warm export function weather_config_wind(weather_st: mut WeatherState, down_dir: float, up_dir: float, up_from: float, up_to: float) -> void { weather_st.wx_down_dir = down_dir weather_st.wx_up_dir = up_dir weather_st.wx_up_from = up_from weather_st.wx_up_to = up_to } function wx_clear_kind(weather_st: WeatherState) -> int { for k in 0 .. weather_kind_count(weather_st) { if weather_st.wx_kinds[k].clear { return k } } return 0 } function wx_first_wet(weather_st: WeatherState) -> int { for k in 0 .. weather_kind_count(weather_st) { if weather_st.wx_kinds[k].wet { return k } } return 0 } function wx_owns() -> bool { return WeatherWorld.owns_world() } function wx_hours() -> float { return WeatherWorld.hours() } function wx_night() -> bool { return WeatherWorld.is_night() } function wx_bias() -> int { return WeatherWorld.bias() } function wx_wrap(a: float) -> float { var d = a while d > 3.1415927 { d = d - 6.2831853 } while d < -3.1415927 { d = d + 6.2831853 } return d }