cargo clippy + fmt

This commit is contained in:
Sophia Waggoner 2023-03-22 05:49:54 -07:00
parent d5c169682e
commit 264e4a53f8
10 changed files with 23 additions and 24 deletions

View File

@ -40,6 +40,7 @@ use common::{
outcome::Outcome,
recipe::{ComponentRecipeBook, RecipeBook},
resources::{GameMode, PlayerEntity, Time, TimeOfDay},
shared_server_config::ServerConstants,
spiral::Spiral2d,
terrain::{
block::Block, map::MapConfig, neighbors, site::DungeonKindMeta, BiomeKind,
@ -50,7 +51,6 @@ use common::{
uid::{Uid, UidAllocator},
vol::RectVolSize,
weather::{Weather, WeatherGrid},
shared_server_config::ServerConstants,
};
#[cfg(feature = "tracy")] use common_base::plot;
use common_base::{prof_span, span};
@ -266,7 +266,7 @@ pub struct Client {
pending_chunks: HashMap<Vec2<i32>, Instant>,
target_time_of_day: Option<TimeOfDay>,
connected_server_constants: ServerConstants
connected_server_constants: ServerConstants,
}
/// Holds data related to the current players characters, as well as some
@ -749,7 +749,7 @@ impl Client {
pending_chunks: HashMap::new(),
target_time_of_day: None,
connected_server_constants: server_constants
connected_server_constants: server_constants,
})
}
@ -1804,7 +1804,7 @@ impl Client {
},
true,
None,
&self.connected_server_constants
&self.connected_server_constants,
);
// TODO: avoid emitting these in the first place
let _ = self

View File

@ -12,12 +12,12 @@ use common::{
outcome::Outcome,
recipe::{ComponentRecipeBook, RecipeBook},
resources::{Time, TimeOfDay},
shared_server_config::ServerConstants,
terrain::{Block, TerrainChunk, TerrainChunkMeta, TerrainChunkSize},
trade::{PendingTrade, SitePrices, TradeId, TradeResult},
uid::Uid,
uuid::Uuid,
weather::WeatherGrid,
shared_server_config::ServerConstants,
};
use hashbrown::HashMap;
use serde::{Deserialize, Serialize};
@ -67,7 +67,7 @@ pub enum ServerInit {
component_recipe_book: ComponentRecipeBook,
material_stats: MaterialStatManifest,
ability_map: comp::item::tool::AbilityMap,
server_constants: ServerConstants
server_constants: ServerConstants,
},
}

View File

@ -31,8 +31,8 @@ pub mod combat;
pub mod comp;
pub mod consts;
pub mod resources;
pub mod uid;
pub mod shared_server_config;
pub mod uid;
// NOTE: Comment out macro to get rustfmt to re-order these as needed.
cfg_if! { if #[cfg(not(target_arch = "wasm32"))] {

View File

@ -1,6 +1,7 @@
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
/// Per-server constant data (configs) that stays the same for the server's life.
/// Per-server constant data (configs) that stays the same for the server's
/// life.
#[derive(Debug, Serialize, Deserialize, Clone)]
pub struct ServerConstants {
pub day_cycle_coefficient: f64,

View File

@ -16,13 +16,13 @@ use common::{
DeltaTime, EntitiesDiedLastTick, GameMode, PlayerEntity, PlayerPhysicsSettings, Time,
TimeOfDay,
},
shared_server_config::ServerConstants,
slowjob::SlowJobPool,
terrain::{Block, MapSizeLg, TerrainChunk, TerrainGrid},
time::DayPeriod,
trade::Trades,
vol::{ReadVol, WriteVol},
weather::{Weather, WeatherGrid},
shared_server_config::ServerConstants,
};
use common_base::span;
use common_ecs::{PhysicsMetrics, SysMetrics};
@ -595,7 +595,7 @@ impl State {
add_systems: impl Fn(&mut DispatcherBuilder),
update_terrain_and_regions: bool,
mut metrics: Option<&mut StateTickMetrics>,
server_constants: &ServerConstants
server_constants: &ServerConstants,
) {
span!(_guard, "tick", "State::tick");
@ -609,7 +609,8 @@ impl State {
}
// Change the time accordingly.
self.ecs.write_resource::<TimeOfDay>().0 += dt.as_secs_f64() * server_constants.day_cycle_coefficient;
self.ecs.write_resource::<TimeOfDay>().0 +=
dt.as_secs_f64() * server_constants.day_cycle_coefficient;
// Update delta time.
// Beyond a delta time of MAX_DELTA_TIME, start lagging to avoid skipping

View File

@ -6,10 +6,11 @@ mod tests {
Controller, Energy, Ori, PhysicsState, Poise, Pos, Skill, Stats, Vel,
},
resources::{DeltaTime, GameMode, Time},
shared_server_config::ServerConstants,
terrain::{MapSizeLg, TerrainChunk},
uid::Uid,
util::Dir,
SkillSetBuilder, shared_server_config::ServerConstants,
SkillSetBuilder,
};
use common_ecs::dispatch;
use common_state::State;

View File

@ -1,10 +1,6 @@
use crate::utils;
use approx::assert_relative_eq;
use common::{
comp::Controller,
resources::Time,
shared_server_config::ServerConstants,
};
use common::{comp::Controller, resources::Time, shared_server_config::ServerConstants};
use specs::WorldExt;
use std::error::Error;
use utils::{DT, DT_F64, EPSILON};

View File

@ -7,11 +7,11 @@ use common::{
Vel,
},
resources::{DeltaTime, GameMode, Time},
shared_server_config::ServerConstants,
skillset_builder::SkillSetBuilder,
terrain::{
Block, BlockKind, MapSizeLg, SpriteKind, TerrainChunk, TerrainChunkMeta, TerrainGrid,
},
shared_server_config::ServerConstants,
};
use common_ecs::{dispatch, System};
use common_net::sync::WorldSyncExt;

View File

@ -79,10 +79,10 @@ use common::{
event::{EventBus, ServerEvent},
resources::{BattleMode, GameMode, Time, TimeOfDay},
rtsim::RtSimEntity,
shared_server_config::ServerConstants,
slowjob::SlowJobPool,
terrain::{TerrainChunk, TerrainChunkSize},
vol::RectRasterableVol,
shared_server_config::ServerConstants,
};
use common_ecs::run_now;
use common_net::{
@ -565,7 +565,7 @@ impl Server {
rtsim::init(&mut state);
let server_constants = ServerConstants {
day_cycle_coefficient: 1400.0 / settings.day_length
day_cycle_coefficient: 1400.0 / settings.day_length,
};
let this = Self {
@ -710,7 +710,7 @@ impl Server {
},
false,
Some(&mut state_tick_metrics),
&self.server_constants
&self.server_constants,
);
let before_handle_events = Instant::now();

View File

@ -10,8 +10,8 @@ use common::{
event::{EventBus, ServerEvent},
recipe::{default_component_recipe_book, default_recipe_book},
resources::TimeOfDay,
uid::{Uid, UidAllocator},
shared_server_config::ServerConstants,
uid::{Uid, UidAllocator},
};
use common_base::prof_span;
use common_ecs::{Job, Origin, Phase, System};