From cc96993499c435ea706fa21a6d8089604bc44e51 Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 17 Sep 2024 22:19:06 +0200 Subject: translate tutorial and add tile message --- server/src/lib.rs | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'server/src/lib.rs') diff --git a/server/src/lib.rs b/server/src/lib.rs index 89822133..3969c67c 100644 --- a/server/src/lib.rs +++ b/server/src/lib.rs @@ -16,13 +16,13 @@ */ #![feature(if_let_guard, map_many_mut, let_chains, iterator_try_collect, isqrt)] +pub mod commands; pub mod data; pub mod entity; -pub mod server; pub mod interaction; -pub mod state; pub mod scoreboard; -pub mod commands; +pub mod server; +pub mod state; use hurrycurry_protocol::glam::Vec2; @@ -43,3 +43,26 @@ 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) + }; +} -- cgit v1.2.3-70-g09d2