diff options
Diffstat (limited to 'server/src/lib.rs')
-rw-r--r-- | server/src/lib.rs | 69 |
1 files changed, 2 insertions, 67 deletions
diff --git a/server/src/lib.rs b/server/src/lib.rs index 69a9849e..5c7665c0 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -28,12 +28,13 @@ pub mod commands; pub mod data; pub mod entity; pub mod interaction; +pub mod message; pub mod network; pub mod scoreboard; pub mod server; pub mod state; -use hurrycurry_protocol::{glam::Vec2, Message}; +use hurrycurry_protocol::glam::Vec2; #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct ConnectionID(pub i64); @@ -52,69 +53,3 @@ impl InterpolateExt for f32 { *self = target + (*self - target) * (-dt).exp(); } } - -#[macro_export] -macro_rules! trm { - ($id:literal $(, $typ:ident = $param:expr)*) => { - hurrycurry_protocol::Message::Translation { - id: $id.to_owned(), - params: vec![$(crate::trm_param!($typ, $param)),*] - } - }; -} - -#[macro_export] -macro_rules! trm_param { - (s, $x:expr) => { - hurrycurry_protocol::Message::Text($x) - }; - (i, $x:expr) => { - hurrycurry_protocol::Message::Item($x) - }; - (t, $x:expr) => { - hurrycurry_protocol::Message::Tile($x) - }; - (m, $x:expr) => { - $x - }; -} - -#[derive(Debug)] -pub struct TrError { - pub id: &'static str, - pub params: Vec<Message>, -} -impl From<TrError> for Message { - fn from(value: TrError) -> Self { - Self::Translation { - id: value.id.to_owned(), - params: value.params, - } - } -} - -#[macro_export] -macro_rules! tre { - ($id:literal $(, $typ:ident = $param:expr)*) => { - crate::TrError { - id: $id, - params: vec![$(crate::tre_param!($typ, $param)),*] - } - }; -} - -#[macro_export] -macro_rules! tre_param { - (s, $x:expr) => { - hurrycurry_protocol::Message::Text($x) - }; - (i, $x:expr) => { - hurrycurry_protocol::Message::Item($x) - }; - (t, $x:expr) => { - hurrycurry_protocol::Message::Tile($x) - }; - (m, $x:expr) => { - $x - }; -} |