pub struct Environment {
pub climate: Climate,
pub state: i32,
pub level: i32,
pub temperature: f32,
pub season: SeasonValues,
pub effects: [Option<WeatherEffect>; 2],
pub fade_times: [Option<f32>; 2],
pub tornado_timer: i64,
pub game_flags: u32,
/* private fields */
}Expand description
The environment: temperature, weather and the renderer’s seasonal values. See the module documentation.
Fields§
§climate: ClimateThe climate.
state: i320 precipitation, 1 cloudy, 2 partly sunny, 3 sunny.
level: i32Precipitation level 0..5 (starts at 4).
temperature: f32°F.
season: SeasonValuesThe renderer’s seasonal values.
effects: [Option<WeatherEffect>; 2]The Rain and Snow effects while they exist.
fade_times: [Option<f32>; 2]Weather of each slot’s description: seconds to fade in or out. A slot without a loaded
description never starts.
tornado_timer: i64The time since the last tornado check.
game_flags: u32Game: bit 7 stops tornadoes (set with disasters off).
Implementations§
Source§impl Environment
impl Environment
Sourcepub fn restore(
&mut self,
state: i32,
level: i32,
temperature: f32,
season: SeasonValues,
baseline: (f32, f32),
bias: (f32, f32),
slice: i32,
effects: [Option<WeatherEffect>; 2],
)
pub fn restore( &mut self, state: i32, level: i32, temperature: f32, season: SeasonValues, baseline: (f32, f32), bias: (f32, f32), slice: i32, effects: [Option<WeatherEffect>; 2], )
The environment as a save stores it: the state, the level, the temperature, the renderer’s values, the baseline, the bias, the last slice, and each weather effect that exists (made again on load with its direction and intensity).
Original: FUN_140099160.
Deviation: the temperature noise (+0x34) is not saved; after a load the original keeps
its constructor’s clock-seeded field until the next reseed (slice 0 or 24). The port
keeps its constructor’s fixed seed.
Sourcepub fn saved(&self) -> ((f32, f32), (f32, f32), i32)
pub fn saved(&self) -> ((f32, f32), (f32, f32), i32)
What Environment::restore takes, for saving: baseline and bias with their targets,
and the last slice.
Sourcepub fn new(climate: Climate) -> Environment
pub fn new(climate: Climate) -> Environment
A new environment for a climate: state 0, level 4, and the climate’s baseline.
Original: FUN_140099430, then FUN_140099300.
Deviation: the constructor seeds its first Perlin field from two clock-seeded Random()s;
the first update always reseeds it (slice 0), so a fixed seed is used here.
Sourcepub fn update(&mut self, elapsed: f32, dt: f32, rng: &mut Random) -> bool
pub fn update(&mut self, elapsed: f32, dt: f32, rng: &mut Random) -> bool
One simulation iteration. elapsed is the calendar’s time into the current year in seconds,
already advanced for this iteration; dt is the iteration’s step; rng is the game’s
shared random stream (Game/Game).
Returns whether a tornado forms (step 6): this can happen while it rains above 34 °F with tornadoes on. The caller then creates the environment template’s entity.
Original: FUN_1400999b0, FUN_1400c8bf0, FUN_1400c9d70.
Sourcepub fn active_effect(&self, weather_enabled: bool) -> Option<usize>
pub fn active_effect(&self, weather_enabled: bool) -> Option<usize>
Which weather effect slot is active: only in state 0 with weather enabled; slot 0 Rain above 34°, slot 1 Snow at or below.
Original: FUN_1400999b0, FUN_140099790.
Trait Implementations§
Source§impl Clone for Environment
impl Clone for Environment
Source§fn clone(&self) -> Environment
fn clone(&self) -> Environment
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more