diff options
author | metamuffin <metamuffin@disroot.org> | 2025-01-06 01:33:20 +0100 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-01-06 01:33:20 +0100 |
commit | c2ee65a83838a0ce13402e2c4634bae409d55071 (patch) | |
tree | efe1fa9f089f6e002631da2ef9f4cc44b459798c | |
parent | 9ddccdd589f20816c861c6ad6d3fcae36fff26d7 (diff) | |
download | weareserver-c2ee65a83838a0ce13402e2c4634bae409d55071.tar weareserver-c2ee65a83838a0ce13402e2c4634bae409d55071.tar.bz2 weareserver-c2ee65a83838a0ce13402e2c4634bae409d55071.tar.zst |
a
-rw-r--r-- | a.md | 2 | ||||
-rw-r--r-- | shared/src/packets.rs | 10 | ||||
-rw-r--r-- | world/src/main.rs | 9 |
3 files changed, 10 insertions, 11 deletions
@@ -26,7 +26,7 @@ Prefab = *(part) ### Part ``` -Part = *(len_key:u8 len_value:u8 *(key:u8) *(value:u8)) +Part = *(len_key:u16 len_value:u16 *(key:u8) *(value:u8)) ``` | Key | Value Type | diff --git a/shared/src/packets.rs b/shared/src/packets.rs index e339dd1..626da07 100644 --- a/shared/src/packets.rs +++ b/shared/src/packets.rs @@ -1,11 +1,11 @@ use anyhow::{Result, bail}; use glam::Vec3; use std::{ - fmt::Display, + fmt::{Debug, Display}, io::{Read, Write}, }; -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[derive(Clone, Copy, PartialEq, Eq, Hash)] pub struct Resource(pub [u8; 32]); #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] pub struct Object(pub u128); @@ -156,3 +156,9 @@ impl Display for Resource { ) } } + +impl Debug for Resource { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self) + } +} diff --git a/world/src/main.rs b/world/src/main.rs index fd354b3..4f641c3 100644 --- a/world/src/main.rs +++ b/world/src/main.rs @@ -26,7 +26,6 @@ fn main() -> Result<()> { let (gltf, buffers, _) = gltf::import(args.scene)?; - let mut parts = Vec::new(); for node in gltf.nodes() { if let Some(mesh) = node.mesh() { for p in mesh.primitives() { @@ -63,17 +62,11 @@ fn main() -> Result<()> { }; let mut out = Vec::new(); part.serialize(&mut out)?; - parts.push(store.set(&out)?); + Packet::Add(Object::new(), store.set(&out)?).serialize(&mut sock)?; } } } - let mut out = Vec::new(); - Prefab(parts).serialize(&mut out)?; - let prefab = store.set(&out)?; - - Packet::Add(Object::new(), prefab).serialize(&mut sock)?; - store.iter(|d| { Packet::RespondResource(d.to_vec()) .serialize(&mut sock) |