mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Moved common networking code to common/net, clippy fixes
This commit is contained in:
parent
7963ad930c
commit
f8c8e342e6
72
Cargo.lock
generated
72
Cargo.lock
generated
@ -5531,7 +5531,8 @@ dependencies = [
|
|||||||
"uvth 3.1.1",
|
"uvth 3.1.1",
|
||||||
"vek 0.12.0",
|
"vek 0.12.0",
|
||||||
"veloren-common",
|
"veloren-common",
|
||||||
"veloren_common_sys",
|
"veloren-common-net",
|
||||||
|
"veloren-common-sys",
|
||||||
"veloren_network",
|
"veloren_network",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -5540,7 +5541,6 @@ name = "veloren-common"
|
|||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arraygen",
|
"arraygen",
|
||||||
"authc",
|
|
||||||
"criterion",
|
"criterion",
|
||||||
"crossbeam",
|
"crossbeam",
|
||||||
"csv",
|
"csv",
|
||||||
@ -5568,10 +5568,48 @@ dependencies = [
|
|||||||
"specs-idvs",
|
"specs-idvs",
|
||||||
"spin_sleep",
|
"spin_sleep",
|
||||||
"structopt",
|
"structopt",
|
||||||
|
"tracing",
|
||||||
|
"tracy-client",
|
||||||
|
"uuid",
|
||||||
|
"vek 0.12.0",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "veloren-common-net"
|
||||||
|
version = "0.8.0"
|
||||||
|
dependencies = [
|
||||||
|
"authc",
|
||||||
|
"hashbrown 0.7.2",
|
||||||
|
"serde",
|
||||||
|
"specs",
|
||||||
"sum_type",
|
"sum_type",
|
||||||
"tracing",
|
"tracing",
|
||||||
"tracy-client",
|
"tracy-client",
|
||||||
"vek 0.12.0",
|
"vek 0.12.0",
|
||||||
|
"veloren-common",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "veloren-common-sys"
|
||||||
|
version = "0.8.0"
|
||||||
|
dependencies = [
|
||||||
|
"bincode",
|
||||||
|
"hashbrown 0.7.2",
|
||||||
|
"indexmap",
|
||||||
|
"rand 0.7.3",
|
||||||
|
"rayon",
|
||||||
|
"serde",
|
||||||
|
"slab",
|
||||||
|
"specs",
|
||||||
|
"tar",
|
||||||
|
"toml",
|
||||||
|
"tracing",
|
||||||
|
"tracy-client",
|
||||||
|
"vek 0.12.0",
|
||||||
|
"veloren-common",
|
||||||
|
"veloren-common-net",
|
||||||
|
"veloren-plugin-api",
|
||||||
|
"wasmer-runtime",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -5634,9 +5672,10 @@ dependencies = [
|
|||||||
"uvth 3.1.1",
|
"uvth 3.1.1",
|
||||||
"vek 0.12.0",
|
"vek 0.12.0",
|
||||||
"veloren-common",
|
"veloren-common",
|
||||||
|
"veloren-common-net",
|
||||||
|
"veloren-common-sys",
|
||||||
"veloren-plugin-api",
|
"veloren-plugin-api",
|
||||||
"veloren-world",
|
"veloren-world",
|
||||||
"veloren_common_sys",
|
|
||||||
"veloren_network",
|
"veloren_network",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -5657,6 +5696,7 @@ dependencies = [
|
|||||||
"tracing-tracy",
|
"tracing-tracy",
|
||||||
"tui",
|
"tui",
|
||||||
"veloren-common",
|
"veloren-common",
|
||||||
|
"veloren-common-net",
|
||||||
"veloren-server",
|
"veloren-server",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -5716,10 +5756,11 @@ dependencies = [
|
|||||||
"vek 0.12.0",
|
"vek 0.12.0",
|
||||||
"veloren-client",
|
"veloren-client",
|
||||||
"veloren-common",
|
"veloren-common",
|
||||||
|
"veloren-common-net",
|
||||||
|
"veloren-common-sys",
|
||||||
"veloren-server",
|
"veloren-server",
|
||||||
"veloren-voxygen-anim",
|
"veloren-voxygen-anim",
|
||||||
"veloren-world",
|
"veloren-world",
|
||||||
"veloren_common_sys",
|
|
||||||
"window_clipboard",
|
"window_clipboard",
|
||||||
"winit",
|
"winit",
|
||||||
"winres",
|
"winres",
|
||||||
@ -5766,28 +5807,7 @@ dependencies = [
|
|||||||
"tracing-subscriber",
|
"tracing-subscriber",
|
||||||
"vek 0.12.0",
|
"vek 0.12.0",
|
||||||
"veloren-common",
|
"veloren-common",
|
||||||
]
|
"veloren-common-net",
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "veloren_common_sys"
|
|
||||||
version = "0.8.0"
|
|
||||||
dependencies = [
|
|
||||||
"bincode",
|
|
||||||
"hashbrown 0.7.2",
|
|
||||||
"indexmap",
|
|
||||||
"rand 0.7.3",
|
|
||||||
"rayon",
|
|
||||||
"serde",
|
|
||||||
"slab",
|
|
||||||
"specs",
|
|
||||||
"tar",
|
|
||||||
"toml",
|
|
||||||
"tracing",
|
|
||||||
"tracy-client",
|
|
||||||
"vek 0.12.0",
|
|
||||||
"veloren-common",
|
|
||||||
"veloren-plugin-api",
|
|
||||||
"wasmer-runtime",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -8,7 +8,6 @@ members = [
|
|||||||
"plugin/api",
|
"plugin/api",
|
||||||
"plugin/derive",
|
"plugin/derive",
|
||||||
"client",
|
"client",
|
||||||
"plugin-api",
|
|
||||||
"server",
|
"server",
|
||||||
"server-cli",
|
"server-cli",
|
||||||
"voxygen",
|
"voxygen",
|
||||||
|
@ -11,7 +11,8 @@ default = ["simd"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
common = { package = "veloren-common", path = "../common", features = ["no-assets"] }
|
common = { package = "veloren-common", path = "../common", features = ["no-assets"] }
|
||||||
common_sys = { package = "veloren_common_sys", path = "../common/sys", default-features = false }
|
common-sys = { package = "veloren-common-sys", path = "../common/sys", default-features = false }
|
||||||
|
common-net = { package = "veloren-common-net", path = "../common/net" }
|
||||||
network = { package = "veloren_network", path = "../network", features = ["compression"], default-features = false }
|
network = { package = "veloren_network", path = "../network", features = ["compression"], default-features = false }
|
||||||
|
|
||||||
byteorder = "1.3.2"
|
byteorder = "1.3.2"
|
||||||
|
@ -25,20 +25,23 @@ use common::{
|
|||||||
},
|
},
|
||||||
event::{EventBus, LocalEvent},
|
event::{EventBus, LocalEvent},
|
||||||
grid::Grid,
|
grid::Grid,
|
||||||
msg::{
|
|
||||||
validate_chat_msg, world_msg::SiteInfo, ChatMsgValidationError, ClientGeneral, ClientMsg,
|
|
||||||
ClientRegister, ClientType, DisconnectReason, InviteAnswer, Notification, PingMsg,
|
|
||||||
PlayerInfo, PlayerListUpdate, PresenceKind, RegisterError, ServerGeneral, ServerInfo,
|
|
||||||
ServerInit, ServerRegisterAnswer, MAX_BYTES_CHAT_MSG,
|
|
||||||
},
|
|
||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
recipe::RecipeBook,
|
recipe::RecipeBook,
|
||||||
span,
|
span,
|
||||||
sync::{Uid, UidAllocator, WorldSyncExt},
|
uid::{Uid, UidAllocator},
|
||||||
terrain::{block::Block, neighbors, BiomeKind, SitesKind, TerrainChunk, TerrainChunkSize},
|
terrain::{block::Block, neighbors, BiomeKind, SitesKind, TerrainChunk, TerrainChunkSize},
|
||||||
vol::RectVolSize,
|
vol::RectVolSize,
|
||||||
};
|
};
|
||||||
use common_sys::state::State;
|
use common_sys::state::State;
|
||||||
|
use common_net::{
|
||||||
|
msg::{
|
||||||
|
self, validate_chat_msg, world_msg::SiteInfo, ChatMsgValidationError, ClientGeneral, ClientMsg,
|
||||||
|
ClientRegister, ClientType, DisconnectReason, InviteAnswer, Notification, PingMsg,
|
||||||
|
PlayerInfo, PlayerListUpdate, PresenceKind, RegisterError, ServerGeneral, ServerInfo,
|
||||||
|
ServerInit, ServerRegisterAnswer, MAX_BYTES_CHAT_MSG,
|
||||||
|
},
|
||||||
|
sync::WorldSyncExt,
|
||||||
|
};
|
||||||
use comp::BuffKind;
|
use comp::BuffKind;
|
||||||
use futures_executor::block_on;
|
use futures_executor::block_on;
|
||||||
use futures_timer::Delay;
|
use futures_timer::Delay;
|
||||||
@ -1247,7 +1250,7 @@ impl Client {
|
|||||||
ServerGeneral::PlayerListUpdate(PlayerListUpdate::LevelChange(uid, next_level)) => {
|
ServerGeneral::PlayerListUpdate(PlayerListUpdate::LevelChange(uid, next_level)) => {
|
||||||
if let Some(player_info) = self.player_list.get_mut(&uid) {
|
if let Some(player_info) = self.player_list.get_mut(&uid) {
|
||||||
player_info.character = match &player_info.character {
|
player_info.character = match &player_info.character {
|
||||||
Some(character) => Some(common::msg::CharacterInfo {
|
Some(character) => Some(msg::CharacterInfo {
|
||||||
name: character.name.to_string(),
|
name: character.name.to_string(),
|
||||||
level: next_level,
|
level: next_level,
|
||||||
}),
|
}),
|
||||||
|
@ -24,9 +24,9 @@ rand = "0.7"
|
|||||||
rayon = "1.3.0"
|
rayon = "1.3.0"
|
||||||
roots = "0.0.6"
|
roots = "0.0.6"
|
||||||
spin_sleep = "1.0"
|
spin_sleep = "1.0"
|
||||||
sum_type = "0.2.0"
|
|
||||||
tracing = { version = "0.1", default-features = false }
|
tracing = { version = "0.1", default-features = false }
|
||||||
vek = { version = "0.12.0", features = ["serde"] }
|
vek = { version = "0.12.0", features = ["serde"] }
|
||||||
|
uuid = { version = "0.8.1", default-features = false, features = ["serde", "v4"] }
|
||||||
|
|
||||||
# Assets
|
# Assets
|
||||||
directories-next = "2.0"
|
directories-next = "2.0"
|
||||||
@ -34,9 +34,6 @@ dot_vox = "4.0"
|
|||||||
image = { version = "0.23.8", default-features = false, features = ["png"] }
|
image = { version = "0.23.8", default-features = false, features = ["png"] }
|
||||||
notify = "5.0.0-pre.3"
|
notify = "5.0.0-pre.3"
|
||||||
|
|
||||||
# Auth
|
|
||||||
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "b943c85e4a38f5ec60cd18c34c73097640162bfe" }
|
|
||||||
|
|
||||||
# Data structures
|
# Data structures
|
||||||
hashbrown = { version = "0.7.2", features = ["rayon", "serde", "nightly"] }
|
hashbrown = { version = "0.7.2", features = ["rayon", "serde", "nightly"] }
|
||||||
slotmap = { version = "0.4.0", features = ["serde", "unstable"] }
|
slotmap = { version = "0.4.0", features = ["serde", "unstable"] }
|
||||||
|
33
common/net/Cargo.toml
Normal file
33
common/net/Cargo.toml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
[package]
|
||||||
|
authors = ["Marcel Märtens <marcel.cochem@googlemail.com>"]
|
||||||
|
edition = "2018"
|
||||||
|
name = "veloren-common-net"
|
||||||
|
version = "0.8.0"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
tracy = ["tracy-client"]
|
||||||
|
simd = ["vek/platform_intrinsics"]
|
||||||
|
|
||||||
|
default = ["simd"]
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
common = {package = "veloren-common", path = "../../common"}
|
||||||
|
|
||||||
|
sum_type = "0.2.0"
|
||||||
|
vek = { version = "0.12.0", features = ["serde"] }
|
||||||
|
tracing = { version = "0.1", default-features = false }
|
||||||
|
|
||||||
|
# Data structures
|
||||||
|
hashbrown = { version = "0.7.2", features = ["rayon", "serde", "nightly"] }
|
||||||
|
|
||||||
|
# Auth
|
||||||
|
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "b943c85e4a38f5ec60cd18c34c73097640162bfe" }
|
||||||
|
|
||||||
|
# ECS
|
||||||
|
specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "storage-event-control"], rev = "7a2e348ab2223818bad487695c66c43db88050a5" }
|
||||||
|
|
||||||
|
# Serde
|
||||||
|
serde = { version = "1.0.110", features = ["derive"] }
|
||||||
|
|
||||||
|
# Tracy
|
||||||
|
tracy-client = { version = "0.9.0", optional = true }
|
2
common/net/src/lib.rs
Normal file
2
common/net/src/lib.rs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
pub mod msg;
|
||||||
|
pub mod sync;
|
@ -1,5 +1,5 @@
|
|||||||
use super::PingMsg;
|
use super::PingMsg;
|
||||||
use crate::{
|
use common::{
|
||||||
character::CharacterId,
|
character::CharacterId,
|
||||||
comp,
|
comp,
|
||||||
comp::{Skill, SkillGroupType},
|
comp::{Skill, SkillGroupType},
|
@ -1,4 +1,5 @@
|
|||||||
use crate::{comp, sync};
|
use common::comp;
|
||||||
|
use crate::sync;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use std::marker::PhantomData;
|
use std::marker::PhantomData;
|
||||||
use sum_type::sum_type;
|
use sum_type::sum_type;
|
@ -13,7 +13,7 @@ pub use self::{
|
|||||||
},
|
},
|
||||||
world_msg::WorldMapMsg,
|
world_msg::WorldMapMsg,
|
||||||
};
|
};
|
||||||
use crate::character::CharacterId;
|
use common::character::CharacterId;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
|
@ -1,14 +1,14 @@
|
|||||||
use super::{ClientType, EcsCompPacket, PingMsg};
|
use super::{ClientType, EcsCompPacket, PingMsg};
|
||||||
use crate::{
|
use common::{
|
||||||
character::CharacterItem,
|
character::{self, CharacterItem},
|
||||||
comp,
|
comp,
|
||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
recipe::RecipeBook,
|
recipe::RecipeBook,
|
||||||
resources::TimeOfDay,
|
resources::TimeOfDay,
|
||||||
sync,
|
uid::Uid,
|
||||||
sync::Uid,
|
|
||||||
terrain::{Block, TerrainChunk},
|
terrain::{Block, TerrainChunk},
|
||||||
};
|
};
|
||||||
|
use crate::sync;
|
||||||
use authc::AuthClientError;
|
use authc::AuthClientError;
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
@ -55,7 +55,7 @@ pub enum ServerInit {
|
|||||||
client_timeout: Duration,
|
client_timeout: Duration,
|
||||||
world_map: crate::msg::world_msg::WorldMapMsg,
|
world_map: crate::msg::world_msg::WorldMapMsg,
|
||||||
recipe_book: RecipeBook,
|
recipe_book: RecipeBook,
|
||||||
ability_map: crate::comp::item::tool::AbilityMap,
|
ability_map: comp::item::tool::AbilityMap,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ pub enum ServerGeneral {
|
|||||||
/// An error occurred while creating or deleting a character
|
/// An error occurred while creating or deleting a character
|
||||||
CharacterActionError(String),
|
CharacterActionError(String),
|
||||||
/// A new character was created
|
/// A new character was created
|
||||||
CharacterCreated(crate::character::CharacterId),
|
CharacterCreated(character::CharacterId),
|
||||||
CharacterSuccess,
|
CharacterSuccess,
|
||||||
//Ingame related
|
//Ingame related
|
||||||
GroupUpdate(comp::group::ChangeNotification<sync::Uid>),
|
GroupUpdate(comp::group::ChangeNotification<sync::Uid>),
|
||||||
@ -121,6 +121,15 @@ pub enum ServerGeneral {
|
|||||||
Notification(Notification),
|
Notification(Notification),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl ServerGeneral {
|
||||||
|
pub fn server_msg<S>(chat_type: comp::ChatType<String>, msg: S) -> Self
|
||||||
|
where
|
||||||
|
S: Into<String>,
|
||||||
|
{
|
||||||
|
ServerGeneral::ChatMsg(chat_type.chat_msg(msg))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
end of 2nd level Enums
|
end of 2nd level Enums
|
||||||
*/
|
*/
|
@ -1,4 +1,4 @@
|
|||||||
use crate::grid::Grid;
|
use common::grid::Grid;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
|
|
21
common/net/src/plugin/errors.rs
Normal file
21
common/net/src/plugin/errors.rs
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
use bincode::ErrorKind;
|
||||||
|
use wasmer_runtime::error::{ResolveError, RuntimeError};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum PluginError {
|
||||||
|
Io(std::io::Error),
|
||||||
|
Toml(toml::de::Error),
|
||||||
|
NoConfig,
|
||||||
|
NoSuchModule,
|
||||||
|
PluginModuleError(PluginModuleError)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum PluginModuleError {
|
||||||
|
FindFunction(String),
|
||||||
|
FunctionGet(ResolveError),
|
||||||
|
Compile(wasmer_runtime::error::CompileError),
|
||||||
|
Instantiate(wasmer_runtime::error::Error),
|
||||||
|
RunFunction(RuntimeError),
|
||||||
|
Encoding(Box<ErrorKind>),
|
||||||
|
}
|
138
common/net/src/plugin/mod.rs
Normal file
138
common/net/src/plugin/mod.rs
Normal file
@ -0,0 +1,138 @@
|
|||||||
|
|
||||||
|
pub mod errors;
|
||||||
|
pub mod module;
|
||||||
|
|
||||||
|
use common::assets::ASSETS_PATH;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::{collections::{HashMap, HashSet}, fs, io::Read, path::{Path, PathBuf}};
|
||||||
|
use tracing::{error, info};
|
||||||
|
|
||||||
|
use plugin_api::Event;
|
||||||
|
|
||||||
|
use self::{ errors::PluginError, module::{PluginModule, PreparedEventQuery}};
|
||||||
|
|
||||||
|
use rayon::prelude::*;
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||||
|
pub struct PluginData {
|
||||||
|
name: String,
|
||||||
|
modules: HashSet<PathBuf>,
|
||||||
|
dependencies: HashSet<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct Plugin {
|
||||||
|
data: PluginData,
|
||||||
|
modules: Vec<PluginModule>,
|
||||||
|
files: HashMap<PathBuf, Vec<u8>>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Plugin {
|
||||||
|
pub fn from_reader<R: Read>(mut reader: R) -> Result<Self, PluginError> {
|
||||||
|
let mut buf = Vec::new();
|
||||||
|
reader.read_to_end(&mut buf).map_err(PluginError::Io)?;
|
||||||
|
|
||||||
|
let mut files = tar::Archive::new(&*buf)
|
||||||
|
.entries()
|
||||||
|
.map_err(PluginError::Io)?
|
||||||
|
.map(|e| {
|
||||||
|
e.and_then(|e| {
|
||||||
|
Ok((e.path()?.into_owned(), {
|
||||||
|
let offset = e.raw_file_position() as usize;
|
||||||
|
buf[offset..offset + e.size() as usize].to_vec()
|
||||||
|
}))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.collect::<Result<HashMap<_, _>, _>>()
|
||||||
|
.map_err(PluginError::Io)?;
|
||||||
|
|
||||||
|
let data = toml::de::from_slice::<PluginData>(
|
||||||
|
&files
|
||||||
|
.get(Path::new("plugin.toml"))
|
||||||
|
.ok_or(PluginError::NoConfig)?,
|
||||||
|
)
|
||||||
|
.map_err(PluginError::Toml)?;
|
||||||
|
|
||||||
|
let modules = data
|
||||||
|
.modules
|
||||||
|
.iter()
|
||||||
|
.map(|path| {
|
||||||
|
let wasm_data = files.remove(path).ok_or(PluginError::NoSuchModule)?;
|
||||||
|
PluginModule::new(&wasm_data).map_err(|e| PluginError::PluginModuleError(e))
|
||||||
|
})
|
||||||
|
.collect::<Result<_, _>>()?;
|
||||||
|
|
||||||
|
Ok(Plugin {
|
||||||
|
data,
|
||||||
|
modules,
|
||||||
|
files,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn execute_prepared<T>(&self, event_name: &str, event: &PreparedEventQuery<T>) -> Result<Vec<T::Response>, PluginError> where T: Event {
|
||||||
|
self.modules.iter().flat_map(|module| {
|
||||||
|
module.try_execute(event_name, event).map(|x| x.map_err(|e| PluginError::PluginModuleError(e)))
|
||||||
|
}).collect::<Result<Vec<_>,_>>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Default)]
|
||||||
|
pub struct PluginMgr {
|
||||||
|
plugins: Vec<Plugin>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PluginMgr {
|
||||||
|
pub fn from_assets() -> Result<Self, PluginError> {
|
||||||
|
let mut assets_path = (&*ASSETS_PATH).clone();
|
||||||
|
assets_path.push("plugins");
|
||||||
|
info!("Searching {:?} for assets...", assets_path);
|
||||||
|
Self::from_dir(assets_path)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn execute_prepared<T>(&self, event_name: &str,event: &PreparedEventQuery<T>) -> Result<Vec<T::Response>, PluginError> where T: Event {
|
||||||
|
Ok(self.plugins.par_iter().map(|plugin| {
|
||||||
|
plugin.execute_prepared(event_name, event)
|
||||||
|
}).collect::<Result<Vec<_>,_>>()?.into_iter().flatten().collect())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn execute_event<T>(&self, event_name: &str,event: &T) -> Result<Vec<T::Response>, PluginError> where T: Event {
|
||||||
|
self.execute_prepared(event_name, &PreparedEventQuery::new(event)?)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn from_dir<P: AsRef<Path>>(path: P) -> Result<Self, PluginError> {
|
||||||
|
let plugins = fs::read_dir(path)
|
||||||
|
.map_err(PluginError::Io)?
|
||||||
|
.filter_map(|e| e.ok())
|
||||||
|
.map(|entry| {
|
||||||
|
if entry.file_type().map(|ft| ft.is_file()).unwrap_or(false)
|
||||||
|
&& entry
|
||||||
|
.path()
|
||||||
|
.file_name()
|
||||||
|
.and_then(|n| n.to_str())
|
||||||
|
.map(|s| s.ends_with(".plugin.tar"))
|
||||||
|
.unwrap_or(false)
|
||||||
|
{
|
||||||
|
info!("Loading plugin at {:?}", entry.path());
|
||||||
|
Plugin::from_reader(fs::File::open(entry.path()).map_err(PluginError::Io)?)
|
||||||
|
.map(Some)
|
||||||
|
} else {
|
||||||
|
Ok(None)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.filter_map(Result::transpose)
|
||||||
|
.inspect(|p| {
|
||||||
|
let _ = p.as_ref().map_err(|e| error!(?e, "Failed to load plugin"));
|
||||||
|
})
|
||||||
|
.collect::<Result<Vec<_>, _>>()?;
|
||||||
|
|
||||||
|
for plugin in &plugins {
|
||||||
|
info!(
|
||||||
|
"Loaded plugin '{}' with {} module(s)",
|
||||||
|
plugin.data.name,
|
||||||
|
plugin.modules.len()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Ok(Self { plugins })
|
||||||
|
}
|
||||||
|
}
|
150
common/net/src/plugin/module.rs
Normal file
150
common/net/src/plugin/module.rs
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
use std::{
|
||||||
|
cell::Cell,
|
||||||
|
collections::HashSet,
|
||||||
|
marker::PhantomData,
|
||||||
|
sync::{Arc, Mutex},
|
||||||
|
};
|
||||||
|
|
||||||
|
use error::RuntimeError;
|
||||||
|
use wasmer_runtime::*;
|
||||||
|
|
||||||
|
use super::errors::{PluginError, PluginModuleError};
|
||||||
|
use plugin_api::{Action, Event};
|
||||||
|
|
||||||
|
// This represent a WASM function interface
|
||||||
|
pub type Function<'a> = Func<'a, (i32, u32), i32>;
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
// This structure represent the WASM State of the plugin.
|
||||||
|
pub struct PluginModule {
|
||||||
|
wasm_instance: Arc<Mutex<Instance>>,
|
||||||
|
events: HashSet<String>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PluginModule {
|
||||||
|
|
||||||
|
// This function takes bytes from a WASM File and compile them
|
||||||
|
pub fn new(wasm_data: &Vec<u8>) -> Result<Self,PluginModuleError> {
|
||||||
|
let module = compile(&wasm_data).map_err(|e| PluginModuleError::Compile(e))?;
|
||||||
|
let instance = module
|
||||||
|
.instantiate(&imports! {"env" => {
|
||||||
|
"raw_emit_actions" => func!(read_action),
|
||||||
|
}}).map_err(|e| PluginModuleError::Instantiate(e))?;
|
||||||
|
|
||||||
|
Ok(Self {
|
||||||
|
events: instance.exports.into_iter().map(|(name, _)| name).collect(),
|
||||||
|
wasm_instance: Arc::new(Mutex::new(instance)),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// This function tries to execute an event for the current module. Will return None if the event doesn't exists
|
||||||
|
pub fn try_execute<T>(
|
||||||
|
&self,
|
||||||
|
event_name: &str,
|
||||||
|
request: &PreparedEventQuery<T>,
|
||||||
|
) -> Option<Result<T::Response,PluginModuleError>>
|
||||||
|
where
|
||||||
|
T: Event,
|
||||||
|
{
|
||||||
|
if !self.events.contains(event_name) {
|
||||||
|
return None;
|
||||||
|
}
|
||||||
|
let bytes = {
|
||||||
|
let instance = self.wasm_instance.lock().unwrap();
|
||||||
|
let func = match instance.exports.get(event_name).map_err(|e| PluginModuleError::FunctionGet(e)) {
|
||||||
|
Ok(e) => e,
|
||||||
|
Err(e) => return Some(Err(e))
|
||||||
|
};
|
||||||
|
let mem = instance.context().memory(0);
|
||||||
|
match execute_raw(&mem, &func, &request.bytes).map_err(|e| PluginModuleError::RunFunction(e)) {
|
||||||
|
Ok(e) => e,
|
||||||
|
Err(e) => return Some(Err(e))
|
||||||
|
}
|
||||||
|
};
|
||||||
|
Some(bincode::deserialize(&bytes).map_err(|e| PluginModuleError::Encoding(e)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// This structure represent a Pre-encoded event object (Useful to avoid reencoding for each module in every plugin)
|
||||||
|
pub struct PreparedEventQuery<T> {
|
||||||
|
bytes: Vec<u8>,
|
||||||
|
_phantom: PhantomData<T>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<T: Event> PreparedEventQuery<T> {
|
||||||
|
// Create a prepared query from an event reference (Encode to bytes the struct)
|
||||||
|
// This Prepared Query is used by the `try_execute` method in `PluginModule`
|
||||||
|
pub fn new(event: &T) -> Result<Self, PluginError>
|
||||||
|
where
|
||||||
|
T: Event,
|
||||||
|
{
|
||||||
|
Ok(Self {
|
||||||
|
bytes: bincode::serialize(&event).map_err(|e| PluginError::PluginModuleError(PluginModuleError::Encoding(e)))?,
|
||||||
|
_phantom: PhantomData::default(),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const MEMORY_POS: usize = 100000;
|
||||||
|
|
||||||
|
// This function is not public because this function should not be used without an interface to limit unsafe behaviours
|
||||||
|
fn execute_raw(
|
||||||
|
memory: &Memory,
|
||||||
|
function: &Function,
|
||||||
|
bytes: &[u8],
|
||||||
|
) -> Result<Vec<u8>, RuntimeError> {
|
||||||
|
let view = memory.view::<u8>();
|
||||||
|
let len = bytes.len();
|
||||||
|
for (cell, byte) in view[MEMORY_POS..len + MEMORY_POS].iter().zip(bytes.iter()) {
|
||||||
|
cell.set(*byte)
|
||||||
|
}
|
||||||
|
let start = function
|
||||||
|
.call(MEMORY_POS as i32, len as u32)? as usize;
|
||||||
|
let view = memory.view::<u8>();
|
||||||
|
let mut new_len_bytes = [0u8; 4];
|
||||||
|
// TODO: It is probably better to dirrectly make the new_len_bytes
|
||||||
|
for i in 0..4 {
|
||||||
|
new_len_bytes[i] = view.get(i + 1).map(Cell::get).unwrap_or(0);
|
||||||
|
}
|
||||||
|
let new_len = u32::from_ne_bytes(new_len_bytes) as usize;
|
||||||
|
Ok(view[start..start + new_len]
|
||||||
|
.iter()
|
||||||
|
.map(|c| c.get())
|
||||||
|
.collect())
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn read_action(ctx: &mut Ctx, ptr: u32, len: u32) {
|
||||||
|
let memory = ctx.memory(0);
|
||||||
|
|
||||||
|
let memory = memory.view::<u8>();
|
||||||
|
|
||||||
|
let str_slice = &memory[ptr as usize..(ptr + len) as usize];
|
||||||
|
|
||||||
|
let bytes: Vec<u8> = str_slice.iter().map(|x| x.get()).collect();
|
||||||
|
|
||||||
|
let e: Vec<Action> = match bincode::deserialize(&bytes) {
|
||||||
|
Ok(e) => e,
|
||||||
|
Err(e) => {
|
||||||
|
tracing::error!(?e, "Can't decode action");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for action in e {
|
||||||
|
match action {
|
||||||
|
Action::ServerClose => {
|
||||||
|
tracing::info!("Server closed by plugin");
|
||||||
|
std::process::exit(-1);
|
||||||
|
}
|
||||||
|
Action::Print(e) => {
|
||||||
|
tracing::info!("{}",e);
|
||||||
|
}
|
||||||
|
Action::PlayerSendMessage(a, b) => {
|
||||||
|
tracing::info!("SendMessage {} -> {}",a,b);
|
||||||
|
}
|
||||||
|
Action::KillEntity(e) => {
|
||||||
|
tracing::info!("Kill Entity {}",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -3,7 +3,6 @@
|
|||||||
mod packet;
|
mod packet;
|
||||||
mod sync_ext;
|
mod sync_ext;
|
||||||
mod track;
|
mod track;
|
||||||
mod uid;
|
|
||||||
|
|
||||||
// Reexports
|
// Reexports
|
||||||
pub use packet::{
|
pub use packet::{
|
||||||
@ -12,4 +11,4 @@ pub use packet::{
|
|||||||
};
|
};
|
||||||
pub use sync_ext::WorldSyncExt;
|
pub use sync_ext::WorldSyncExt;
|
||||||
pub use track::UpdateTracker;
|
pub use track::UpdateTracker;
|
||||||
pub use uid::{Uid, UidAllocator};
|
pub use common::uid::{Uid, UidAllocator};
|
@ -1,4 +1,5 @@
|
|||||||
use super::{track::UpdateTracker, uid::Uid};
|
use super::track::UpdateTracker;
|
||||||
|
use common::uid::Uid;
|
||||||
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
use serde::{de::DeserializeOwned, Deserialize, Serialize};
|
||||||
use specs::{Component, Entity, Join, ReadStorage, World, WorldExt};
|
use specs::{Component, Entity, Join, ReadStorage, World, WorldExt};
|
||||||
use std::{
|
use std::{
|
@ -3,8 +3,8 @@ use super::{
|
|||||||
CompPacket, CompSyncPackage, CompUpdateKind, EntityPackage, EntitySyncPackage, StatePackage,
|
CompPacket, CompSyncPackage, CompUpdateKind, EntityPackage, EntitySyncPackage, StatePackage,
|
||||||
},
|
},
|
||||||
track::UpdateTracker,
|
track::UpdateTracker,
|
||||||
uid::{Uid, UidAllocator},
|
|
||||||
};
|
};
|
||||||
|
use common::uid::{Uid, UidAllocator};
|
||||||
use specs::{
|
use specs::{
|
||||||
saveload::{MarkedBuilder, MarkerAllocator},
|
saveload::{MarkedBuilder, MarkerAllocator},
|
||||||
world::Builder,
|
world::Builder,
|
@ -1,7 +1,5 @@
|
|||||||
use super::{
|
use super::packet::{CompPacket, CompUpdateKind};
|
||||||
packet::{CompPacket, CompUpdateKind},
|
use common::uid::Uid;
|
||||||
uid::Uid,
|
|
||||||
};
|
|
||||||
use specs::{BitSet, Component, Entity, Join, ReadStorage, World, WorldExt};
|
use specs::{BitSet, Component, Entity, Join, ReadStorage, World, WorldExt};
|
||||||
use std::{
|
use std::{
|
||||||
convert::{TryFrom, TryInto},
|
convert::{TryFrom, TryInto},
|
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{HealthChange, HealthSource, Loadout},
|
comp::{HealthChange, HealthSource, Loadout},
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
util::Dir,
|
util::Dir,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -2,7 +2,7 @@ use crate::{
|
|||||||
comp::{humanoid, quadruped_low, quadruped_medium, quadruped_small, Body},
|
comp::{humanoid, quadruped_low, quadruped_medium, quadruped_small, Body},
|
||||||
path::Chaser,
|
path::Chaser,
|
||||||
rtsim::RtSimController,
|
rtsim::RtSimController,
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
};
|
};
|
||||||
use specs::{Component, Entity as EcsEntity};
|
use specs::{Component, Entity as EcsEntity};
|
||||||
use specs_idvs::IdvStorage;
|
use specs_idvs::IdvStorage;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::{sync::Uid, Damage, GroupTarget};
|
use crate::{uid::Uid, Damage, GroupTarget};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::{Component, FlaggedStorage};
|
use specs::{Component, FlaggedStorage};
|
||||||
use specs_idvs::IdvStorage;
|
use specs_idvs::IdvStorage;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::sync::Uid;
|
use crate::uid::Uid;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::{Component, FlaggedStorage};
|
use specs::{Component, FlaggedStorage};
|
||||||
use specs_idvs::IdvStorage;
|
use specs_idvs::IdvStorage;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::{comp::group::Group, msg::ServerGeneral, sync::Uid};
|
use crate::{comp::group::Group, uid::Uid};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::Component;
|
use specs::Component;
|
||||||
use specs_idvs::IdvStorage;
|
use specs_idvs::IdvStorage;
|
||||||
@ -118,14 +118,7 @@ impl<G> ChatType<G> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
impl ChatType<String> {
|
|
||||||
pub fn server_msg<S>(self, msg: S) -> ServerGeneral
|
|
||||||
where
|
|
||||||
S: Into<String>,
|
|
||||||
{
|
|
||||||
ServerGeneral::ChatMsg(self.chat_msg(msg))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Stores chat text, type
|
// Stores chat text, type
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
pub struct GenericChatMsg<G> {
|
pub struct GenericChatMsg<G> {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::{inventory::slot::Slot, BuffKind},
|
comp::{inventory::slot::Slot, BuffKind},
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
util::Dir,
|
util::Dir,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::{comp::Alignment, sync::Uid};
|
use crate::{comp::Alignment, uid::Uid};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use slab::Slab;
|
use slab::Slab;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::{comp::Body, sync::Uid, DamageSource};
|
use crate::{comp::Body, uid::Uid, DamageSource};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::{Component, FlaggedStorage};
|
use specs::{Component, FlaggedStorage};
|
||||||
use specs_idvs::IdvStorage;
|
use specs_idvs::IdvStorage;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use super::item::Reagent;
|
use super::item::Reagent;
|
||||||
use crate::sync::Uid;
|
use crate::uid::Uid;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::Component;
|
use specs::Component;
|
||||||
use specs_idvs::IdvStorage;
|
use specs_idvs::IdvStorage;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::{sync::Uid, util::Dir};
|
use crate::{uid::Uid, util::Dir};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::{Component, FlaggedStorage, NullStorage};
|
use specs::{Component, FlaggedStorage, NullStorage};
|
||||||
use specs_idvs::IdvStorage;
|
use specs_idvs::IdvStorage;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use authc::Uuid;
|
use uuid::Uuid;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::{Component, FlaggedStorage, NullStorage};
|
use specs::{Component, FlaggedStorage, NullStorage};
|
||||||
use specs_idvs::IdvStorage;
|
use specs_idvs::IdvStorage;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
comp::buff::{BuffCategory, BuffData, BuffKind},
|
comp::buff::{BuffCategory, BuffData, BuffKind},
|
||||||
effect::{self, BuffEffect},
|
effect::{self, BuffEffect},
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
Damage, DamageSource, Explosion, GroupTarget, Knockback, RadiusEffect,
|
Damage, DamageSource, Explosion, GroupTarget, Knockback, RadiusEffect,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::{sync::Uid, Damage, GroupTarget, Knockback};
|
use crate::{uid::Uid, Damage, GroupTarget, Knockback};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::{Component, FlaggedStorage};
|
use specs::{Component, FlaggedStorage};
|
||||||
use specs_idvs::IdvStorage;
|
use specs_idvs::IdvStorage;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use crate::{character::CharacterId, comp, rtsim::RtSimEntity, sync::Uid, util::Dir, Explosion};
|
use crate::{character::CharacterId, comp, rtsim::RtSimEntity, uid::Uid, util::Dir, Explosion};
|
||||||
use comp::{
|
use comp::{
|
||||||
item::{Item, Reagent},
|
item::{Item, Reagent},
|
||||||
Ori, Pos,
|
Ori, Pos,
|
||||||
|
@ -34,7 +34,6 @@ pub mod grid;
|
|||||||
pub mod loadout_builder;
|
pub mod loadout_builder;
|
||||||
pub mod lottery;
|
pub mod lottery;
|
||||||
pub mod metrics;
|
pub mod metrics;
|
||||||
pub mod msg;
|
|
||||||
pub mod npc;
|
pub mod npc;
|
||||||
pub mod outcome;
|
pub mod outcome;
|
||||||
pub mod path;
|
pub mod path;
|
||||||
@ -46,11 +45,11 @@ pub mod rtsim;
|
|||||||
pub mod spiral;
|
pub mod spiral;
|
||||||
pub mod states;
|
pub mod states;
|
||||||
pub mod store;
|
pub mod store;
|
||||||
pub mod sync;
|
|
||||||
pub mod terrain;
|
pub mod terrain;
|
||||||
pub mod time;
|
pub mod time;
|
||||||
pub mod typed;
|
pub mod typed;
|
||||||
pub mod util;
|
pub mod util;
|
||||||
|
pub mod uid;
|
||||||
pub mod vol;
|
pub mod vol;
|
||||||
pub mod volumes;
|
pub mod volumes;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ use crate::{
|
|||||||
behavior::{CharacterBehavior, JoinData},
|
behavior::{CharacterBehavior, JoinData},
|
||||||
utils::*,
|
utils::*,
|
||||||
},
|
},
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
Damage, DamageSource, GroupTarget,
|
Damage, DamageSource, GroupTarget,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
@ -4,7 +4,7 @@ use crate::{
|
|||||||
Health, Loadout, Ori, PhysicsState, Pos, StateUpdate, Vel,
|
Health, Loadout, Ori, PhysicsState, Pos, StateUpdate, Vel,
|
||||||
},
|
},
|
||||||
resources::DeltaTime,
|
resources::DeltaTime,
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
};
|
};
|
||||||
use specs::{
|
use specs::{
|
||||||
hibitset,
|
hibitset,
|
||||||
|
@ -139,7 +139,9 @@ impl Body {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn can_climb(&self) -> bool { matches!(self, Body::Humanoid(_)) }
|
pub fn can_climb(&self) -> bool {
|
||||||
|
matches!(self, Body::Humanoid(_))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Handles updating `Components` to move player based on state of `JoinData`
|
/// Handles updating `Components` to move player based on state of `JoinData`
|
||||||
|
@ -147,7 +147,7 @@ impl MapSizeLg {
|
|||||||
// not technically been stabilized yet, Clippy probably doesn't check for this
|
// not technically been stabilized yet, Clippy probably doesn't check for this
|
||||||
// case yet. When it can, or when is_some() is stabilized as a `const fn`,
|
// case yet. When it can, or when is_some() is stabilized as a `const fn`,
|
||||||
// we should deal with this.
|
// we should deal with this.
|
||||||
#[allow(clippy::redundant_pattern_matching)]
|
#[allow(clippy::redundant_pattern_matching, clippy::result_unit_err)]
|
||||||
/// Construct a new `MapSizeLg`, returning an error if the needed invariants
|
/// Construct a new `MapSizeLg`, returning an error if the needed invariants
|
||||||
/// do not hold and the vector otherwise.
|
/// do not hold and the vector otherwise.
|
||||||
///
|
///
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
[package]
|
[package]
|
||||||
authors = ["Marcel Märtens <marcel.cochem@googlemail.com>"]
|
authors = ["Marcel Märtens <marcel.cochem@googlemail.com>"]
|
||||||
edition = "2018"
|
edition = "2018"
|
||||||
name = "veloren_common_sys"
|
name = "veloren-common-sys"
|
||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
|
|
||||||
[lib]
|
|
||||||
name = "common_sys"
|
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
tracy = ["tracy-client"]
|
tracy = ["tracy-client"]
|
||||||
simd = ["vek/platform_intrinsics"]
|
simd = ["vek/platform_intrinsics"]
|
||||||
@ -14,7 +11,8 @@ simd = ["vek/platform_intrinsics"]
|
|||||||
default = ["simd"]
|
default = ["simd"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
common = {package = "veloren-common", path = "../../common"}
|
common = { package = "veloren-common", path = ".." }
|
||||||
|
common-net = { package = "veloren-common-net", path = "../net" }
|
||||||
|
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
rayon = "1.3.0"
|
rayon = "1.3.0"
|
||||||
|
@ -17,7 +17,7 @@ use common::{
|
|||||||
path::{Chaser, TraversalConfig},
|
path::{Chaser, TraversalConfig},
|
||||||
resources::{DeltaTime, Time, TimeOfDay},
|
resources::{DeltaTime, Time, TimeOfDay},
|
||||||
span,
|
span,
|
||||||
sync::{Uid, UidAllocator},
|
uid::{Uid, UidAllocator},
|
||||||
terrain::{Block, TerrainGrid},
|
terrain::{Block, TerrainGrid},
|
||||||
time::DayPeriod,
|
time::DayPeriod,
|
||||||
util::Dir,
|
util::Dir,
|
||||||
|
@ -5,7 +5,7 @@ use common::{
|
|||||||
},
|
},
|
||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
resources::{DeltaTime, Time},
|
resources::{DeltaTime, Time},
|
||||||
sync::{Uid, UidAllocator},
|
uid::{Uid, UidAllocator},
|
||||||
GroupTarget,
|
GroupTarget,
|
||||||
};
|
};
|
||||||
use specs::{saveload::MarkerAllocator, Entities, Join, Read, ReadStorage, System, WriteStorage};
|
use specs::{saveload::MarkerAllocator, Entities, Join, Read, ReadStorage, System, WriteStorage};
|
||||||
|
@ -11,7 +11,7 @@ use common::{
|
|||||||
self,
|
self,
|
||||||
behavior::{CharacterBehavior, JoinData, JoinTuple},
|
behavior::{CharacterBehavior, JoinData, JoinTuple},
|
||||||
},
|
},
|
||||||
sync::{Uid, UidAllocator},
|
uid::{Uid, UidAllocator},
|
||||||
};
|
};
|
||||||
|
|
||||||
use specs::{Entities, Join, LazyUpdate, Read, ReadExpect, ReadStorage, System, WriteStorage};
|
use specs::{Entities, Join, LazyUpdate, Read, ReadExpect, ReadStorage, System, WriteStorage};
|
||||||
|
@ -7,7 +7,7 @@ use common::{
|
|||||||
metrics::SysMetrics,
|
metrics::SysMetrics,
|
||||||
resources::DeltaTime,
|
resources::DeltaTime,
|
||||||
span,
|
span,
|
||||||
sync::{Uid, UidAllocator},
|
uid::{Uid, UidAllocator},
|
||||||
};
|
};
|
||||||
use specs::{
|
use specs::{
|
||||||
saveload::{Marker, MarkerAllocator},
|
saveload::{Marker, MarkerAllocator},
|
||||||
|
@ -3,7 +3,7 @@ use common::{
|
|||||||
event::{EventBus, LocalEvent, ServerEvent},
|
event::{EventBus, LocalEvent, ServerEvent},
|
||||||
metrics::SysMetrics,
|
metrics::SysMetrics,
|
||||||
span,
|
span,
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
util::Dir,
|
util::Dir,
|
||||||
GroupTarget,
|
GroupTarget,
|
||||||
};
|
};
|
||||||
|
@ -2,7 +2,7 @@ use common::{
|
|||||||
comp::{Controller, MountState, Mounting, Ori, Pos, Vel},
|
comp::{Controller, MountState, Mounting, Ori, Pos, Vel},
|
||||||
metrics::SysMetrics,
|
metrics::SysMetrics,
|
||||||
span,
|
span,
|
||||||
sync::UidAllocator,
|
uid::UidAllocator,
|
||||||
};
|
};
|
||||||
use specs::{
|
use specs::{
|
||||||
saveload::{Marker, MarkerAllocator},
|
saveload::{Marker, MarkerAllocator},
|
||||||
|
@ -8,7 +8,7 @@ use common::{
|
|||||||
metrics::{PhysicsMetrics, SysMetrics},
|
metrics::{PhysicsMetrics, SysMetrics},
|
||||||
resources::DeltaTime,
|
resources::DeltaTime,
|
||||||
span,
|
span,
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
terrain::{Block, TerrainGrid},
|
terrain::{Block, TerrainGrid},
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@ use common::{
|
|||||||
metrics::SysMetrics,
|
metrics::SysMetrics,
|
||||||
resources::DeltaTime,
|
resources::DeltaTime,
|
||||||
span,
|
span,
|
||||||
sync::UidAllocator,
|
uid::UidAllocator,
|
||||||
GroupTarget,
|
GroupTarget,
|
||||||
};
|
};
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
|
@ -5,7 +5,7 @@ use common::{
|
|||||||
},
|
},
|
||||||
event::{EventBus, LocalEvent, ServerEvent},
|
event::{EventBus, LocalEvent, ServerEvent},
|
||||||
resources::{DeltaTime, Time},
|
resources::{DeltaTime, Time},
|
||||||
sync::{Uid, UidAllocator},
|
uid::{Uid, UidAllocator},
|
||||||
util::Dir,
|
util::Dir,
|
||||||
GroupTarget,
|
GroupTarget,
|
||||||
};
|
};
|
||||||
|
@ -5,12 +5,12 @@ use common::{
|
|||||||
region::RegionMap,
|
region::RegionMap,
|
||||||
resources::{DeltaTime, Time, TimeOfDay},
|
resources::{DeltaTime, Time, TimeOfDay},
|
||||||
span,
|
span,
|
||||||
sync::WorldSyncExt,
|
|
||||||
terrain::{Block, TerrainChunk, TerrainGrid},
|
terrain::{Block, TerrainChunk, TerrainGrid},
|
||||||
time::DayPeriod,
|
time::DayPeriod,
|
||||||
vol::{ReadVol, WriteVol},
|
vol::{ReadVol, WriteVol},
|
||||||
resources,
|
resources,
|
||||||
};
|
};
|
||||||
|
use common_net::sync::WorldSyncExt;
|
||||||
use hashbrown::{HashMap, HashSet};
|
use hashbrown::{HashMap, HashSet};
|
||||||
use rayon::{ThreadPool, ThreadPoolBuilder};
|
use rayon::{ThreadPool, ThreadPoolBuilder};
|
||||||
use specs::{
|
use specs::{
|
||||||
|
@ -77,7 +77,7 @@ impl RemoteInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_info(&self, id: u32) -> Option<FileInfo> { self.infos.get(&id).map(|fi| fi.clone()) }
|
pub fn get_info(&self, id: u32) -> Option<FileInfo> { self.infos.get(&id).cloned() }
|
||||||
|
|
||||||
pub fn insert_infos(&mut self, mut fi: Vec<FileInfo>) {
|
pub fn insert_infos(&mut self, mut fi: Vec<FileInfo>) {
|
||||||
for fi in fi.drain(..) {
|
for fi in fi.drain(..) {
|
||||||
|
@ -71,7 +71,7 @@ fn file_exists(file: String) -> Result<(), String> {
|
|||||||
if file.exists() {
|
if file.exists() {
|
||||||
Ok(())
|
Ok(())
|
||||||
} else {
|
} else {
|
||||||
Err(format!("File does not exist"))
|
Err("File does not exist".to_string())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +203,7 @@ async fn client(mut cmd_sender: mpsc::UnboundedSender<LocalCommand>) {
|
|||||||
// this 100 ms is because i am super lazy, and i want to appear the logs before
|
// this 100 ms is because i am super lazy, and i want to appear the logs before
|
||||||
// the next '==>' appears...
|
// the next '==>' appears...
|
||||||
thread::sleep(Duration::from_millis(100));
|
thread::sleep(Duration::from_millis(100));
|
||||||
println!("");
|
println!();
|
||||||
}
|
}
|
||||||
thread::sleep(Duration::from_millis(30)); // TODO: still needed for correct shutdown
|
thread::sleep(Duration::from_millis(30)); // TODO: still needed for correct shutdown
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
#![allow(clippy::eval_order_dependence)]
|
||||||
|
|
||||||
use crate::commands::{Command, FileInfo, LocalCommand, RemoteInfo};
|
use crate::commands::{Command, FileInfo, LocalCommand, RemoteInfo};
|
||||||
use async_std::{
|
use async_std::{
|
||||||
fs,
|
fs,
|
||||||
@ -58,22 +60,16 @@ impl Server {
|
|||||||
command_receiver
|
command_receiver
|
||||||
.for_each_concurrent(None, async move |cmd| {
|
.for_each_concurrent(None, async move |cmd| {
|
||||||
match cmd {
|
match cmd {
|
||||||
LocalCommand::Shutdown => {
|
LocalCommand::Shutdown => println!("Shutting down service"),
|
||||||
println!("Shutting down service");
|
|
||||||
return;
|
|
||||||
},
|
|
||||||
LocalCommand::Disconnect => {
|
LocalCommand::Disconnect => {
|
||||||
self.remotes.write().await.clear();
|
self.remotes.write().await.clear();
|
||||||
println!("Disconnecting all connections");
|
println!("Disconnecting all connections");
|
||||||
return;
|
|
||||||
},
|
},
|
||||||
LocalCommand::Connect(addr) => {
|
LocalCommand::Connect(addr) => {
|
||||||
println!("Trying to connect to: {:?}", &addr);
|
println!("Trying to connect to: {:?}", &addr);
|
||||||
match self.network.connect(addr.clone()).await {
|
match self.network.connect(addr.clone()).await {
|
||||||
Ok(p) => self.loop_participant(p).await,
|
Ok(p) => self.loop_participant(p).await,
|
||||||
Err(e) => {
|
Err(e) => println!("Failed to connect to {:?}, err: {:?}", &addr, e),
|
||||||
println!("Failed to connect to {:?}, err: {:?}", &addr, e);
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
LocalCommand::Serve(fileinfo) => {
|
LocalCommand::Serve(fileinfo) => {
|
||||||
@ -188,7 +184,7 @@ impl Server {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn print_fileinfos(infos: &Vec<FileInfo>) {
|
fn print_fileinfos(infos: &[FileInfo]) {
|
||||||
let mut i = 0;
|
let mut i = 0;
|
||||||
for info in infos {
|
for info in infos {
|
||||||
let bytes = info.size;
|
let bytes = info.size;
|
||||||
|
@ -151,7 +151,7 @@ fn client(address: ProtocolAddr) {
|
|||||||
std::thread::spawn(f);
|
std::thread::spawn(f);
|
||||||
metrics.run("0.0.0.0:59111".parse().unwrap()).unwrap();
|
metrics.run("0.0.0.0:59111".parse().unwrap()).unwrap();
|
||||||
|
|
||||||
let p1 = block_on(client.connect(address.clone())).unwrap(); //remote representation of p1
|
let p1 = block_on(client.connect(address)).unwrap(); //remote representation of p1
|
||||||
let mut s1 = block_on(p1.open(16, Promises::ORDERED | Promises::CONSISTENCY)).unwrap(); //remote representation of s1
|
let mut s1 = block_on(p1.open(16, Promises::ORDERED | Promises::CONSISTENCY)).unwrap(); //remote representation of s1
|
||||||
let mut last = Instant::now();
|
let mut last = Instant::now();
|
||||||
let mut id = 0u64;
|
let mut id = 0u64;
|
||||||
|
@ -8,7 +8,6 @@ use std::{
|
|||||||
},
|
},
|
||||||
thread,
|
thread,
|
||||||
};
|
};
|
||||||
use tiny_http;
|
|
||||||
use tracing::*;
|
use tracing::*;
|
||||||
|
|
||||||
pub struct SimpleMetrics {
|
pub struct SimpleMetrics {
|
||||||
@ -68,12 +67,11 @@ impl SimpleMetrics {
|
|||||||
let response = tiny_http::Response::from_string(
|
let response = tiny_http::Response::from_string(
|
||||||
String::from_utf8(buffer).expect("Failed to parse bytes as a string."),
|
String::from_utf8(buffer).expect("Failed to parse bytes as a string."),
|
||||||
);
|
);
|
||||||
match request.respond(response) {
|
if let Err(e) = request.respond(response) {
|
||||||
Err(e) => error!(
|
error!(
|
||||||
?e,
|
?e,
|
||||||
"The metrics HTTP server had encountered and error with answering"
|
"The metrics HTTP server had encountered and error with answering"
|
||||||
),
|
)
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
debug!("Stopping tiny_http server to serve metrics");
|
debug!("Stopping tiny_http server to serve metrics");
|
||||||
|
@ -24,7 +24,7 @@ fn setup() -> Result<SocketAddr, u32> {
|
|||||||
}
|
}
|
||||||
let a: SocketAddr = format!("{}:{}", args[1], args[2]).parse().unwrap();
|
let a: SocketAddr = format!("{}:{}", args[1], args[2]).parse().unwrap();
|
||||||
println!("You provided address: {}", &a);
|
println!("You provided address: {}", &a);
|
||||||
return Ok(a);
|
Ok(a)
|
||||||
}
|
}
|
||||||
/// This example file is not running veloren-network at all,
|
/// This example file is not running veloren-network at all,
|
||||||
/// instead it's just trying to create 4 threads and pump as much bytes as
|
/// instead it's just trying to create 4 threads and pump as much bytes as
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
use serde::{Serialize, de::DeserializeOwned, Deserialize};
|
use serde::{Serialize, de::DeserializeOwned, Deserialize};
|
||||||
use common::{sync, resources};
|
use common::uid::Uid;
|
||||||
|
|
||||||
#[derive(Deserialize,Serialize,Debug)]
|
#[derive(Deserialize,Serialize,Debug)]
|
||||||
pub enum Action {
|
pub enum Action {
|
||||||
@ -13,7 +13,7 @@ pub trait Event: Serialize + DeserializeOwned + Send + Sync{
|
|||||||
type Response: Serialize + DeserializeOwned + Send + Sync;
|
type Response: Serialize + DeserializeOwned + Send + Sync;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub use resources::GameMode;
|
pub use common::resources::GameMode;
|
||||||
|
|
||||||
pub mod event {
|
pub mod event {
|
||||||
use super::*;
|
use super::*;
|
||||||
@ -32,7 +32,7 @@ pub mod event {
|
|||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
||||||
pub struct Player {
|
pub struct Player {
|
||||||
pub id: sync::Uid,
|
pub id: Uid,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
#[derive(Serialize, Deserialize, Debug, Clone, Eq, PartialEq)]
|
||||||
|
354
plugin/hello/Cargo.lock
generated
354
plugin/hello/Cargo.lock
generated
@ -39,12 +39,6 @@ dependencies = [
|
|||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "arrayref"
|
|
||||||
version = "0.3.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "arrayvec"
|
name = "arrayvec"
|
||||||
version = "0.5.2"
|
version = "0.5.2"
|
||||||
@ -57,30 +51,6 @@ version = "0.3.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "c9ff149ed9780025acfdb36862d35b28856bb693ceb451259a7164442f22fdc3"
|
checksum = "c9ff149ed9780025acfdb36862d35b28856bb693ceb451259a7164442f22fdc3"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "auth-common"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "git+https://gitlab.com/veloren/auth.git?rev=b943c85e4a38f5ec60cd18c34c73097640162bfe#b943c85e4a38f5ec60cd18c34c73097640162bfe"
|
|
||||||
dependencies = [
|
|
||||||
"rand",
|
|
||||||
"serde",
|
|
||||||
"uuid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "authc"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "git+https://gitlab.com/veloren/auth.git?rev=b943c85e4a38f5ec60cd18c34c73097640162bfe#b943c85e4a38f5ec60cd18c34c73097640162bfe"
|
|
||||||
dependencies = [
|
|
||||||
"auth-common",
|
|
||||||
"fxhash",
|
|
||||||
"hex",
|
|
||||||
"rust-argon2",
|
|
||||||
"serde_json",
|
|
||||||
"ureq",
|
|
||||||
"uuid",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "autocfg"
|
name = "autocfg"
|
||||||
version = "1.0.1"
|
version = "1.0.1"
|
||||||
@ -93,12 +63,6 @@ version = "0.12.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
|
checksum = "3441f0f7b02788e948e47f457ca01f1d7e6d92c693bc132c22b087d3141c03ff"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "base64"
|
|
||||||
version = "0.13.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bincode"
|
name = "bincode"
|
||||||
version = "1.3.1"
|
version = "1.3.1"
|
||||||
@ -115,23 +79,6 @@ version = "1.2.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "blake2b_simd"
|
|
||||||
version = "0.5.11"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "afa748e348ad3be8263be728124b24a24f268266f6f5d58af9d75f6a40b5c587"
|
|
||||||
dependencies = [
|
|
||||||
"arrayref",
|
|
||||||
"arrayvec",
|
|
||||||
"constant_time_eq",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bumpalo"
|
|
||||||
version = "3.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "bytemuck"
|
name = "bytemuck"
|
||||||
version = "1.4.1"
|
version = "1.4.1"
|
||||||
@ -144,12 +91,6 @@ version = "1.3.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
|
checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "cc"
|
|
||||||
version = "1.0.66"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "cfg-if"
|
name = "cfg-if"
|
||||||
version = "0.1.10"
|
version = "0.1.10"
|
||||||
@ -162,12 +103,6 @@ version = "1.0.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "chunked_transfer"
|
|
||||||
version = "1.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7477065d45a8fe57167bf3cf8bcd3729b54cfcb81cca49bda2d038ea89ae82ca"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "color_quant"
|
name = "color_quant"
|
||||||
version = "1.1.0"
|
version = "1.1.0"
|
||||||
@ -180,12 +115,6 @@ version = "0.4.4"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826"
|
checksum = "cd51eab21ab4fd6a3bf889e2d0958c0a6e3a61ad04260325e919e652a2a62826"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "constant_time_eq"
|
|
||||||
version = "0.1.5"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crc32fast"
|
name = "crc32fast"
|
||||||
version = "1.2.1"
|
version = "1.2.1"
|
||||||
@ -394,16 +323,6 @@ dependencies = [
|
|||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "form_urlencoded"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ece68d15c92e84fa4f19d3780f1294e5ca82a78a6d515f1efaabcc144688be00"
|
|
||||||
dependencies = [
|
|
||||||
"matches",
|
|
||||||
"percent-encoding",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "fsevent"
|
name = "fsevent"
|
||||||
version = "2.0.2"
|
version = "2.0.2"
|
||||||
@ -439,15 +358,6 @@ version = "0.3.3"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "fxhash"
|
|
||||||
version = "0.2.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "c31b6d751ae2c7f11320402d34e41349dd1016f8d5d45e48c4312bc8625af50c"
|
|
||||||
dependencies = [
|
|
||||||
"byteorder",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.1.15"
|
version = "0.1.15"
|
||||||
@ -493,12 +403,6 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "hex"
|
|
||||||
version = "0.3.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "hibitset"
|
name = "hibitset"
|
||||||
version = "0.6.3"
|
version = "0.6.3"
|
||||||
@ -509,17 +413,6 @@ dependencies = [
|
|||||||
"rayon",
|
"rayon",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "idna"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9"
|
|
||||||
dependencies = [
|
|
||||||
"matches",
|
|
||||||
"unicode-bidi",
|
|
||||||
"unicode-normalization",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "image"
|
name = "image"
|
||||||
version = "0.23.12"
|
version = "0.23.12"
|
||||||
@ -580,15 +473,6 @@ version = "0.4.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
|
checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "js-sys"
|
|
||||||
version = "0.3.46"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175"
|
|
||||||
dependencies = [
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "kernel32-sys"
|
name = "kernel32-sys"
|
||||||
version = "0.2.2"
|
version = "0.2.2"
|
||||||
@ -626,12 +510,6 @@ dependencies = [
|
|||||||
"cfg-if 0.1.10",
|
"cfg-if 0.1.10",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "matches"
|
|
||||||
version = "0.1.8"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7ffc5c5338469d4d3ea17d269fa8ea3512ad247247c30bd2df69e68309ed0a08"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "maybe-uninit"
|
name = "maybe-uninit"
|
||||||
version = "2.0.0"
|
version = "2.0.0"
|
||||||
@ -848,12 +726,6 @@ dependencies = [
|
|||||||
"num-traits",
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "percent-encoding"
|
|
||||||
version = "2.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pin-project-lite"
|
name = "pin-project-lite"
|
||||||
version = "0.2.0"
|
version = "0.2.0"
|
||||||
@ -911,15 +783,6 @@ dependencies = [
|
|||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "qstring"
|
|
||||||
version = "0.7.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e"
|
|
||||||
dependencies = [
|
|
||||||
"percent-encoding",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "quote"
|
name = "quote"
|
||||||
version = "1.0.7"
|
version = "1.0.7"
|
||||||
@ -1011,28 +874,13 @@ dependencies = [
|
|||||||
"redox_syscall",
|
"redox_syscall",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ring"
|
|
||||||
version = "0.16.19"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "024a1e66fea74c66c66624ee5622a7ff0e4b73a13b4f5c326ddb50c708944226"
|
|
||||||
dependencies = [
|
|
||||||
"cc",
|
|
||||||
"libc",
|
|
||||||
"once_cell",
|
|
||||||
"spin",
|
|
||||||
"untrusted",
|
|
||||||
"web-sys",
|
|
||||||
"winapi 0.3.9",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ron"
|
name = "ron"
|
||||||
version = "0.6.2"
|
version = "0.6.2"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f8a58080b7bb83b2ea28c3b7a9a994fd5e310330b7c8ca5258d99b98128ecfe4"
|
checksum = "f8a58080b7bb83b2ea28c3b7a9a994fd5e310330b7c8ca5258d99b98128ecfe4"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"base64 0.12.3",
|
"base64",
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"serde",
|
"serde",
|
||||||
]
|
]
|
||||||
@ -1043,17 +891,6 @@ version = "0.0.6"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "84348444bd7ad45729d0c49a4240d7cdc11c9d512c06c5ad1835c1ad4acda6db"
|
checksum = "84348444bd7ad45729d0c49a4240d7cdc11c9d512c06c5ad1835c1ad4acda6db"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rust-argon2"
|
|
||||||
version = "0.8.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "4b18820d944b33caa75a71378964ac46f58517c92b6ae5f762636247c09e78fb"
|
|
||||||
dependencies = [
|
|
||||||
"base64 0.13.0",
|
|
||||||
"blake2b_simd",
|
|
||||||
"constant_time_eq",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc_version"
|
name = "rustc_version"
|
||||||
version = "0.2.3"
|
version = "0.2.3"
|
||||||
@ -1063,19 +900,6 @@ dependencies = [
|
|||||||
"semver",
|
"semver",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustls"
|
|
||||||
version = "0.19.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "064fd21ff87c6e87ed4506e68beb42459caa4a0e2eb144932e6776768556980b"
|
|
||||||
dependencies = [
|
|
||||||
"base64 0.13.0",
|
|
||||||
"log",
|
|
||||||
"ring",
|
|
||||||
"sct",
|
|
||||||
"webpki",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ryu"
|
name = "ryu"
|
||||||
version = "1.0.5"
|
version = "1.0.5"
|
||||||
@ -1097,16 +921,6 @@ version = "1.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sct"
|
|
||||||
version = "0.6.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "e3042af939fca8c3453b7af0f1c66e533a15a86169e39de2657310ade8f98d3c"
|
|
||||||
dependencies = [
|
|
||||||
"ring",
|
|
||||||
"untrusted",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "semver"
|
name = "semver"
|
||||||
version = "0.9.0"
|
version = "0.9.0"
|
||||||
@ -1229,12 +1043,6 @@ dependencies = [
|
|||||||
"specs",
|
"specs",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "spin"
|
|
||||||
version = "0.5.2"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "spin_sleep"
|
name = "spin_sleep"
|
||||||
version = "1.0.0"
|
version = "1.0.0"
|
||||||
@ -1251,12 +1059,6 @@ version = "1.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "sum_type"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "da5b4a0c9f3c7c8e891e445a7c776627e208e8bba23ab680798066dd283e6a15"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.54"
|
version = "1.0.54"
|
||||||
@ -1268,21 +1070,6 @@ dependencies = [
|
|||||||
"unicode-xid",
|
"unicode-xid",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tinyvec"
|
|
||||||
version = "1.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ccf8dbc19eb42fba10e8feaaec282fb50e2c14b2726d6301dbfeed0f73306a6f"
|
|
||||||
dependencies = [
|
|
||||||
"tinyvec_macros",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "tinyvec_macros"
|
|
||||||
version = "0.1.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tracing"
|
name = "tracing"
|
||||||
version = "0.1.22"
|
version = "0.1.22"
|
||||||
@ -1315,65 +1102,12 @@ dependencies = [
|
|||||||
"nom 5.1.2",
|
"nom 5.1.2",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-bidi"
|
|
||||||
version = "0.3.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
|
|
||||||
dependencies = [
|
|
||||||
"matches",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "unicode-normalization"
|
|
||||||
version = "0.1.16"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606"
|
|
||||||
dependencies = [
|
|
||||||
"tinyvec",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-xid"
|
name = "unicode-xid"
|
||||||
version = "0.2.1"
|
version = "0.2.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "untrusted"
|
|
||||||
version = "0.7.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ureq"
|
|
||||||
version = "1.5.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "294b85ef5dbc3670a72e82a89971608a1fcc4ed5c7c5a2895230d31a95f0569b"
|
|
||||||
dependencies = [
|
|
||||||
"base64 0.13.0",
|
|
||||||
"chunked_transfer",
|
|
||||||
"log",
|
|
||||||
"once_cell",
|
|
||||||
"qstring",
|
|
||||||
"rustls",
|
|
||||||
"url",
|
|
||||||
"webpki",
|
|
||||||
"webpki-roots",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "url"
|
|
||||||
version = "2.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e"
|
|
||||||
dependencies = [
|
|
||||||
"form_urlencoded",
|
|
||||||
"idna",
|
|
||||||
"matches",
|
|
||||||
"percent-encoding",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "uuid"
|
name = "uuid"
|
||||||
version = "0.8.1"
|
version = "0.8.1"
|
||||||
@ -1403,7 +1137,6 @@ name = "veloren-common"
|
|||||||
version = "0.8.0"
|
version = "0.8.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"arraygen",
|
"arraygen",
|
||||||
"authc",
|
|
||||||
"crossbeam",
|
"crossbeam",
|
||||||
"directories-next",
|
"directories-next",
|
||||||
"dot_vox",
|
"dot_vox",
|
||||||
@ -1428,8 +1161,8 @@ dependencies = [
|
|||||||
"specs",
|
"specs",
|
||||||
"specs-idvs",
|
"specs-idvs",
|
||||||
"spin_sleep",
|
"spin_sleep",
|
||||||
"sum_type",
|
|
||||||
"tracing",
|
"tracing",
|
||||||
|
"uuid",
|
||||||
"vek",
|
"vek",
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -1489,89 +1222,6 @@ version = "0.9.0+wasi-snapshot-preview1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen"
|
|
||||||
version = "0.2.69"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if 1.0.0",
|
|
||||||
"wasm-bindgen-macro",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-backend"
|
|
||||||
version = "0.2.69"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62"
|
|
||||||
dependencies = [
|
|
||||||
"bumpalo",
|
|
||||||
"lazy_static",
|
|
||||||
"log",
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
"wasm-bindgen-shared",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-macro"
|
|
||||||
version = "0.2.69"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084"
|
|
||||||
dependencies = [
|
|
||||||
"quote",
|
|
||||||
"wasm-bindgen-macro-support",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-macro-support"
|
|
||||||
version = "0.2.69"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549"
|
|
||||||
dependencies = [
|
|
||||||
"proc-macro2",
|
|
||||||
"quote",
|
|
||||||
"syn",
|
|
||||||
"wasm-bindgen-backend",
|
|
||||||
"wasm-bindgen-shared",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "wasm-bindgen-shared"
|
|
||||||
version = "0.2.69"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158"
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "web-sys"
|
|
||||||
version = "0.3.46"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3"
|
|
||||||
dependencies = [
|
|
||||||
"js-sys",
|
|
||||||
"wasm-bindgen",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "webpki"
|
|
||||||
version = "0.21.4"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea"
|
|
||||||
dependencies = [
|
|
||||||
"ring",
|
|
||||||
"untrusted",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "webpki-roots"
|
|
||||||
version = "0.21.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "82015b7e0b8bad8185994674a13a93306bea76cf5a16c5a181382fd3a5ec2376"
|
|
||||||
dependencies = [
|
|
||||||
"webpki",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "winapi"
|
name = "winapi"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
extern crate plugin_rt;
|
extern crate plugin_rt;
|
||||||
|
|
||||||
use plugin_rt::*;
|
use plugin_rt::{
|
||||||
use plugin_rt::api::{Action, GameMode, event::*};
|
api::{event::*, Action, GameMode},
|
||||||
|
*,
|
||||||
|
};
|
||||||
|
|
||||||
#[event_handler]
|
#[event_handler]
|
||||||
pub fn on_load(load: PluginLoadEvent) {
|
pub fn on_load(load: PluginLoadEvent) {
|
||||||
@ -14,12 +16,18 @@ pub fn on_load(load: PluginLoadEvent) {
|
|||||||
|
|
||||||
#[event_handler]
|
#[event_handler]
|
||||||
pub fn on_command_testplugin(command: ChatCommandEvent) -> Result<Vec<String>, String> {
|
pub fn on_command_testplugin(command: ChatCommandEvent) -> Result<Vec<String>, String> {
|
||||||
Ok(vec![format!("Player of id {:?} sended command with args {:?}",command.player,command.command_args)])
|
Ok(vec![format!(
|
||||||
|
"Player of id {:?} sended command with args {:?}",
|
||||||
|
command.player, command.command_args
|
||||||
|
)])
|
||||||
}
|
}
|
||||||
|
|
||||||
#[event_handler]
|
#[event_handler]
|
||||||
pub fn on_player_join(input: PlayerJoinEvent) -> PlayerJoinResult {
|
pub fn on_player_join(input: PlayerJoinEvent) -> PlayerJoinResult {
|
||||||
emit_action(Action::PlayerSendMessage(input.player_id,format!("Welcome {} on our server",input.player_name)));
|
emit_action(Action::PlayerSendMessage(
|
||||||
|
input.player_id,
|
||||||
|
format!("Welcome {} on our server", input.player_name),
|
||||||
|
));
|
||||||
if input.player_name == "Cheater123" {
|
if input.player_name == "Cheater123" {
|
||||||
PlayerJoinResult::CloseConnection
|
PlayerJoinResult::CloseConnection
|
||||||
} else {
|
} else {
|
||||||
|
@ -12,6 +12,7 @@ tracy = ["common/tracy", "tracing-tracy"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
server = { package = "veloren-server", path = "../server", default-features = false }
|
server = { package = "veloren-server", path = "../server", default-features = false }
|
||||||
common = { package = "veloren-common", path = "../common" }
|
common = { package = "veloren-common", path = "../common" }
|
||||||
|
common-net = { package = "veloren-common-net", path = "../common/net" }
|
||||||
|
|
||||||
ansi-parser = "0.6"
|
ansi-parser = "0.6"
|
||||||
clap = "2.33"
|
clap = "2.33"
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
use crate::settings::Settings;
|
use crate::settings::Settings;
|
||||||
use common::comp::chat::ChatType;
|
use common::comp::chat::ChatType;
|
||||||
|
use common_net::msg::ServerGeneral;
|
||||||
use server::Server;
|
use server::Server;
|
||||||
use std::{
|
use std::{
|
||||||
ops::Add,
|
ops::Add,
|
||||||
@ -155,7 +156,7 @@ impl ShutdownCoordinator {
|
|||||||
/// Logs and sends a message to all connected clients
|
/// Logs and sends a message to all connected clients
|
||||||
fn send_msg(server: &mut Server, msg: String) {
|
fn send_msg(server: &mut Server, msg: String) {
|
||||||
info!("{}", &msg);
|
info!("{}", &msg);
|
||||||
server.notify_players(ChatType::CommandError.server_msg(msg));
|
server.notify_players(ServerGeneral::server_msg(ChatType::CommandError, msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Converts a `Duration` into text in the format XsXm for example 1 minute
|
/// Converts a `Duration` into text in the format XsXm for example 1 minute
|
||||||
|
@ -12,7 +12,8 @@ default = ["worldgen", "simd"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
common = { package = "veloren-common", path = "../common" }
|
common = { package = "veloren-common", path = "../common" }
|
||||||
common_sys = { package = "veloren_common_sys", path = "../common/sys" }
|
common-sys = { package = "veloren-common-sys", path = "../common/sys" }
|
||||||
|
common-net = { package = "veloren-common-net", path = "../common/net" }
|
||||||
world = { package = "veloren-world", path = "../world" }
|
world = { package = "veloren-world", path = "../world" }
|
||||||
network = { package = "veloren_network", path = "../network", features = ["metrics", "compression"], default-features = false }
|
network = { package = "veloren_network", path = "../network", features = ["metrics", "compression"], default-features = false }
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use common::msg::{ClientType, ServerGeneral, ServerMsg};
|
use common_net::msg::{ClientType, ServerGeneral, ServerMsg};
|
||||||
use network::{Message, Participant, Stream, StreamError};
|
use network::{Message, Participant, Stream, StreamError};
|
||||||
use serde::{de::DeserializeOwned, Serialize};
|
use serde::{de::DeserializeOwned, Serialize};
|
||||||
use specs::Component;
|
use specs::Component;
|
||||||
|
@ -17,15 +17,18 @@ use common::{
|
|||||||
},
|
},
|
||||||
effect::Effect,
|
effect::Effect,
|
||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
msg::{DisconnectReason, Notification, PlayerListUpdate, ServerGeneral},
|
|
||||||
npc::{self, get_npc_name},
|
npc::{self, get_npc_name},
|
||||||
resources::TimeOfDay,
|
resources::TimeOfDay,
|
||||||
sync::{Uid, WorldSyncExt},
|
uid::Uid,
|
||||||
terrain::{Block, BlockKind, SpriteKind, TerrainChunkSize},
|
terrain::{Block, BlockKind, SpriteKind, TerrainChunkSize},
|
||||||
util::Dir,
|
util::Dir,
|
||||||
vol::RectVolSize,
|
vol::RectVolSize,
|
||||||
Damage, DamageSource, Explosion, LoadoutBuilder, RadiusEffect,
|
Damage, DamageSource, Explosion, LoadoutBuilder, RadiusEffect,
|
||||||
};
|
};
|
||||||
|
use common_net::{
|
||||||
|
msg::{DisconnectReason, Notification, PlayerListUpdate, ServerGeneral},
|
||||||
|
sync::WorldSyncExt,
|
||||||
|
};
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use specs::{Builder, Entity as EcsEntity, Join, WorldExt};
|
use specs::{Builder, Entity as EcsEntity, Join, WorldExt};
|
||||||
use std::{convert::TryFrom, time::Duration};
|
use std::{convert::TryFrom, time::Duration};
|
||||||
@ -45,7 +48,7 @@ impl ChatCommandExt for ChatCommand {
|
|||||||
if self.needs_admin() && !server.entity_is_admin(entity) {
|
if self.needs_admin() && !server.entity_is_admin(entity) {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
entity,
|
entity,
|
||||||
ChatType::CommandError.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandError, format!(
|
||||||
"You don't have permission to use '/{}'.",
|
"You don't have permission to use '/{}'.",
|
||||||
self.keyword()
|
self.keyword()
|
||||||
)),
|
)),
|
||||||
@ -147,7 +150,7 @@ fn handle_give_item(
|
|||||||
if inv.push(item).is_some() {
|
if inv.push(item).is_some() {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandError, format!(
|
||||||
"Player inventory full. Gave 0 of {} items.",
|
"Player inventory full. Gave 0 of {} items.",
|
||||||
give_amount
|
give_amount
|
||||||
)),
|
)),
|
||||||
@ -166,7 +169,7 @@ fn handle_give_item(
|
|||||||
if inv.push(item.duplicate()).is_some() {
|
if inv.push(item.duplicate()).is_some() {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandError, format!(
|
||||||
"Player inventory full. Gave {} of {} items.",
|
"Player inventory full. Gave {} of {} items.",
|
||||||
i, give_amount
|
i, give_amount
|
||||||
)),
|
)),
|
||||||
@ -188,13 +191,13 @@ fn handle_give_item(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(format!("Invalid item: {}", item_name)),
|
ServerGeneral::server_msg(ChatType::CommandError, format!("Invalid item: {}", item_name)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -215,19 +218,19 @@ fn handle_make_block(
|
|||||||
),
|
),
|
||||||
None => server.notify_client(
|
None => server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(String::from("You have no position.")),
|
ServerGeneral::server_msg(ChatType::CommandError, String::from("You have no position.")),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(format!("Invalid block kind: {}", block_name)),
|
ServerGeneral::server_msg(ChatType::CommandError, format!("Invalid block kind: {}", block_name)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -254,19 +257,19 @@ fn handle_make_sprite(
|
|||||||
},
|
},
|
||||||
None => server.notify_client(
|
None => server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(String::from("You have no position.")),
|
ServerGeneral::server_msg(ChatType::CommandError, String::from("You have no position.")),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(format!("Invalid sprite kind: {}", sprite_name)),
|
ServerGeneral::server_msg(ChatType::CommandError, format!("Invalid sprite kind: {}", sprite_name)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -280,7 +283,7 @@ fn handle_motd(
|
|||||||
) {
|
) {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg((*server.editable_settings().server_description).clone()),
|
ServerGeneral::server_msg(ChatType::CommandError, (*server.editable_settings().server_description).clone()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -300,7 +303,7 @@ fn handle_set_motd(
|
|||||||
.edit(data_dir.as_ref(), |d| **d = msg.clone());
|
.edit(data_dir.as_ref(), |d| **d = msg.clone());
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(format!("Server description set to \"{}\"", msg)),
|
ServerGeneral::server_msg(ChatType::CommandError, format!("Server description set to \"{}\"", msg)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
@ -310,7 +313,7 @@ fn handle_set_motd(
|
|||||||
.edit(data_dir.as_ref(), |d| d.clear());
|
.edit(data_dir.as_ref(), |d| d.clear());
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Removed server description".to_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, "Removed server description".to_string()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -333,7 +336,7 @@ fn handle_jump(
|
|||||||
},
|
},
|
||||||
None => server.notify_client(
|
None => server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You have no position."),
|
ServerGeneral::server_msg(ChatType::CommandError, "You have no position."),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -359,13 +362,13 @@ fn handle_goto(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You have no position."),
|
ServerGeneral::server_msg(ChatType::CommandError, "You have no position."),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -396,7 +399,7 @@ fn handle_home(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You have no position."),
|
ServerGeneral::server_msg(ChatType::CommandError, "You have no position."),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -456,8 +459,7 @@ fn handle_time(
|
|||||||
None => {
|
None => {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError
|
ServerGeneral::server_msg(ChatType::CommandError, format!("'{}' is not a valid time.", n)),
|
||||||
.server_msg(format!("'{}' is not a valid time.", n)),
|
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
@ -516,7 +518,7 @@ fn handle_time(
|
|||||||
Some(time) => format!("It is {}", time.format("%H:%M").to_string()),
|
Some(time) => format!("It is {}", time.format("%H:%M").to_string()),
|
||||||
None => String::from("Unknown Time"),
|
None => String::from("Unknown Time"),
|
||||||
};
|
};
|
||||||
server.notify_client(client, ChatType::CommandInfo.server_msg(msg));
|
server.notify_client(client, ServerGeneral::server_msg(ChatType::CommandInfo, msg));
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -528,7 +530,7 @@ fn handle_time(
|
|||||||
{
|
{
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandInfo, format!(
|
||||||
"Time changed to: {}",
|
"Time changed to: {}",
|
||||||
new_time.format("%H:%M").to_string(),
|
new_time.format("%H:%M").to_string(),
|
||||||
)),
|
)),
|
||||||
@ -554,13 +556,13 @@ fn handle_health(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You have no health."),
|
ServerGeneral::server_msg(ChatType::CommandError, "You have no health."),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You must specify health amount!"),
|
ServerGeneral::server_msg(ChatType::CommandError, "You must specify health amount!"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -576,14 +578,14 @@ fn handle_alias(
|
|||||||
// Notify target that an admin changed the alias due to /sudo
|
// Notify target that an admin changed the alias due to /sudo
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
target,
|
target,
|
||||||
ChatType::CommandInfo.server_msg("An admin changed your alias."),
|
ServerGeneral::server_msg(ChatType::CommandInfo, "An admin changed your alias."),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if let Ok(alias) = scan_fmt!(&args, &action.arg_fmt(), String) {
|
if let Ok(alias) = scan_fmt!(&args, &action.arg_fmt(), String) {
|
||||||
if !comp::Player::alias_is_valid(&alias) {
|
if !comp::Player::alias_is_valid(&alias) {
|
||||||
// Prevent silly aliases
|
// Prevent silly aliases
|
||||||
server.notify_client(client, ChatType::CommandError.server_msg("Invalid alias."));
|
server.notify_client(client, ServerGeneral::server_msg(ChatType::CommandError, "Invalid alias."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let old_alias_optional = server
|
let old_alias_optional = server
|
||||||
@ -609,15 +611,14 @@ fn handle_alias(
|
|||||||
// Announce alias change if target has a Body.
|
// Announce alias change if target has a Body.
|
||||||
if ecs.read_storage::<comp::Body>().get(target).is_some() {
|
if ecs.read_storage::<comp::Body>().get(target).is_some() {
|
||||||
server.state.notify_players(
|
server.state.notify_players(
|
||||||
ChatType::CommandInfo
|
ServerGeneral::server_msg(ChatType::CommandInfo, format!("{} is now known as {}.", old_alias, player.alias)),
|
||||||
.server_msg(format!("{} is now known as {}.", old_alias, player.alias)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -640,11 +641,11 @@ fn handle_tp(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You must specify a player name"),
|
ServerGeneral::server_msg(ChatType::CommandError, "You must specify a player name"),
|
||||||
);
|
);
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
@ -656,23 +657,23 @@ fn handle_tp(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Unable to teleport to player!"),
|
ServerGeneral::server_msg(ChatType::CommandError, "Unable to teleport to player!"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Player not found!"),
|
ServerGeneral::server_msg(ChatType::CommandError, "Player not found!"),
|
||||||
);
|
);
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You have no position!"),
|
ServerGeneral::server_msg(ChatType::CommandError, "You have no position!"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -791,20 +792,18 @@ fn handle_spawn(
|
|||||||
if let Some(uid) = server.state.ecs().uid_from_entity(new_entity) {
|
if let Some(uid) = server.state.ecs().uid_from_entity(new_entity) {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo
|
ServerGeneral::server_msg(ChatType::CommandInfo, format!("Spawned entity with ID: {}", uid)),
|
||||||
.server_msg(format!("Spawned entity with ID: {}", uid)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo
|
ServerGeneral::server_msg(ChatType::CommandInfo, format!("Spawned {} entities", amount)),
|
||||||
.server_msg(format!("Spawned {} entities", amount)),
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
None => server.notify_client(
|
None => server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You have no position!"),
|
ServerGeneral::server_msg(ChatType::CommandError, "You have no position!"),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -812,7 +811,7 @@ fn handle_spawn(
|
|||||||
_ => {
|
_ => {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -851,12 +850,12 @@ fn handle_spawn_training_dummy(
|
|||||||
|
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg("Spawned a training dummy"),
|
ServerGeneral::server_msg(ChatType::CommandInfo, "Spawned a training dummy"),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
None => server.notify_client(
|
None => server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You have no position!"),
|
ServerGeneral::server_msg(ChatType::CommandError, "You have no position!"),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -894,12 +893,12 @@ fn handle_spawn_campfire(
|
|||||||
|
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg("Spawned a campfire"),
|
ServerGeneral::server_msg(ChatType::CommandInfo, "Spawned a campfire"),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
None => server.notify_client(
|
None => server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You have no position!"),
|
ServerGeneral::server_msg(ChatType::CommandError, "You have no position!"),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -921,7 +920,7 @@ fn handle_players(
|
|||||||
|
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg(entity_tuples.join().fold(
|
ServerGeneral::server_msg(ChatType::CommandInfo, entity_tuples.join().fold(
|
||||||
format!("{} online players:", entity_tuples.join().count()),
|
format!("{} online players:", entity_tuples.join().count()),
|
||||||
|s, (_, player, stat)| {
|
|s, (_, player, stat)| {
|
||||||
format!(
|
format!(
|
||||||
@ -956,7 +955,7 @@ fn handle_build(
|
|||||||
.remove(target);
|
.remove(target);
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg("Toggled off build mode!"),
|
ServerGeneral::server_msg(ChatType::CommandInfo, "Toggled off build mode!"),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
let _ = server
|
let _ = server
|
||||||
@ -966,7 +965,7 @@ fn handle_build(
|
|||||||
.insert(target, comp::CanBuild);
|
.insert(target, comp::CanBuild);
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg("Toggled on build mode!"),
|
ServerGeneral::server_msg(ChatType::CommandInfo, "Toggled on build mode!"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -979,7 +978,7 @@ fn handle_help(
|
|||||||
action: &ChatCommand,
|
action: &ChatCommand,
|
||||||
) {
|
) {
|
||||||
if let Some(cmd) = scan_fmt_some!(&args, &action.arg_fmt(), ChatCommand) {
|
if let Some(cmd) = scan_fmt_some!(&args, &action.arg_fmt(), ChatCommand) {
|
||||||
server.notify_client(client, ChatType::CommandInfo.server_msg(cmd.help_string()));
|
server.notify_client(client, ServerGeneral::server_msg(ChatType::CommandInfo, cmd.help_string()));
|
||||||
} else {
|
} else {
|
||||||
let mut message = String::new();
|
let mut message = String::new();
|
||||||
for cmd in CHAT_COMMANDS.iter() {
|
for cmd in CHAT_COMMANDS.iter() {
|
||||||
@ -992,7 +991,7 @@ fn handle_help(
|
|||||||
for (k, v) in CHAT_SHORTCUTS.iter() {
|
for (k, v) in CHAT_SHORTCUTS.iter() {
|
||||||
message += &format!(" /{} => /{}", k, v.keyword());
|
message += &format!(" /{} => /{}", k, v.keyword());
|
||||||
}
|
}
|
||||||
server.notify_client(client, ChatType::CommandInfo.server_msg(message));
|
server.notify_client(client, ServerGeneral::server_msg(ChatType::CommandInfo, message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1026,7 +1025,7 @@ fn handle_kill_npcs(
|
|||||||
} else {
|
} else {
|
||||||
"No NPCs on server.".to_string()
|
"No NPCs on server.".to_string()
|
||||||
};
|
};
|
||||||
server.notify_client(client, ChatType::CommandInfo.server_msg(text));
|
server.notify_client(client, ServerGeneral::server_msg(ChatType::CommandInfo, text));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(clippy::float_cmp)] // TODO: Pending review in #587
|
#[allow(clippy::float_cmp)] // TODO: Pending review in #587
|
||||||
@ -1080,7 +1079,7 @@ fn handle_object(
|
|||||||
.build();
|
.build();
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandInfo, format!(
|
||||||
"Spawned: {}",
|
"Spawned: {}",
|
||||||
obj_str_res.unwrap_or("<Unknown object>")
|
obj_str_res.unwrap_or("<Unknown object>")
|
||||||
)),
|
)),
|
||||||
@ -1088,13 +1087,13 @@ fn handle_object(
|
|||||||
} else {
|
} else {
|
||||||
return server.notify_client(
|
return server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Object not found!"),
|
ServerGeneral::server_msg(ChatType::CommandError, "Object not found!"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You have no position!"),
|
ServerGeneral::server_msg(ChatType::CommandError, "You have no position!"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1117,7 +1116,7 @@ fn handle_light(
|
|||||||
if r < 0.0 || g < 0.0 || b < 0.0 {
|
if r < 0.0 || g < 0.0 || b < 0.0 {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("cr, cg and cb values mustn't be negative."),
|
ServerGeneral::server_msg(ChatType::CommandError, "cr, cg and cb values mustn't be negative."),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1156,11 +1155,11 @@ fn handle_light(
|
|||||||
} else {
|
} else {
|
||||||
builder.build();
|
builder.build();
|
||||||
}
|
}
|
||||||
server.notify_client(client, ChatType::CommandInfo.server_msg("Spawned object."));
|
server.notify_client(client, ServerGeneral::server_msg(ChatType::CommandInfo, "Spawned object."));
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You have no position!"),
|
ServerGeneral::server_msg(ChatType::CommandError, "You have no position!"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1190,24 +1189,24 @@ fn handle_lantern(
|
|||||||
.into();
|
.into();
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg("You adjusted flame strength and color."),
|
ServerGeneral::server_msg(ChatType::CommandInfo, "You adjusted flame strength and color."),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg("You adjusted flame strength."),
|
ServerGeneral::server_msg(ChatType::CommandInfo, "You adjusted flame strength."),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Please equip a lantern first"),
|
ServerGeneral::server_msg(ChatType::CommandError, "Please equip a lantern first"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1224,13 +1223,13 @@ fn handle_explosion(
|
|||||||
if power > 512.0 {
|
if power > 512.0 {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Explosion power mustn't be more than 512."),
|
ServerGeneral::server_msg(ChatType::CommandError, "Explosion power mustn't be more than 512."),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
} else if power <= 0.0 {
|
} else if power <= 0.0 {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Explosion power must be more than 0."),
|
ServerGeneral::server_msg(ChatType::CommandError, "Explosion power must be more than 0."),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1262,7 +1261,7 @@ fn handle_explosion(
|
|||||||
},
|
},
|
||||||
None => server.notify_client(
|
None => server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You have no position!"),
|
ServerGeneral::server_msg(ChatType::CommandError, "You have no position!"),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1282,7 +1281,7 @@ fn handle_waypoint(
|
|||||||
.ecs()
|
.ecs()
|
||||||
.write_storage::<comp::Waypoint>()
|
.write_storage::<comp::Waypoint>()
|
||||||
.insert(target, comp::Waypoint::temp_new(pos.0, *time));
|
.insert(target, comp::Waypoint::temp_new(pos.0, *time));
|
||||||
server.notify_client(client, ChatType::CommandInfo.server_msg("Waypoint saved!"));
|
server.notify_client(client, ServerGeneral::server_msg(ChatType::CommandInfo, "Waypoint saved!"));
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ServerGeneral::Notification(Notification::WaypointSaved),
|
ServerGeneral::Notification(Notification::WaypointSaved),
|
||||||
@ -1290,7 +1289,7 @@ fn handle_waypoint(
|
|||||||
},
|
},
|
||||||
None => server.notify_client(
|
None => server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You have no position!"),
|
ServerGeneral::server_msg(ChatType::CommandError, "You have no position!"),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1333,14 +1332,14 @@ fn handle_adminify(
|
|||||||
None => {
|
None => {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(format!("Player '{}' not found!", alias)),
|
ServerGeneral::server_msg(ChatType::CommandError, format!("Player '{}' not found!", alias)),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1358,7 +1357,7 @@ fn handle_tell(
|
|||||||
// This happens when [ab]using /sudo
|
// This happens when [ab]using /sudo
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("It's rude to impersonate people"),
|
ServerGeneral::server_msg(ChatType::CommandError, "It's rude to impersonate people"),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1372,7 +1371,7 @@ fn handle_tell(
|
|||||||
if player == client {
|
if player == client {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You can't /tell yourself."),
|
ServerGeneral::server_msg(ChatType::CommandError, "You can't /tell yourself."),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1395,13 +1394,13 @@ fn handle_tell(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(format!("Player '{}' not found!", alias)),
|
ServerGeneral::server_msg(ChatType::CommandError, format!("Player '{}' not found!", alias)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1417,7 +1416,7 @@ fn handle_faction(
|
|||||||
// This happens when [ab]using /sudo
|
// This happens when [ab]using /sudo
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("It's rude to impersonate people"),
|
ServerGeneral::server_msg(ChatType::CommandError, "It's rude to impersonate people"),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1433,7 +1432,7 @@ fn handle_faction(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Please join a faction with /join_faction"),
|
ServerGeneral::server_msg(ChatType::CommandError, "Please join a faction with /join_faction"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1449,7 +1448,7 @@ fn handle_group(
|
|||||||
// This happens when [ab]using /sudo
|
// This happens when [ab]using /sudo
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("It's rude to impersonate people"),
|
ServerGeneral::server_msg(ChatType::CommandError, "It's rude to impersonate people"),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1465,7 +1464,7 @@ fn handle_group(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Please create a group first"),
|
ServerGeneral::server_msg(ChatType::CommandError, "Please create a group first"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1498,19 +1497,18 @@ fn handle_group_invite(
|
|||||||
|
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg(format!("Invited {} to the group.", target_alias)),
|
ServerGeneral::server_msg(ChatType::CommandInfo, format!("Invited {} to the group.", target_alias)),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError
|
ServerGeneral::server_msg(ChatType::CommandError, format!("Player with alias {} not found", target_alias)),
|
||||||
.server_msg(format!("Player with alias {} not found", target_alias)),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1541,14 +1539,13 @@ fn handle_group_kick(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError
|
ServerGeneral::server_msg(ChatType::CommandError, format!("Player with alias {} not found", target_alias)),
|
||||||
.server_msg(format!("Player with alias {} not found", target_alias)),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1596,14 +1593,13 @@ fn handle_group_promote(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError
|
ServerGeneral::server_msg(ChatType::CommandError, format!("Player with alias {} not found", target_alias)),
|
||||||
.server_msg(format!("Player with alias {} not found", target_alias)),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1619,7 +1615,7 @@ fn handle_region(
|
|||||||
// This happens when [ab]using /sudo
|
// This happens when [ab]using /sudo
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("It's rude to impersonate people"),
|
ServerGeneral::server_msg(ChatType::CommandError, "It's rude to impersonate people"),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1647,7 +1643,7 @@ fn handle_say(
|
|||||||
// This happens when [ab]using /sudo
|
// This happens when [ab]using /sudo
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("It's rude to impersonate people"),
|
ServerGeneral::server_msg(ChatType::CommandError, "It's rude to impersonate people"),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1675,7 +1671,7 @@ fn handle_world(
|
|||||||
// This happens when [ab]using /sudo
|
// This happens when [ab]using /sudo
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("It's rude to impersonate people"),
|
ServerGeneral::server_msg(ChatType::CommandError, "It's rude to impersonate people"),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1703,7 +1699,7 @@ fn handle_join_faction(
|
|||||||
// This happens when [ab]using /sudo
|
// This happens when [ab]using /sudo
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("It's rude to impersonate people"),
|
ServerGeneral::server_msg(ChatType::CommandError, "It's rude to impersonate people"),
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1749,7 +1745,7 @@ fn handle_join_faction(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Could not find your player alias"),
|
ServerGeneral::server_msg(ChatType::CommandError, "Could not find your player alias"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1764,7 +1760,7 @@ fn handle_debug_column(
|
|||||||
) {
|
) {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Unsupported without worldgen enabled"),
|
ServerGeneral::server_msg(ChatType::CommandError, "Unsupported without worldgen enabled"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1786,7 +1782,7 @@ fn handle_debug_column(
|
|||||||
Some(pos) => wpos = pos.0.xy().map(|x| x as i32),
|
Some(pos) => wpos = pos.0.xy().map(|x| x as i32),
|
||||||
None => server.notify_client(
|
None => server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(String::from("You have no position.")),
|
ServerGeneral::server_msg(ChatType::CommandError, String::from("You have no position.")),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1842,11 +1838,11 @@ spawn_rate {:?} "#,
|
|||||||
))
|
))
|
||||||
};
|
};
|
||||||
if let Some(s) = msg_generator() {
|
if let Some(s) = msg_generator() {
|
||||||
server.notify_client(client, ChatType::CommandInfo.server_msg(s));
|
server.notify_client(client, ServerGeneral::server_msg(ChatType::CommandInfo, s));
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Not a pregenerated chunk."),
|
ServerGeneral::server_msg(ChatType::CommandError, "Not a pregenerated chunk."),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1862,7 +1858,7 @@ fn find_target(
|
|||||||
.find(|(_, player)| player.alias == alias)
|
.find(|(_, player)| player.alias == alias)
|
||||||
.map(|(entity, _)| entity)
|
.map(|(entity, _)| entity)
|
||||||
.ok_or_else(|| {
|
.ok_or_else(|| {
|
||||||
ChatType::CommandError.server_msg(format!("Player '{}' not found!", alias))
|
ServerGeneral::server_msg(ChatType::CommandError, format!("Player '{}' not found!", alias))
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
Ok(fallback)
|
Ok(fallback)
|
||||||
@ -1889,7 +1885,7 @@ fn handle_give_exp(
|
|||||||
if let Some(stats) = ecs.write_storage::<comp::Stats>().get_mut(player) {
|
if let Some(stats) = ecs.write_storage::<comp::Stats>().get_mut(player) {
|
||||||
stats.exp.change_by(exp);
|
stats.exp.change_by(exp);
|
||||||
} else {
|
} else {
|
||||||
error_msg = Some(ChatType::CommandError.server_msg("Player has no stats!"));
|
error_msg = Some(ServerGeneral::server_msg(ChatType::CommandError, "Player has no stats!"));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
@ -1940,7 +1936,7 @@ fn handle_set_level(
|
|||||||
stats.level.set_level(lvl);
|
stats.level.set_level(lvl);
|
||||||
body_type = Some(stats.body_type);
|
body_type = Some(stats.body_type);
|
||||||
} else {
|
} else {
|
||||||
error_msg = Some(ChatType::CommandError.server_msg("Player has no stats!"));
|
error_msg = Some(ServerGeneral::server_msg(ChatType::CommandError, "Player has no stats!"));
|
||||||
body_type = None;
|
body_type = None;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1990,7 +1986,7 @@ fn handle_debug(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Debug items not found? Something is very broken."),
|
ServerGeneral::server_msg(ChatType::CommandError, "Debug items not found? Something is very broken."),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2028,7 +2024,7 @@ fn handle_remove_lights(
|
|||||||
},
|
},
|
||||||
None => server.notify_client(
|
None => server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("You have no position."),
|
ServerGeneral::server_msg(ChatType::CommandError, "You have no position."),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2042,7 +2038,7 @@ fn handle_remove_lights(
|
|||||||
|
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(format!("Removed {} lights!", size)),
|
ServerGeneral::server_msg(ChatType::CommandError, format!("Removed {} lights!", size)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2068,19 +2064,19 @@ fn handle_sudo(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg("Could not find that player"),
|
ServerGeneral::server_msg(ChatType::CommandError, "Could not find that player"),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(format!("Unknown command: /{}", cmd)),
|
ServerGeneral::server_msg(ChatType::CommandError, format!("Unknown command: /{}", cmd)),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2094,7 +2090,7 @@ fn handle_version(
|
|||||||
) {
|
) {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandInfo, format!(
|
||||||
"Server is running {}[{}]",
|
"Server is running {}[{}]",
|
||||||
common::util::GIT_HASH.to_string(),
|
common::util::GIT_HASH.to_string(),
|
||||||
common::util::GIT_DATE.to_string(),
|
common::util::GIT_DATE.to_string(),
|
||||||
@ -2119,7 +2115,7 @@ fn handle_whitelist(
|
|||||||
.map_err(|_| {
|
.map_err(|_| {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandError, format!(
|
||||||
"Unable to determine UUID for username \"{}\"",
|
"Unable to determine UUID for username \"{}\"",
|
||||||
&username
|
&username
|
||||||
)),
|
)),
|
||||||
@ -2136,8 +2132,7 @@ fn handle_whitelist(
|
|||||||
.edit(server.data_dir().as_ref(), |w| w.insert(uuid));
|
.edit(server.data_dir().as_ref(), |w| w.insert(uuid));
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo
|
ServerGeneral::server_msg(ChatType::CommandInfo, format!("\"{}\" added to whitelist", username)),
|
||||||
.server_msg(format!("\"{}\" added to whitelist", username)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else if whitelist_action.eq_ignore_ascii_case("remove") {
|
} else if whitelist_action.eq_ignore_ascii_case("remove") {
|
||||||
@ -2148,20 +2143,19 @@ fn handle_whitelist(
|
|||||||
.edit(server.data_dir().as_ref(), |w| w.remove(&uuid));
|
.edit(server.data_dir().as_ref(), |w| w.remove(&uuid));
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo
|
ServerGeneral::server_msg(ChatType::CommandInfo, format!("\"{}\" removed from whitelist", username)),
|
||||||
.server_msg(format!("\"{}\" removed from whitelist", username)),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2199,7 +2193,7 @@ fn handle_kick(
|
|||||||
kick_player(server, target_player, &reason);
|
kick_player(server, target_player, &reason);
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandInfo, format!(
|
||||||
"Kicked {} from the server with reason: {}",
|
"Kicked {} from the server with reason: {}",
|
||||||
target_alias, reason
|
target_alias, reason
|
||||||
)),
|
)),
|
||||||
@ -2207,14 +2201,13 @@ fn handle_kick(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError
|
ServerGeneral::server_msg(ChatType::CommandError, format!("Player with alias {} not found", target_alias)),
|
||||||
.server_msg(format!("Player with alias {} not found", target_alias)),
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2240,8 +2233,7 @@ fn handle_ban(
|
|||||||
if server.editable_settings().banlist.contains_key(&uuid) {
|
if server.editable_settings().banlist.contains_key(&uuid) {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError
|
ServerGeneral::server_msg(ChatType::CommandError, format!("{} is already on the banlist", target_alias)),
|
||||||
.server_msg(format!("{} is already on the banlist", target_alias)),
|
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
server
|
server
|
||||||
@ -2255,7 +2247,7 @@ fn handle_ban(
|
|||||||
});
|
});
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandInfo, format!(
|
||||||
"Added {} to the banlist with reason: {}",
|
"Added {} to the banlist with reason: {}",
|
||||||
target_alias, reason
|
target_alias, reason
|
||||||
)),
|
)),
|
||||||
@ -2274,7 +2266,7 @@ fn handle_ban(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandError, format!(
|
||||||
"Unable to determine UUID for username \"{}\"",
|
"Unable to determine UUID for username \"{}\"",
|
||||||
target_alias
|
target_alias
|
||||||
)),
|
)),
|
||||||
@ -2283,7 +2275,7 @@ fn handle_ban(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2311,12 +2303,12 @@ fn handle_unban(
|
|||||||
});
|
});
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandInfo.server_msg(format!("{} was successfully unbanned", username)),
|
ServerGeneral::server_msg(ChatType::CommandInfo, format!("{} was successfully unbanned", username)),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandError, format!(
|
||||||
"Unable to determine UUID for username \"{}\"",
|
"Unable to determine UUID for username \"{}\"",
|
||||||
username
|
username
|
||||||
)),
|
)),
|
||||||
@ -2325,7 +2317,7 @@ fn handle_unban(
|
|||||||
} else {
|
} else {
|
||||||
server.notify_client(
|
server.notify_client(
|
||||||
client,
|
client,
|
||||||
ChatType::CommandError.server_msg(action.help_string()),
|
ServerGeneral::server_msg(ChatType::CommandError, action.help_string()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,14 +14,17 @@ use common::{
|
|||||||
},
|
},
|
||||||
effect::Effect,
|
effect::Effect,
|
||||||
lottery::Lottery,
|
lottery::Lottery,
|
||||||
msg::{PlayerListUpdate, ServerGeneral},
|
|
||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
rtsim::RtSimEntity,
|
rtsim::RtSimEntity,
|
||||||
sync::{Uid, UidAllocator, WorldSyncExt},
|
uid::{Uid, UidAllocator},
|
||||||
terrain::{Block, TerrainGrid},
|
terrain::{Block, TerrainGrid},
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
Damage, DamageSource, Explosion, GroupTarget, RadiusEffect,
|
Damage, DamageSource, Explosion, GroupTarget, RadiusEffect,
|
||||||
};
|
};
|
||||||
|
use common_net::{
|
||||||
|
msg::{PlayerListUpdate, ServerGeneral},
|
||||||
|
sync::WorldSyncExt,
|
||||||
|
};
|
||||||
use common_sys::state::BlockChange;
|
use common_sys::state::BlockChange;
|
||||||
use comp::item::Reagent;
|
use comp::item::Reagent;
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
@ -225,7 +228,7 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc
|
|||||||
| HealthSource::Unknown => KillSource::Other,
|
| HealthSource::Unknown => KillSource::Other,
|
||||||
};
|
};
|
||||||
state
|
state
|
||||||
.notify_players(comp::ChatType::Kill(kill_source, *uid).server_msg("".to_string()));
|
.notify_players(ServerGeneral::server_msg(comp::ChatType::Kill(kill_source, *uid), "".to_string()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,8 +5,10 @@ use common::{
|
|||||||
group::{self, Group, GroupManager, Invite, PendingInvites},
|
group::{self, Group, GroupManager, Invite, PendingInvites},
|
||||||
ChatType, GroupManip,
|
ChatType, GroupManip,
|
||||||
},
|
},
|
||||||
|
uid::Uid,
|
||||||
|
};
|
||||||
|
use common_net::{
|
||||||
msg::{InviteAnswer, ServerGeneral},
|
msg::{InviteAnswer, ServerGeneral},
|
||||||
sync,
|
|
||||||
sync::WorldSyncExt,
|
sync::WorldSyncExt,
|
||||||
};
|
};
|
||||||
use specs::world::WorldExt;
|
use specs::world::WorldExt;
|
||||||
@ -31,16 +33,16 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
|||||||
None => {
|
None => {
|
||||||
// Inform of failure
|
// Inform of failure
|
||||||
if let Some(client) = clients.get(entity) {
|
if let Some(client) = clients.get(entity) {
|
||||||
client.send_fallible(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
ChatType::Meta
|
ChatType::Meta,
|
||||||
.server_msg("Invite failed, target does not exist.".to_owned()),
|
"Invite failed, target does not exist.",
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
let uids = state.ecs().read_storage::<sync::Uid>();
|
let uids = state.ecs().read_storage::<Uid>();
|
||||||
|
|
||||||
// Check if entity is trying to invite themselves to a group
|
// Check if entity is trying to invite themselves to a group
|
||||||
if uids
|
if uids
|
||||||
@ -63,8 +65,9 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
|||||||
if already_in_same_group {
|
if already_in_same_group {
|
||||||
// Inform of failure
|
// Inform of failure
|
||||||
if let Some(client) = clients.get(entity) {
|
if let Some(client) = clients.get(entity) {
|
||||||
client.send_fallible(ChatType::Meta.server_msg(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
"Invite failed, can't invite someone already in your group".to_owned(),
|
ChatType::Meta,
|
||||||
|
"Invite failed, can't invite someone already in your group",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -93,13 +96,12 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
|||||||
if group_size_limit_reached {
|
if group_size_limit_reached {
|
||||||
// Inform inviter that they have reached the group size limit
|
// Inform inviter that they have reached the group size limit
|
||||||
if let Some(client) = clients.get(entity) {
|
if let Some(client) = clients.get(entity) {
|
||||||
client.send_fallible(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
ChatType::Meta.server_msg(
|
ChatType::Meta,
|
||||||
"Invite failed, pending invites plus current group size have reached \
|
"Invite failed, pending invites plus current group size have reached \
|
||||||
the group size limit"
|
the group size limit"
|
||||||
.to_owned(),
|
.to_owned(),
|
||||||
),
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -110,10 +112,10 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
|||||||
if invites.contains(invitee) {
|
if invites.contains(invitee) {
|
||||||
// Inform inviter that there is already an invite
|
// Inform inviter that there is already an invite
|
||||||
if let Some(client) = clients.get(entity) {
|
if let Some(client) = clients.get(entity) {
|
||||||
client.send_fallible(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
ChatType::Meta
|
ChatType::Meta,
|
||||||
.server_msg("This player already has a pending invite.".to_owned()),
|
"This player already has a pending invite.",
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -162,9 +164,10 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
|||||||
} else if agents.contains(invitee) {
|
} else if agents.contains(invitee) {
|
||||||
send_invite();
|
send_invite();
|
||||||
} else if let Some(client) = clients.get(entity) {
|
} else if let Some(client) = clients.get(entity) {
|
||||||
client.send_fallible(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
ChatType::Meta.server_msg("Can't invite, not a player or npc".to_owned()),
|
ChatType::Meta,
|
||||||
);
|
"Can't invite, not a player or npc",
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Notify inviter that the invite is pending
|
// Notify inviter that the invite is pending
|
||||||
@ -176,7 +179,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
|||||||
},
|
},
|
||||||
GroupManip::Accept => {
|
GroupManip::Accept => {
|
||||||
let clients = state.ecs().read_storage::<Client>();
|
let clients = state.ecs().read_storage::<Client>();
|
||||||
let uids = state.ecs().read_storage::<sync::Uid>();
|
let uids = state.ecs().read_storage::<Uid>();
|
||||||
let mut invites = state.ecs().write_storage::<Invite>();
|
let mut invites = state.ecs().write_storage::<Invite>();
|
||||||
if let Some(inviter) = invites.remove(entity).and_then(|invite| {
|
if let Some(inviter) = invites.remove(entity).and_then(|invite| {
|
||||||
let inviter = invite.0;
|
let inviter = invite.0;
|
||||||
@ -223,7 +226,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
|||||||
},
|
},
|
||||||
GroupManip::Decline => {
|
GroupManip::Decline => {
|
||||||
let clients = state.ecs().read_storage::<Client>();
|
let clients = state.ecs().read_storage::<Client>();
|
||||||
let uids = state.ecs().read_storage::<sync::Uid>();
|
let uids = state.ecs().read_storage::<Uid>();
|
||||||
let mut invites = state.ecs().write_storage::<Invite>();
|
let mut invites = state.ecs().write_storage::<Invite>();
|
||||||
if let Some(inviter) = invites.remove(entity).and_then(|invite| {
|
if let Some(inviter) = invites.remove(entity).and_then(|invite| {
|
||||||
let inviter = invite.0;
|
let inviter = invite.0;
|
||||||
@ -252,7 +255,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
|||||||
},
|
},
|
||||||
GroupManip::Leave => {
|
GroupManip::Leave => {
|
||||||
let clients = state.ecs().read_storage::<Client>();
|
let clients = state.ecs().read_storage::<Client>();
|
||||||
let uids = state.ecs().read_storage::<sync::Uid>();
|
let uids = state.ecs().read_storage::<Uid>();
|
||||||
let mut group_manager = state.ecs().write_resource::<GroupManager>();
|
let mut group_manager = state.ecs().write_resource::<GroupManager>();
|
||||||
group_manager.leave_group(
|
group_manager.leave_group(
|
||||||
entity,
|
entity,
|
||||||
@ -274,7 +277,7 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
|||||||
},
|
},
|
||||||
GroupManip::Kick(uid) => {
|
GroupManip::Kick(uid) => {
|
||||||
let clients = state.ecs().read_storage::<Client>();
|
let clients = state.ecs().read_storage::<Client>();
|
||||||
let uids = state.ecs().read_storage::<sync::Uid>();
|
let uids = state.ecs().read_storage::<Uid>();
|
||||||
let alignments = state.ecs().read_storage::<comp::Alignment>();
|
let alignments = state.ecs().read_storage::<comp::Alignment>();
|
||||||
|
|
||||||
let target = match state.ecs().entity_from_uid(uid.into()) {
|
let target = match state.ecs().entity_from_uid(uid.into()) {
|
||||||
@ -282,10 +285,10 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
|||||||
None => {
|
None => {
|
||||||
// Inform of failure
|
// Inform of failure
|
||||||
if let Some(client) = clients.get(entity) {
|
if let Some(client) = clients.get(entity) {
|
||||||
client.send_fallible(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
ChatType::Meta
|
ChatType::Meta,
|
||||||
.server_msg("Kick failed, target does not exist.".to_owned()),
|
"Kick failed, target does not exist.",
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
@ -295,19 +298,20 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
|||||||
if matches!(alignments.get(target), Some(comp::Alignment::Owned(owner)) if uids.get(target).map_or(true, |u| u != owner))
|
if matches!(alignments.get(target), Some(comp::Alignment::Owned(owner)) if uids.get(target).map_or(true, |u| u != owner))
|
||||||
{
|
{
|
||||||
if let Some(general_stream) = clients.get(entity) {
|
if let Some(general_stream) = clients.get(entity) {
|
||||||
general_stream.send_fallible(
|
general_stream.send_fallible(ServerGeneral::server_msg(
|
||||||
ChatType::Meta.server_msg("Kick failed, you can't kick pets.".to_owned()),
|
ChatType::Meta,
|
||||||
);
|
"Kick failed, you can't kick pets.",
|
||||||
|
));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Can't kick yourself
|
// Can't kick yourself
|
||||||
if uids.get(entity).map_or(false, |u| *u == uid) {
|
if uids.get(entity).map_or(false, |u| *u == uid) {
|
||||||
if let Some(client) = clients.get(entity) {
|
if let Some(client) = clients.get(entity) {
|
||||||
client.send_fallible(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
ChatType::Meta
|
ChatType::Meta,
|
||||||
.server_msg("Kick failed, you can't kick yourself.".to_owned()),
|
"Kick failed, you can't kick yourself.",
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -341,47 +345,50 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
|||||||
|
|
||||||
// Tell them the have been kicked
|
// Tell them the have been kicked
|
||||||
if let Some(client) = clients.get(target) {
|
if let Some(client) = clients.get(target) {
|
||||||
client.send_fallible(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
ChatType::Meta
|
ChatType::Meta,
|
||||||
.server_msg("You were removed from the group.".to_owned()),
|
"You were removed from the group.",
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
// Tell kicker that they were succesful
|
// Tell kicker that they were succesful
|
||||||
if let Some(client) = clients.get(entity) {
|
if let Some(client) = clients.get(entity) {
|
||||||
client
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
.send_fallible(ChatType::Meta.server_msg("Player kicked.".to_owned()));
|
ChatType::Meta,
|
||||||
|
"Player kicked.",
|
||||||
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
// Inform kicker that they are not the leader
|
// Inform kicker that they are not the leader
|
||||||
if let Some(client) = clients.get(entity) {
|
if let Some(client) = clients.get(entity) {
|
||||||
client.send_fallible(ChatType::Meta.server_msg(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
"Kick failed: You are not the leader of the target's group.".to_owned(),
|
ChatType::Meta,
|
||||||
|
"Kick failed: You are not the leader of the target's group.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
// Inform kicker that the target is not in a group
|
// Inform kicker that the target is not in a group
|
||||||
if let Some(client) = clients.get(entity) {
|
if let Some(client) = clients.get(entity) {
|
||||||
client.send_fallible(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
ChatType::Meta.server_msg(
|
ChatType::Meta,
|
||||||
"Kick failed: Your target is not in a group.".to_owned(),
|
"Kick failed: Your target is not in a group.",
|
||||||
),
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
GroupManip::AssignLeader(uid) => {
|
GroupManip::AssignLeader(uid) => {
|
||||||
let clients = state.ecs().read_storage::<Client>();
|
let clients = state.ecs().read_storage::<Client>();
|
||||||
let uids = state.ecs().read_storage::<sync::Uid>();
|
let uids = state.ecs().read_storage::<Uid>();
|
||||||
let target = match state.ecs().entity_from_uid(uid.into()) {
|
let target = match state.ecs().entity_from_uid(uid.into()) {
|
||||||
Some(t) => t,
|
Some(t) => t,
|
||||||
None => {
|
None => {
|
||||||
// Inform of failure
|
// Inform of failure
|
||||||
if let Some(client) = clients.get(entity) {
|
if let Some(client) = clients.get(entity) {
|
||||||
client.send_fallible(ChatType::Meta.server_msg(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
"Leadership transfer failed, target does not exist".to_owned(),
|
ChatType::Meta,
|
||||||
|
"Leadership transfer failed, target does not exist",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -415,34 +422,34 @@ pub fn handle_group(server: &mut Server, entity: specs::Entity, manip: GroupMani
|
|||||||
);
|
);
|
||||||
// Tell them they are the leader
|
// Tell them they are the leader
|
||||||
if let Some(client) = clients.get(target) {
|
if let Some(client) = clients.get(target) {
|
||||||
client.send_fallible(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
ChatType::Meta.server_msg("You are the group leader now.".to_owned()),
|
ChatType::Meta,
|
||||||
);
|
"You are the group leader now.",
|
||||||
|
));
|
||||||
}
|
}
|
||||||
// Tell the old leader that the transfer was succesful
|
// Tell the old leader that the transfer was succesful
|
||||||
if let Some(client) = clients.get(target) {
|
if let Some(client) = clients.get(target) {
|
||||||
client.send_fallible(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
ChatType::Meta
|
ChatType::Meta,
|
||||||
.server_msg("You are no longer the group leader.".to_owned()),
|
"You are no longer the group leader.",
|
||||||
);
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Some(_) => {
|
Some(_) => {
|
||||||
// Inform transferer that they are not the leader
|
// Inform transferer that they are not the leader
|
||||||
if let Some(client) = clients.get(entity) {
|
if let Some(client) = clients.get(entity) {
|
||||||
client.send_fallible(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
ChatType::Meta.server_msg(
|
ChatType::Meta,
|
||||||
"Transfer failed: You are not the leader of the target's group."
|
"Transfer failed: You are not the leader of the target's group.",
|
||||||
.to_owned(),
|
));
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
None => {
|
None => {
|
||||||
// Inform transferer that the target is not in a group
|
// Inform transferer that the target is not in a group
|
||||||
if let Some(client) = clients.get(entity) {
|
if let Some(client) = clients.get(entity) {
|
||||||
client.send_fallible(ChatType::Meta.server_msg(
|
client.send_fallible(ServerGeneral::server_msg(
|
||||||
"Transfer failed: Your target is not in a group.".to_owned(),
|
ChatType::Meta,
|
||||||
|
"Transfer failed: Your target is not in a group.",
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -10,9 +10,9 @@ use common::{
|
|||||||
Pos,
|
Pos,
|
||||||
},
|
},
|
||||||
consts::MAX_MOUNT_RANGE,
|
consts::MAX_MOUNT_RANGE,
|
||||||
msg::ServerGeneral,
|
uid::Uid,
|
||||||
sync::{Uid, WorldSyncExt},
|
|
||||||
};
|
};
|
||||||
|
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
||||||
use specs::{world::WorldExt, Entity as EcsEntity};
|
use specs::{world::WorldExt, Entity as EcsEntity};
|
||||||
use tracing::error;
|
use tracing::error;
|
||||||
|
|
||||||
|
@ -5,12 +5,12 @@ use common::{
|
|||||||
slot::{self, Slot},
|
slot::{self, Slot},
|
||||||
},
|
},
|
||||||
consts::MAX_PICKUP_RANGE,
|
consts::MAX_PICKUP_RANGE,
|
||||||
msg::ServerGeneral,
|
|
||||||
recipe::default_recipe_book,
|
recipe::default_recipe_book,
|
||||||
sync::{Uid, WorldSyncExt},
|
uid::Uid,
|
||||||
util::find_dist::{self, FindDist},
|
util::find_dist::{self, FindDist},
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
};
|
};
|
||||||
|
use common_net::{msg::ServerGeneral, sync::WorldSyncExt};
|
||||||
use common_sys::state::State;
|
use common_sys::state::State;
|
||||||
use comp::LightEmitter;
|
use comp::LightEmitter;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
|
@ -6,10 +6,10 @@ use crate::{
|
|||||||
use common::{
|
use common::{
|
||||||
comp,
|
comp,
|
||||||
comp::{group, Player},
|
comp::{group, Player},
|
||||||
msg::{PlayerListUpdate, PresenceKind, ServerGeneral},
|
|
||||||
span,
|
span,
|
||||||
sync::{Uid, UidAllocator},
|
uid::{Uid, UidAllocator},
|
||||||
};
|
};
|
||||||
|
use common_net::msg::{PlayerListUpdate, PresenceKind, ServerGeneral};
|
||||||
use common_sys::state::State;
|
use common_sys::state::State;
|
||||||
use futures_executor::block_on;
|
use futures_executor::block_on;
|
||||||
use specs::{saveload::MarkerAllocator, Builder, Entity as EcsEntity, WorldExt};
|
use specs::{saveload::MarkerAllocator, Builder, Entity as EcsEntity, WorldExt};
|
||||||
@ -137,7 +137,7 @@ pub fn handle_client_disconnect(server: &mut Server, entity: EcsEntity) -> Event
|
|||||||
state.read_storage::<Uid>().get(entity),
|
state.read_storage::<Uid>().get(entity),
|
||||||
state.read_storage::<comp::Player>().get(entity),
|
state.read_storage::<comp::Player>().get(entity),
|
||||||
) {
|
) {
|
||||||
state.notify_players(comp::ChatType::Offline(*uid).server_msg(""));
|
state.notify_players(ServerGeneral::server_msg(comp::ChatType::Offline(*uid), ""));
|
||||||
|
|
||||||
state.notify_players(ServerGeneral::PlayerListUpdate(PlayerListUpdate::Remove(
|
state.notify_players(ServerGeneral::PlayerListUpdate(PlayerListUpdate::Remove(
|
||||||
*uid,
|
*uid,
|
||||||
|
@ -51,15 +51,18 @@ use common::{
|
|||||||
cmd::ChatCommand,
|
cmd::ChatCommand,
|
||||||
comp::{self, ChatType},
|
comp::{self, ChatType},
|
||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
msg::{ClientType, DisconnectReason, ServerGeneral, ServerInfo, ServerInit, ServerMsg, WorldMapMsg},
|
|
||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
recipe::default_recipe_book,
|
recipe::default_recipe_book,
|
||||||
resources::TimeOfDay,
|
resources::TimeOfDay,
|
||||||
rtsim::RtSimEntity,
|
rtsim::RtSimEntity,
|
||||||
sync::{Uid, WorldSyncExt},
|
uid::Uid,
|
||||||
terrain::TerrainChunkSize,
|
terrain::TerrainChunkSize,
|
||||||
vol::{ReadVol, RectVolSize},
|
vol::{ReadVol, RectVolSize},
|
||||||
};
|
};
|
||||||
|
use common_net::{
|
||||||
|
sync::WorldSyncExt,
|
||||||
|
msg::{ClientType, DisconnectReason, ServerGeneral, ServerInfo, ServerInit, ServerMsg, WorldMapMsg},
|
||||||
|
};
|
||||||
use common_sys::{
|
use common_sys::{
|
||||||
state::State,
|
state::State,
|
||||||
plugin::PluginMgr,
|
plugin::PluginMgr,
|
||||||
@ -1022,7 +1025,7 @@ impl Server {
|
|||||||
if e.is_empty() {
|
if e.is_empty() {
|
||||||
self.notify_client(
|
self.notify_client(
|
||||||
entity,
|
entity,
|
||||||
ChatType::CommandError.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandError, format!(
|
||||||
"Unknown command '/{}'.\nType '/help' for available commands",
|
"Unknown command '/{}'.\nType '/help' for available commands",
|
||||||
kwd
|
kwd
|
||||||
))
|
))
|
||||||
@ -1034,14 +1037,14 @@ impl Server {
|
|||||||
if !e.is_empty() {
|
if !e.is_empty() {
|
||||||
self.notify_client(
|
self.notify_client(
|
||||||
entity,
|
entity,
|
||||||
ChatType::CommandInfo.server_msg(e.join("\n")),
|
ServerGeneral::server_msg(ChatType::CommandInfo, e.join("\n")),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
self.notify_client(
|
self.notify_client(
|
||||||
entity,
|
entity,
|
||||||
ChatType::CommandError.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandError, format!(
|
||||||
"Error occurred while executing command '/{}'.\n{}",
|
"Error occurred while executing command '/{}'.\n{}",
|
||||||
kwd,
|
kwd,
|
||||||
e
|
e
|
||||||
@ -1056,7 +1059,7 @@ impl Server {
|
|||||||
error!(?e, "Can't execute command {} {}",kwd,args);
|
error!(?e, "Can't execute command {} {}",kwd,args);
|
||||||
self.notify_client(
|
self.notify_client(
|
||||||
entity,
|
entity,
|
||||||
ChatType::CommandError.server_msg(format!(
|
ServerGeneral::server_msg(ChatType::CommandError, format!(
|
||||||
"Internal error while executing '/{}'.\nContact the server administrator",
|
"Internal error while executing '/{}'.\nContact the server administrator",
|
||||||
kwd
|
kwd
|
||||||
))
|
))
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
use crate::settings::BanRecord;
|
use crate::settings::BanRecord;
|
||||||
use authc::{AuthClient, AuthClientError, AuthToken, Uuid};
|
use authc::{AuthClient, AuthClientError, AuthToken, Uuid};
|
||||||
use common::msg::RegisterError;
|
use common_net::msg::RegisterError;
|
||||||
use hashbrown::{HashMap, HashSet};
|
use hashbrown::{HashMap, HashSet};
|
||||||
use std::str::FromStr;
|
use std::str::FromStr;
|
||||||
use tracing::{error, info};
|
use tracing::{error, info};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
use common::msg::PresenceKind;
|
use common_net::msg::PresenceKind;
|
||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use specs::{Component, FlaggedStorage};
|
use specs::{Component, FlaggedStorage};
|
||||||
|
@ -6,10 +6,13 @@ use common::{
|
|||||||
character::CharacterId,
|
character::CharacterId,
|
||||||
comp,
|
comp,
|
||||||
effect::Effect,
|
effect::Effect,
|
||||||
msg::{CharacterInfo, PlayerListUpdate, PresenceKind, ServerGeneral},
|
uid::{Uid, UidAllocator},
|
||||||
sync::{Uid, UidAllocator, WorldSyncExt},
|
|
||||||
util::Dir,
|
util::Dir,
|
||||||
};
|
};
|
||||||
|
use common_net::{
|
||||||
|
msg::{CharacterInfo, PlayerListUpdate, PresenceKind, ServerGeneral},
|
||||||
|
sync::WorldSyncExt,
|
||||||
|
};
|
||||||
use common_sys::state::State;
|
use common_sys::state::State;
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use specs::{
|
use specs::{
|
||||||
|
@ -9,15 +9,15 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
comp::{ForceUpdate, Inventory, InventoryUpdate, Last, Ori, Pos, Vel},
|
comp::{ForceUpdate, Inventory, InventoryUpdate, Last, Ori, Pos, Vel},
|
||||||
msg::ServerGeneral,
|
|
||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
region::{Event as RegionEvent, RegionMap},
|
region::{Event as RegionEvent, RegionMap},
|
||||||
resources::TimeOfDay,
|
resources::TimeOfDay,
|
||||||
span,
|
span,
|
||||||
sync::{CompSyncPackage, Uid},
|
uid::Uid,
|
||||||
terrain::TerrainChunkSize,
|
terrain::TerrainChunkSize,
|
||||||
vol::RectVolSize,
|
vol::RectVolSize,
|
||||||
};
|
};
|
||||||
|
use common_net::{msg::ServerGeneral, sync::CompSyncPackage};
|
||||||
use specs::{
|
use specs::{
|
||||||
Entities, Entity as EcsEntity, Join, Read, ReadExpect, ReadStorage, System, Write, WriteStorage,
|
Entities, Entity as EcsEntity, Join, Read, ReadExpect, ReadStorage, System, Write, WriteStorage,
|
||||||
};
|
};
|
||||||
|
@ -2,10 +2,10 @@ use super::SysTimer;
|
|||||||
use crate::client::Client;
|
use crate::client::Client;
|
||||||
use common::{
|
use common::{
|
||||||
comp::group::{Invite, PendingInvites},
|
comp::group::{Invite, PendingInvites},
|
||||||
msg::{InviteAnswer, ServerGeneral},
|
|
||||||
span,
|
span,
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
};
|
};
|
||||||
|
use common_net::msg::{InviteAnswer, ServerGeneral};
|
||||||
use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage};
|
use specs::{Entities, Join, ReadStorage, System, Write, WriteStorage};
|
||||||
|
|
||||||
/// This system removes timed out group invites
|
/// This system removes timed out group invites
|
||||||
|
@ -6,10 +6,10 @@ use crate::{
|
|||||||
use common::{
|
use common::{
|
||||||
comp::{item::tool::AbilityMap, ChatType, Player, UnresolvedChatMsg},
|
comp::{item::tool::AbilityMap, ChatType, Player, UnresolvedChatMsg},
|
||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
msg::{ClientGeneral, ServerGeneral},
|
|
||||||
span,
|
span,
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
};
|
};
|
||||||
|
use common_net::msg::{ClientGeneral, ServerGeneral};
|
||||||
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write};
|
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write};
|
||||||
use std::sync::atomic::Ordering;
|
use std::sync::atomic::Ordering;
|
||||||
use tracing::{debug, warn};
|
use tracing::{debug, warn};
|
||||||
@ -62,9 +62,10 @@ impl Sys {
|
|||||||
|
|
||||||
// Give the player a welcome message
|
// Give the player a welcome message
|
||||||
if !editable_settings.server_description.is_empty() {
|
if !editable_settings.server_description.is_empty() {
|
||||||
client.send(ChatType::CommandInfo.server_msg(String::from(
|
client.send(ServerGeneral::server_msg(
|
||||||
|
ChatType::CommandInfo,
|
||||||
&*editable_settings.server_description,
|
&*editable_settings.server_description,
|
||||||
)))?;
|
))?;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !client.login_msg_sent.load(Ordering::Relaxed) {
|
if !client.login_msg_sent.load(Ordering::Relaxed) {
|
||||||
|
@ -3,11 +3,11 @@ use crate::{client::Client, metrics::PlayerMetrics};
|
|||||||
use common::{
|
use common::{
|
||||||
comp::{ChatMode, Player, UnresolvedChatMsg},
|
comp::{ChatMode, Player, UnresolvedChatMsg},
|
||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
msg::{validate_chat_msg, ChatMsgValidationError, ClientGeneral, MAX_BYTES_CHAT_MSG},
|
|
||||||
resources::Time,
|
resources::Time,
|
||||||
span,
|
span,
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
};
|
};
|
||||||
|
use common_net::msg::{validate_chat_msg, ChatMsgValidationError, ClientGeneral, MAX_BYTES_CHAT_MSG};
|
||||||
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write};
|
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write};
|
||||||
use std::sync::atomic::Ordering;
|
use std::sync::atomic::Ordering;
|
||||||
use tracing::{debug, error, warn};
|
use tracing::{debug, error, warn};
|
||||||
|
@ -3,11 +3,11 @@ use crate::{client::Client, metrics::NetworkRequestMetrics, presence::Presence,
|
|||||||
use common::{
|
use common::{
|
||||||
comp::{CanBuild, ControlEvent, Controller, ForceUpdate, Health, Ori, Pos, Stats, Vel},
|
comp::{CanBuild, ControlEvent, Controller, ForceUpdate, Health, Ori, Pos, Stats, Vel},
|
||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
msg::{ClientGeneral, PresenceKind, ServerGeneral},
|
|
||||||
span,
|
span,
|
||||||
terrain::{TerrainChunkSize, TerrainGrid},
|
terrain::{TerrainChunkSize, TerrainGrid},
|
||||||
vol::{ReadVol, RectVolSize},
|
vol::{ReadVol, RectVolSize},
|
||||||
};
|
};
|
||||||
|
use common_net::msg::{ClientGeneral, PresenceKind, ServerGeneral};
|
||||||
use common_sys::state::BlockChange;
|
use common_sys::state::BlockChange;
|
||||||
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write, WriteStorage};
|
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write, WriteStorage};
|
||||||
use tracing::{debug, trace};
|
use tracing::{debug, trace};
|
||||||
|
@ -2,10 +2,10 @@ use super::super::SysTimer;
|
|||||||
use crate::{client::Client, metrics::PlayerMetrics, Settings};
|
use crate::{client::Client, metrics::PlayerMetrics, Settings};
|
||||||
use common::{
|
use common::{
|
||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
msg::PingMsg,
|
|
||||||
resources::Time,
|
resources::Time,
|
||||||
span,
|
span,
|
||||||
};
|
};
|
||||||
|
use common_net::msg::PingMsg;
|
||||||
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write};
|
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write};
|
||||||
use std::sync::atomic::Ordering;
|
use std::sync::atomic::Ordering;
|
||||||
use tracing::{debug, info};
|
use tracing::{debug, info};
|
||||||
|
@ -4,12 +4,12 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
comp::{Admin, Player, Stats},
|
comp::{Admin, Player, Stats},
|
||||||
msg::{
|
|
||||||
CharacterInfo, ClientRegister, PlayerInfo, PlayerListUpdate, RegisterError, ServerGeneral,
|
|
||||||
ServerRegisterAnswer,
|
|
||||||
},
|
|
||||||
span,
|
span,
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
|
};
|
||||||
|
use common_net::msg::{
|
||||||
|
CharacterInfo, ClientRegister, PlayerInfo, PlayerListUpdate, RegisterError, ServerGeneral,
|
||||||
|
ServerRegisterAnswer,
|
||||||
};
|
};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use specs::{Entities, Join, ReadExpect, ReadStorage, System, Write, WriteExpect, WriteStorage};
|
use specs::{Entities, Join, ReadExpect, ReadStorage, System, Write, WriteExpect, WriteStorage};
|
||||||
|
@ -5,9 +5,9 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
comp::{Inventory, Loadout, Stats, Waypoint},
|
comp::{Inventory, Loadout, Stats, Waypoint},
|
||||||
msg::PresenceKind,
|
|
||||||
span,
|
span,
|
||||||
};
|
};
|
||||||
|
use common_net::msg::PresenceKind;
|
||||||
use specs::{Join, ReadExpect, ReadStorage, System, Write};
|
use specs::{Join, ReadExpect, ReadStorage, System, Write};
|
||||||
|
|
||||||
pub struct Sys;
|
pub struct Sys;
|
||||||
|
@ -5,9 +5,12 @@ use common::{
|
|||||||
Group, Health, Item, LightEmitter, Loadout, Mass, MountState, Mounting, Ori, Player, Pos,
|
Group, Health, Item, LightEmitter, Loadout, Mass, MountState, Mounting, Ori, Player, Pos,
|
||||||
Scale, Shockwave, Stats, Sticky, Vel,
|
Scale, Shockwave, Stats, Sticky, Vel,
|
||||||
},
|
},
|
||||||
msg::EcsCompPacket,
|
|
||||||
span,
|
span,
|
||||||
sync::{CompSyncPackage, EntityPackage, EntitySyncPackage, Uid, UpdateTracker, WorldSyncExt},
|
uid::Uid,
|
||||||
|
};
|
||||||
|
use common_net::{
|
||||||
|
msg::EcsCompPacket,
|
||||||
|
sync::{CompSyncPackage, EntityPackage, EntitySyncPackage, UpdateTracker, WorldSyncExt},
|
||||||
};
|
};
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
use specs::{
|
use specs::{
|
||||||
|
@ -8,13 +8,13 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
comp::{Ori, Pos, Vel},
|
comp::{Ori, Pos, Vel},
|
||||||
msg::ServerGeneral,
|
|
||||||
region::{region_in_vd, regions_in_vd, Event as RegionEvent, RegionMap},
|
region::{region_in_vd, regions_in_vd, Event as RegionEvent, RegionMap},
|
||||||
span,
|
span,
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
terrain::TerrainChunkSize,
|
terrain::TerrainChunkSize,
|
||||||
vol::RectVolSize,
|
vol::RectVolSize,
|
||||||
};
|
};
|
||||||
|
use common_net::msg::ServerGeneral;
|
||||||
use specs::{
|
use specs::{
|
||||||
Entities, Join, ReadExpect, ReadStorage, System, SystemData, World, WorldExt, Write,
|
Entities, Join, ReadExpect, ReadStorage, System, SystemData, World, WorldExt, Write,
|
||||||
WriteStorage,
|
WriteStorage,
|
||||||
|
@ -6,12 +6,12 @@ use common::{
|
|||||||
comp::{self, bird_medium, item::tool::AbilityMap, Alignment, Pos},
|
comp::{self, bird_medium, item::tool::AbilityMap, Alignment, Pos},
|
||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
generation::get_npc_name,
|
generation::get_npc_name,
|
||||||
msg::ServerGeneral,
|
|
||||||
npc::NPC_NAMES,
|
npc::NPC_NAMES,
|
||||||
span,
|
span,
|
||||||
terrain::TerrainGrid,
|
terrain::TerrainGrid,
|
||||||
LoadoutBuilder,
|
LoadoutBuilder,
|
||||||
};
|
};
|
||||||
|
use common_net::msg::ServerGeneral;
|
||||||
use common_sys::state::TerrainChanges;
|
use common_sys::state::TerrainChanges;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use specs::{Join, Read, ReadExpect, ReadStorage, System, Write, WriteExpect};
|
use specs::{Join, Read, ReadExpect, ReadStorage, System, Write, WriteExpect};
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use super::SysTimer;
|
use super::SysTimer;
|
||||||
use crate::{client::Client, presence::Presence};
|
use crate::{client::Client, presence::Presence};
|
||||||
use common::{comp::Pos, msg::ServerGeneral, span, terrain::TerrainGrid};
|
use common::{comp::Pos, span, terrain::TerrainGrid};
|
||||||
|
use common_net::msg::ServerGeneral;
|
||||||
use common_sys::state::TerrainChanges;
|
use common_sys::state::TerrainChanges;
|
||||||
use specs::{Join, Read, ReadExpect, ReadStorage, System, Write};
|
use specs::{Join, Read, ReadExpect, ReadStorage, System, Write};
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@ use super::SysTimer;
|
|||||||
use crate::client::Client;
|
use crate::client::Client;
|
||||||
use common::{
|
use common::{
|
||||||
comp::{Player, Pos, Waypoint, WaypointArea},
|
comp::{Player, Pos, Waypoint, WaypointArea},
|
||||||
msg::{Notification, ServerGeneral},
|
|
||||||
resources::Time,
|
resources::Time,
|
||||||
span,
|
span,
|
||||||
};
|
};
|
||||||
|
use common_net::msg::{Notification, ServerGeneral};
|
||||||
use specs::{Entities, Join, Read, ReadStorage, System, Write, WriteStorage};
|
use specs::{Entities, Join, Read, ReadStorage, System, Write, WriteStorage};
|
||||||
|
|
||||||
/// Cooldown time (in seconds) for "Waypoint Saved" notifications
|
/// Cooldown time (in seconds) for "Waypoint Saved" notifications
|
||||||
|
@ -21,7 +21,8 @@ default = ["gl", "singleplayer", "native-dialog", "simd"]
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
client = {package = "veloren-client", path = "../client"}
|
client = {package = "veloren-client", path = "../client"}
|
||||||
common = {package = "veloren-common", path = "../common"}
|
common = {package = "veloren-common", path = "../common"}
|
||||||
common_sys = {package = "veloren_common_sys", path = "../common/sys"}
|
common-net = {package = "veloren-common-net", path = "../common/net"}
|
||||||
|
common-sys = {package = "veloren-common-sys", path = "../common/sys"}
|
||||||
|
|
||||||
anim = {package = "veloren-voxygen-anim", path = "anim", default-features = false}
|
anim = {package = "veloren-voxygen-anim", path = "anim", default-features = false}
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ use crate::ecs::{
|
|||||||
use common::{
|
use common::{
|
||||||
comp::{Health, HealthSource, Pos, Stats},
|
comp::{Health, HealthSource, Pos, Stats},
|
||||||
resources::DeltaTime,
|
resources::DeltaTime,
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
};
|
};
|
||||||
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write, WriteStorage};
|
use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, Write, WriteStorage};
|
||||||
|
|
||||||
|
@ -4,13 +4,11 @@ use super::{
|
|||||||
};
|
};
|
||||||
use crate::{i18n::Localization, ui::fonts::Fonts, GlobalState};
|
use crate::{i18n::Localization, ui::fonts::Fonts, GlobalState};
|
||||||
use client::{cmd, Client};
|
use client::{cmd, Client};
|
||||||
use common::{
|
use common::comp::{
|
||||||
comp::{
|
chat::{KillSource, KillType},
|
||||||
chat::{KillSource, KillType},
|
ChatMsg, ChatType,
|
||||||
ChatMsg, ChatType,
|
|
||||||
},
|
|
||||||
msg::validate_chat_msg,
|
|
||||||
};
|
};
|
||||||
|
use common_net::msg::validate_chat_msg;
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
input::Key,
|
input::Key,
|
||||||
position::Dimension,
|
position::Dimension,
|
||||||
|
@ -15,8 +15,9 @@ use crate::{
|
|||||||
use client::{self, Client};
|
use client::{self, Client};
|
||||||
use common::{
|
use common::{
|
||||||
comp::{group::Role, BuffKind, Stats},
|
comp::{group::Role, BuffKind, Stats},
|
||||||
sync::{Uid, WorldSyncExt},
|
uid::{Uid, UidAllocator},
|
||||||
};
|
};
|
||||||
|
use common_net::sync::WorldSyncExt;
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
color,
|
color,
|
||||||
position::{Place, Relative},
|
position::{Place, Relative},
|
||||||
@ -329,7 +330,7 @@ impl<'a> Widget for Group<'a> {
|
|||||||
let buffs = client_state.ecs().read_storage::<common::comp::Buffs>();
|
let buffs = client_state.ecs().read_storage::<common::comp::Buffs>();
|
||||||
let uid_allocator = client_state
|
let uid_allocator = client_state
|
||||||
.ecs()
|
.ecs()
|
||||||
.read_resource::<common::sync::UidAllocator>();
|
.read_resource::<UidAllocator>();
|
||||||
|
|
||||||
// Keep track of the total number of widget ids we are using for buffs
|
// Keep track of the total number of widget ids we are using for buffs
|
||||||
let mut total_buff_count = 0;
|
let mut total_buff_count = 0;
|
||||||
|
@ -9,7 +9,8 @@ use crate::{
|
|||||||
GlobalState,
|
GlobalState,
|
||||||
};
|
};
|
||||||
use client::{self, Client};
|
use client::{self, Client};
|
||||||
use common::{comp, msg::world_msg::SiteKind, terrain::TerrainChunkSize, vol::RectVolSize};
|
use common::{comp, terrain::TerrainChunkSize, vol::RectVolSize};
|
||||||
|
use common_net::msg::world_msg::SiteKind;
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
color, position,
|
color, position,
|
||||||
widget::{self, Button, Image, Rectangle, Text},
|
widget::{self, Button, Image, Rectangle, Text},
|
||||||
|
@ -5,7 +5,12 @@ use super::{
|
|||||||
};
|
};
|
||||||
use crate::ui::{fonts::Fonts, img_ids};
|
use crate::ui::{fonts::Fonts, img_ids};
|
||||||
use client::{self, Client};
|
use client::{self, Client};
|
||||||
use common::{comp, msg::world_msg::SiteKind, terrain::TerrainChunkSize, vol::RectVolSize};
|
use common::{
|
||||||
|
comp,
|
||||||
|
terrain::TerrainChunkSize,
|
||||||
|
vol::RectVolSize,
|
||||||
|
};
|
||||||
|
use common_net::msg::world_msg::SiteKind;
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
color, position,
|
color, position,
|
||||||
widget::{self, Button, Image, Rectangle, Text},
|
widget::{self, Button, Image, Rectangle, Text},
|
||||||
|
@ -61,13 +61,13 @@ use common::{
|
|||||||
item::{ItemDesc, Quality},
|
item::{ItemDesc, Quality},
|
||||||
BuffKind,
|
BuffKind,
|
||||||
},
|
},
|
||||||
msg::PresenceKind,
|
|
||||||
span,
|
span,
|
||||||
sync::Uid,
|
uid::Uid,
|
||||||
terrain::TerrainChunk,
|
terrain::TerrainChunk,
|
||||||
util::srgba_to_linear,
|
util::srgba_to_linear,
|
||||||
vol::RectRasterableVol,
|
vol::RectRasterableVol,
|
||||||
};
|
};
|
||||||
|
use common_net::msg::{PresenceKind, Notification};
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
text::cursor::Index,
|
text::cursor::Index,
|
||||||
widget::{self, Button, Image, Text},
|
widget::{self, Button, Image, Text},
|
||||||
@ -365,12 +365,12 @@ pub enum Event {
|
|||||||
ChangeAutoWalkBehavior(PressBehavior),
|
ChangeAutoWalkBehavior(PressBehavior),
|
||||||
ChangeStopAutoWalkOnInput(bool),
|
ChangeStopAutoWalkOnInput(bool),
|
||||||
CraftRecipe(String),
|
CraftRecipe(String),
|
||||||
InviteMember(common::sync::Uid),
|
InviteMember(Uid),
|
||||||
AcceptInvite,
|
AcceptInvite,
|
||||||
DeclineInvite,
|
DeclineInvite,
|
||||||
KickMember(common::sync::Uid),
|
KickMember(Uid),
|
||||||
LeaveGroup,
|
LeaveGroup,
|
||||||
AssignLeader(common::sync::Uid),
|
AssignLeader(Uid),
|
||||||
RemoveBuff(BuffKind),
|
RemoveBuff(BuffKind),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -613,7 +613,7 @@ pub struct Hud {
|
|||||||
fonts: Fonts,
|
fonts: Fonts,
|
||||||
rot_imgs: ImgsRot,
|
rot_imgs: ImgsRot,
|
||||||
new_messages: VecDeque<comp::ChatMsg>,
|
new_messages: VecDeque<comp::ChatMsg>,
|
||||||
new_notifications: VecDeque<common::msg::Notification>,
|
new_notifications: VecDeque<Notification>,
|
||||||
speech_bubbles: HashMap<Uid, comp::SpeechBubble>,
|
speech_bubbles: HashMap<Uid, comp::SpeechBubble>,
|
||||||
show: Show,
|
show: Show,
|
||||||
//never_show: bool,
|
//never_show: bool,
|
||||||
@ -767,7 +767,7 @@ impl Hud {
|
|||||||
let buffs = ecs.read_storage::<comp::Buffs>();
|
let buffs = ecs.read_storage::<comp::Buffs>();
|
||||||
let energy = ecs.read_storage::<comp::Energy>();
|
let energy = ecs.read_storage::<comp::Energy>();
|
||||||
let hp_floater_lists = ecs.read_storage::<vcomp::HpFloaterList>();
|
let hp_floater_lists = ecs.read_storage::<vcomp::HpFloaterList>();
|
||||||
let uids = ecs.read_storage::<common::sync::Uid>();
|
let uids = ecs.read_storage::<Uid>();
|
||||||
let interpolated = ecs.read_storage::<vcomp::Interpolated>();
|
let interpolated = ecs.read_storage::<vcomp::Interpolated>();
|
||||||
let scales = ecs.read_storage::<comp::Scale>();
|
let scales = ecs.read_storage::<comp::Scale>();
|
||||||
let bodies = ecs.read_storage::<comp::Body>();
|
let bodies = ecs.read_storage::<comp::Body>();
|
||||||
@ -2439,7 +2439,7 @@ impl Hud {
|
|||||||
|
|
||||||
pub fn new_message(&mut self, msg: comp::ChatMsg) { self.new_messages.push_back(msg); }
|
pub fn new_message(&mut self, msg: comp::ChatMsg) { self.new_messages.push_back(msg); }
|
||||||
|
|
||||||
pub fn new_notification(&mut self, msg: common::msg::Notification) {
|
pub fn new_notification(&mut self, msg: Notification) {
|
||||||
self.new_notifications.push_back(msg);
|
self.new_notifications.push_back(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
use super::Show;
|
use super::Show;
|
||||||
use crate::{i18n::Localization, ui::fonts::Fonts};
|
use crate::{i18n::Localization, ui::fonts::Fonts};
|
||||||
use client::{self, Client};
|
use client::{self, Client};
|
||||||
use common::msg::Notification;
|
use common_net::msg::Notification;
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
widget::{self, Text},
|
widget::{self, Text},
|
||||||
widget_ids, Color, Colorable, Positionable, Widget, WidgetCommon,
|
widget_ids, Color, Colorable, Positionable, Widget, WidgetCommon,
|
||||||
|
@ -8,7 +8,7 @@ use crate::{
|
|||||||
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
ui::{fonts::Fonts, ImageFrame, Tooltip, TooltipManager, Tooltipable},
|
||||||
};
|
};
|
||||||
use client::{self, Client};
|
use client::{self, Client};
|
||||||
use common::{comp::group, sync::Uid};
|
use common::{comp::group, uid::Uid};
|
||||||
use conrod_core::{
|
use conrod_core::{
|
||||||
color,
|
color,
|
||||||
widget::{self, Button, Image, Rectangle, Scrollbar, Text},
|
widget::{self, Button, Image, Rectangle, Scrollbar, Text},
|
||||||
|
@ -17,7 +17,6 @@ use common::{
|
|||||||
comp,
|
comp,
|
||||||
comp::{ChatMsg, ChatType, InventoryUpdateEvent, Pos, Vel},
|
comp::{ChatMsg, ChatType, InventoryUpdateEvent, Pos, Vel},
|
||||||
consts::{MAX_MOUNT_RANGE, MAX_PICKUP_RANGE},
|
consts::{MAX_MOUNT_RANGE, MAX_PICKUP_RANGE},
|
||||||
msg::PresenceKind,
|
|
||||||
outcome::Outcome,
|
outcome::Outcome,
|
||||||
span,
|
span,
|
||||||
terrain::{Block, BlockKind},
|
terrain::{Block, BlockKind},
|
||||||
@ -27,6 +26,7 @@ use common::{
|
|||||||
},
|
},
|
||||||
vol::ReadVol,
|
vol::ReadVol,
|
||||||
};
|
};
|
||||||
|
use common_net::msg::PresenceKind;
|
||||||
use ordered_float::OrderedFloat;
|
use ordered_float::OrderedFloat;
|
||||||
use specs::{Join, WorldExt};
|
use specs::{Join, WorldExt};
|
||||||
use std::{cell::RefCell, rc::Rc, sync::Arc, time::Duration};
|
use std::{cell::RefCell, rc::Rc, sync::Arc, time::Duration};
|
||||||
|
@ -10,8 +10,9 @@ simd = ["vek/platform_intrinsics"]
|
|||||||
default = ["simd"]
|
default = ["simd"]
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
bincode = "1.2.0"
|
|
||||||
common = { package = "veloren-common", path = "../common" }
|
common = { package = "veloren-common", path = "../common" }
|
||||||
|
common-net = { package = "veloren-common-net", path = "../common/net" }
|
||||||
|
bincode = "1.2.0"
|
||||||
bitvec = "0.17.4"
|
bitvec = "0.17.4"
|
||||||
fxhash = "0.2.1"
|
fxhash = "0.2.1"
|
||||||
image = { version = "0.23.8", default-features = false, features = ["png"] }
|
image = { version = "0.23.8", default-features = false, features = ["png"] }
|
||||||
|
@ -42,10 +42,10 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
generation::{ChunkSupplement, EntityInfo},
|
generation::{ChunkSupplement, EntityInfo},
|
||||||
msg::{world_msg, WorldMapMsg},
|
|
||||||
terrain::{Block, BlockKind, SpriteKind, TerrainChunk, TerrainChunkMeta, TerrainChunkSize},
|
terrain::{Block, BlockKind, SpriteKind, TerrainChunk, TerrainChunkMeta, TerrainChunkSize},
|
||||||
vol::{ReadVol, RectVolSize, WriteVol},
|
vol::{ReadVol, RectVolSize, WriteVol},
|
||||||
};
|
};
|
||||||
|
use common_net::msg::{world_msg, WorldMapMsg};
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
@ -37,7 +37,6 @@ use crate::{
|
|||||||
use common::{
|
use common::{
|
||||||
assets,
|
assets,
|
||||||
grid::Grid,
|
grid::Grid,
|
||||||
msg::WorldMapMsg,
|
|
||||||
store::Id,
|
store::Id,
|
||||||
terrain::{
|
terrain::{
|
||||||
map::MapConfig, uniform_idx_as_vec2, vec2_as_uniform_idx, BiomeKind, MapSizeLg,
|
map::MapConfig, uniform_idx_as_vec2, vec2_as_uniform_idx, BiomeKind, MapSizeLg,
|
||||||
@ -45,6 +44,7 @@ use common::{
|
|||||||
},
|
},
|
||||||
vol::RectVolSize,
|
vol::RectVolSize,
|
||||||
};
|
};
|
||||||
|
use common_net::msg::WorldMapMsg;
|
||||||
use noise::{
|
use noise::{
|
||||||
BasicMulti, Billow, Fbm, HybridMulti, MultiFractal, NoiseFn, RangeFunction, RidgedMulti,
|
BasicMulti, Billow, Fbm, HybridMulti, MultiFractal, NoiseFn, RangeFunction, RidgedMulti,
|
||||||
Seedable, SuperSimplex, Worley,
|
Seedable, SuperSimplex, Worley,
|
||||||
|
Loading…
Reference in New Issue
Block a user