mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
use cfg_attr
This commit is contained in:
parent
6659a512ec
commit
259fa94d61
@ -439,7 +439,7 @@ impl Client {
|
|||||||
auth_trusted: impl FnMut(&str) -> bool,
|
auth_trusted: impl FnMut(&str) -> bool,
|
||||||
init_stage_update: &(dyn Fn(ClientInitStage) + Send + Sync),
|
init_stage_update: &(dyn Fn(ClientInitStage) + Send + Sync),
|
||||||
add_foreign_systems: impl Fn(&mut DispatcherBuilder) + Send + 'static,
|
add_foreign_systems: impl Fn(&mut DispatcherBuilder) + Send + 'static,
|
||||||
#[allow(unused_variables)] config_dir: PathBuf,
|
#[cfg_attr(not(feature = "plugins"), allow(unused_variables))] config_dir: PathBuf,
|
||||||
) -> Result<Self, Error> {
|
) -> Result<Self, Error> {
|
||||||
let network = Network::new(Pid::new(), &runtime);
|
let network = Network::new(Pid::new(), &runtime);
|
||||||
|
|
||||||
@ -615,7 +615,6 @@ impl Client {
|
|||||||
init_stage_update(ClientInitStage::LoadingInitData);
|
init_stage_update(ClientInitStage::LoadingInitData);
|
||||||
// Wait for initial sync
|
// Wait for initial sync
|
||||||
let mut ping_interval = tokio::time::interval(Duration::from_secs(1));
|
let mut ping_interval = tokio::time::interval(Duration::from_secs(1));
|
||||||
#[allow(unused_variables)]
|
|
||||||
let ServerInit::GameSync {
|
let ServerInit::GameSync {
|
||||||
entity_package,
|
entity_package,
|
||||||
time_of_day,
|
time_of_day,
|
||||||
@ -629,7 +628,7 @@ impl Client {
|
|||||||
server_constants,
|
server_constants,
|
||||||
repair_recipe_book,
|
repair_recipe_book,
|
||||||
description,
|
description,
|
||||||
active_plugins,
|
active_plugins: _active_plugins,
|
||||||
} = loop {
|
} = loop {
|
||||||
tokio::select! {
|
tokio::select! {
|
||||||
// Spawn in a blocking thread (leaving the network thread free). This is mostly
|
// Spawn in a blocking thread (leaving the network thread free). This is mostly
|
||||||
@ -666,14 +665,15 @@ impl Client {
|
|||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
common_state::plugin::PluginMgr::from_asset_or_default(),
|
common_state::plugin::PluginMgr::from_asset_or_default(),
|
||||||
);
|
);
|
||||||
#[allow(unused_mut)]
|
|
||||||
|
#[cfg_attr(not(feature = "plugins"), allow(unused_mut))]
|
||||||
let mut missing_plugins: Vec<PluginHash> = Vec::new();
|
let mut missing_plugins: Vec<PluginHash> = Vec::new();
|
||||||
#[allow(unused_mut)]
|
#[cfg_attr(not(feature = "plugins"), allow(unused_mut))]
|
||||||
let mut local_plugins: Vec<PathBuf> = Vec::new();
|
let mut local_plugins: Vec<PathBuf> = Vec::new();
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
{
|
{
|
||||||
let already_present = state.ecs().read_resource::<PluginMgr>().plugin_list();
|
let already_present = state.ecs().read_resource::<PluginMgr>().plugin_list();
|
||||||
for hash in active_plugins.iter() {
|
for hash in _active_plugins.iter() {
|
||||||
if !already_present.contains(hash) {
|
if !already_present.contains(hash) {
|
||||||
// look in config_dir first (cache)
|
// look in config_dir first (cache)
|
||||||
if let Ok(local_path) = common_state::plugin::find_cached(&config_dir, hash)
|
if let Ok(local_path) = common_state::plugin::find_cached(&config_dir, hash)
|
||||||
|
@ -278,16 +278,17 @@ impl PlayState for CharSelectionState {
|
|||||||
Rc::clone(&self.client),
|
Rc::clone(&self.client),
|
||||||
)));
|
)));
|
||||||
},
|
},
|
||||||
client::Event::PluginDataReceived(_data) => {
|
#[cfg_attr(not(feature = "plugins"), allow(unused_variables))]
|
||||||
|
client::Event::PluginDataReceived(data) => {
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
{
|
{
|
||||||
tracing::info!("plugin data {}", _data.len());
|
tracing::info!("plugin data {}", data.len());
|
||||||
let mut client = self.client.borrow_mut();
|
let mut client = self.client.borrow_mut();
|
||||||
let hash = client
|
let hash = client
|
||||||
.state()
|
.state()
|
||||||
.ecs()
|
.ecs()
|
||||||
.write_resource::<PluginMgr>()
|
.write_resource::<PluginMgr>()
|
||||||
.cache_server_plugin(&global_state.config_dir, _data);
|
.cache_server_plugin(&global_state.config_dir, data);
|
||||||
match hash {
|
match hash {
|
||||||
Ok(hash) => {
|
Ok(hash) => {
|
||||||
if client.plugin_received(hash) == 0 {
|
if client.plugin_received(hash) == 0 {
|
||||||
|
@ -284,16 +284,17 @@ impl PlayState for MainMenuState {
|
|||||||
);
|
);
|
||||||
self.init = InitState::None;
|
self.init = InitState::None;
|
||||||
},
|
},
|
||||||
client::Event::PluginDataReceived(_data) => {
|
#[cfg_attr(not(feature = "plugins"), allow(unused_variables))]
|
||||||
|
client::Event::PluginDataReceived(data) => {
|
||||||
#[cfg(feature = "plugins")]
|
#[cfg(feature = "plugins")]
|
||||||
{
|
{
|
||||||
tracing::info!("plugin data {}", _data.len());
|
tracing::info!("plugin data {}", data.len());
|
||||||
if let InitState::Pipeline(client) = &mut self.init {
|
if let InitState::Pipeline(client) = &mut self.init {
|
||||||
let hash = client
|
let hash = client
|
||||||
.state()
|
.state()
|
||||||
.ecs()
|
.ecs()
|
||||||
.write_resource::<PluginMgr>()
|
.write_resource::<PluginMgr>()
|
||||||
.cache_server_plugin(&global_state.config_dir, _data);
|
.cache_server_plugin(&global_state.config_dir, data);
|
||||||
match hash {
|
match hash {
|
||||||
Ok(hash) => {
|
Ok(hash) => {
|
||||||
if client.plugin_received(hash) == 0 {
|
if client.plugin_received(hash) == 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user