mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
cargo clippy + fmt
This commit is contained in:
parent
d5c169682e
commit
264e4a53f8
@ -40,6 +40,7 @@ use common::{
|
|||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
recipe::{ComponentRecipeBook, RecipeBook},
|
recipe::{ComponentRecipeBook, RecipeBook},
|
||||||
resources::{GameMode, PlayerEntity, Time, TimeOfDay},
|
resources::{GameMode, PlayerEntity, Time, TimeOfDay},
|
||||||
|
shared_server_config::ServerConstants,
|
||||||
spiral::Spiral2d,
|
spiral::Spiral2d,
|
||||||
terrain::{
|
terrain::{
|
||||||
block::Block, map::MapConfig, neighbors, site::DungeonKindMeta, BiomeKind,
|
block::Block, map::MapConfig, neighbors, site::DungeonKindMeta, BiomeKind,
|
||||||
@ -50,7 +51,6 @@ use common::{
|
|||||||
uid::{Uid, UidAllocator},
|
uid::{Uid, UidAllocator},
|
||||||
vol::RectVolSize,
|
vol::RectVolSize,
|
||||||
weather::{Weather, WeatherGrid},
|
weather::{Weather, WeatherGrid},
|
||||||
shared_server_config::ServerConstants,
|
|
||||||
};
|
};
|
||||||
#[cfg(feature = "tracy")] use common_base::plot;
|
#[cfg(feature = "tracy")] use common_base::plot;
|
||||||
use common_base::{prof_span, span};
|
use common_base::{prof_span, span};
|
||||||
@ -266,7 +266,7 @@ pub struct Client {
|
|||||||
pending_chunks: HashMap<Vec2<i32>, Instant>,
|
pending_chunks: HashMap<Vec2<i32>, Instant>,
|
||||||
target_time_of_day: Option<TimeOfDay>,
|
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
|
/// Holds data related to the current players characters, as well as some
|
||||||
@ -749,7 +749,7 @@ impl Client {
|
|||||||
pending_chunks: HashMap::new(),
|
pending_chunks: HashMap::new(),
|
||||||
target_time_of_day: None,
|
target_time_of_day: None,
|
||||||
|
|
||||||
connected_server_constants: server_constants
|
connected_server_constants: server_constants,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1804,7 +1804,7 @@ impl Client {
|
|||||||
},
|
},
|
||||||
true,
|
true,
|
||||||
None,
|
None,
|
||||||
&self.connected_server_constants
|
&self.connected_server_constants,
|
||||||
);
|
);
|
||||||
// TODO: avoid emitting these in the first place
|
// TODO: avoid emitting these in the first place
|
||||||
let _ = self
|
let _ = self
|
||||||
|
@ -12,12 +12,12 @@ use common::{
|
|||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
recipe::{ComponentRecipeBook, RecipeBook},
|
recipe::{ComponentRecipeBook, RecipeBook},
|
||||||
resources::{Time, TimeOfDay},
|
resources::{Time, TimeOfDay},
|
||||||
|
shared_server_config::ServerConstants,
|
||||||
terrain::{Block, TerrainChunk, TerrainChunkMeta, TerrainChunkSize},
|
terrain::{Block, TerrainChunk, TerrainChunkMeta, TerrainChunkSize},
|
||||||
trade::{PendingTrade, SitePrices, TradeId, TradeResult},
|
trade::{PendingTrade, SitePrices, TradeId, TradeResult},
|
||||||
uid::Uid,
|
uid::Uid,
|
||||||
uuid::Uuid,
|
uuid::Uuid,
|
||||||
weather::WeatherGrid,
|
weather::WeatherGrid,
|
||||||
shared_server_config::ServerConstants,
|
|
||||||
};
|
};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -67,7 +67,7 @@ pub enum ServerInit {
|
|||||||
component_recipe_book: ComponentRecipeBook,
|
component_recipe_book: ComponentRecipeBook,
|
||||||
material_stats: MaterialStatManifest,
|
material_stats: MaterialStatManifest,
|
||||||
ability_map: comp::item::tool::AbilityMap,
|
ability_map: comp::item::tool::AbilityMap,
|
||||||
server_constants: ServerConstants
|
server_constants: ServerConstants,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,8 +31,8 @@ pub mod combat;
|
|||||||
pub mod comp;
|
pub mod comp;
|
||||||
pub mod consts;
|
pub mod consts;
|
||||||
pub mod resources;
|
pub mod resources;
|
||||||
pub mod uid;
|
|
||||||
pub mod shared_server_config;
|
pub mod shared_server_config;
|
||||||
|
pub mod uid;
|
||||||
|
|
||||||
// NOTE: Comment out macro to get rustfmt to re-order these as needed.
|
// NOTE: Comment out macro to get rustfmt to re-order these as needed.
|
||||||
cfg_if! { if #[cfg(not(target_arch = "wasm32"))] {
|
cfg_if! { if #[cfg(not(target_arch = "wasm32"))] {
|
||||||
|
@ -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)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct ServerConstants {
|
pub struct ServerConstants {
|
||||||
pub day_cycle_coefficient: f64,
|
pub day_cycle_coefficient: f64,
|
||||||
|
@ -16,13 +16,13 @@ use common::{
|
|||||||
DeltaTime, EntitiesDiedLastTick, GameMode, PlayerEntity, PlayerPhysicsSettings, Time,
|
DeltaTime, EntitiesDiedLastTick, GameMode, PlayerEntity, PlayerPhysicsSettings, Time,
|
||||||
TimeOfDay,
|
TimeOfDay,
|
||||||
},
|
},
|
||||||
|
shared_server_config::ServerConstants,
|
||||||
slowjob::SlowJobPool,
|
slowjob::SlowJobPool,
|
||||||
terrain::{Block, MapSizeLg, TerrainChunk, TerrainGrid},
|
terrain::{Block, MapSizeLg, TerrainChunk, TerrainGrid},
|
||||||
time::DayPeriod,
|
time::DayPeriod,
|
||||||
trade::Trades,
|
trade::Trades,
|
||||||
vol::{ReadVol, WriteVol},
|
vol::{ReadVol, WriteVol},
|
||||||
weather::{Weather, WeatherGrid},
|
weather::{Weather, WeatherGrid},
|
||||||
shared_server_config::ServerConstants,
|
|
||||||
};
|
};
|
||||||
use common_base::span;
|
use common_base::span;
|
||||||
use common_ecs::{PhysicsMetrics, SysMetrics};
|
use common_ecs::{PhysicsMetrics, SysMetrics};
|
||||||
@ -595,7 +595,7 @@ impl State {
|
|||||||
add_systems: impl Fn(&mut DispatcherBuilder),
|
add_systems: impl Fn(&mut DispatcherBuilder),
|
||||||
update_terrain_and_regions: bool,
|
update_terrain_and_regions: bool,
|
||||||
mut metrics: Option<&mut StateTickMetrics>,
|
mut metrics: Option<&mut StateTickMetrics>,
|
||||||
server_constants: &ServerConstants
|
server_constants: &ServerConstants,
|
||||||
) {
|
) {
|
||||||
span!(_guard, "tick", "State::tick");
|
span!(_guard, "tick", "State::tick");
|
||||||
|
|
||||||
@ -609,7 +609,8 @@ impl State {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Change the time accordingly.
|
// 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.
|
// Update delta time.
|
||||||
// Beyond a delta time of MAX_DELTA_TIME, start lagging to avoid skipping
|
// Beyond a delta time of MAX_DELTA_TIME, start lagging to avoid skipping
|
||||||
|
@ -6,10 +6,11 @@ mod tests {
|
|||||||
Controller, Energy, Ori, PhysicsState, Poise, Pos, Skill, Stats, Vel,
|
Controller, Energy, Ori, PhysicsState, Poise, Pos, Skill, Stats, Vel,
|
||||||
},
|
},
|
||||||
resources::{DeltaTime, GameMode, Time},
|
resources::{DeltaTime, GameMode, Time},
|
||||||
|
shared_server_config::ServerConstants,
|
||||||
terrain::{MapSizeLg, TerrainChunk},
|
terrain::{MapSizeLg, TerrainChunk},
|
||||||
uid::Uid,
|
uid::Uid,
|
||||||
util::Dir,
|
util::Dir,
|
||||||
SkillSetBuilder, shared_server_config::ServerConstants,
|
SkillSetBuilder,
|
||||||
};
|
};
|
||||||
use common_ecs::dispatch;
|
use common_ecs::dispatch;
|
||||||
use common_state::State;
|
use common_state::State;
|
||||||
|
@ -1,10 +1,6 @@
|
|||||||
use crate::utils;
|
use crate::utils;
|
||||||
use approx::assert_relative_eq;
|
use approx::assert_relative_eq;
|
||||||
use common::{
|
use common::{comp::Controller, resources::Time, shared_server_config::ServerConstants};
|
||||||
comp::Controller,
|
|
||||||
resources::Time,
|
|
||||||
shared_server_config::ServerConstants,
|
|
||||||
};
|
|
||||||
use specs::WorldExt;
|
use specs::WorldExt;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use utils::{DT, DT_F64, EPSILON};
|
use utils::{DT, DT_F64, EPSILON};
|
||||||
|
@ -7,11 +7,11 @@ use common::{
|
|||||||
Vel,
|
Vel,
|
||||||
},
|
},
|
||||||
resources::{DeltaTime, GameMode, Time},
|
resources::{DeltaTime, GameMode, Time},
|
||||||
|
shared_server_config::ServerConstants,
|
||||||
skillset_builder::SkillSetBuilder,
|
skillset_builder::SkillSetBuilder,
|
||||||
terrain::{
|
terrain::{
|
||||||
Block, BlockKind, MapSizeLg, SpriteKind, TerrainChunk, TerrainChunkMeta, TerrainGrid,
|
Block, BlockKind, MapSizeLg, SpriteKind, TerrainChunk, TerrainChunkMeta, TerrainGrid,
|
||||||
},
|
},
|
||||||
shared_server_config::ServerConstants,
|
|
||||||
};
|
};
|
||||||
use common_ecs::{dispatch, System};
|
use common_ecs::{dispatch, System};
|
||||||
use common_net::sync::WorldSyncExt;
|
use common_net::sync::WorldSyncExt;
|
||||||
|
@ -79,10 +79,10 @@ use common::{
|
|||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
resources::{BattleMode, GameMode, Time, TimeOfDay},
|
resources::{BattleMode, GameMode, Time, TimeOfDay},
|
||||||
rtsim::RtSimEntity,
|
rtsim::RtSimEntity,
|
||||||
|
shared_server_config::ServerConstants,
|
||||||
slowjob::SlowJobPool,
|
slowjob::SlowJobPool,
|
||||||
terrain::{TerrainChunk, TerrainChunkSize},
|
terrain::{TerrainChunk, TerrainChunkSize},
|
||||||
vol::RectRasterableVol,
|
vol::RectRasterableVol,
|
||||||
shared_server_config::ServerConstants,
|
|
||||||
};
|
};
|
||||||
use common_ecs::run_now;
|
use common_ecs::run_now;
|
||||||
use common_net::{
|
use common_net::{
|
||||||
@ -565,7 +565,7 @@ impl Server {
|
|||||||
rtsim::init(&mut state);
|
rtsim::init(&mut state);
|
||||||
|
|
||||||
let server_constants = ServerConstants {
|
let server_constants = ServerConstants {
|
||||||
day_cycle_coefficient: 1400.0 / settings.day_length
|
day_cycle_coefficient: 1400.0 / settings.day_length,
|
||||||
};
|
};
|
||||||
|
|
||||||
let this = Self {
|
let this = Self {
|
||||||
@ -710,7 +710,7 @@ impl Server {
|
|||||||
},
|
},
|
||||||
false,
|
false,
|
||||||
Some(&mut state_tick_metrics),
|
Some(&mut state_tick_metrics),
|
||||||
&self.server_constants
|
&self.server_constants,
|
||||||
);
|
);
|
||||||
|
|
||||||
let before_handle_events = Instant::now();
|
let before_handle_events = Instant::now();
|
||||||
|
@ -10,8 +10,8 @@ use common::{
|
|||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
recipe::{default_component_recipe_book, default_recipe_book},
|
recipe::{default_component_recipe_book, default_recipe_book},
|
||||||
resources::TimeOfDay,
|
resources::TimeOfDay,
|
||||||
uid::{Uid, UidAllocator},
|
|
||||||
shared_server_config::ServerConstants,
|
shared_server_config::ServerConstants,
|
||||||
|
uid::{Uid, UidAllocator},
|
||||||
};
|
};
|
||||||
use common_base::prof_span;
|
use common_base::prof_span;
|
||||||
use common_ecs::{Job, Origin, Phase, System};
|
use common_ecs::{Job, Origin, Phase, System};
|
||||||
|
Loading…
Reference in New Issue
Block a user