this repo has no description
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Adding code to generalize some factors for all systems and add traits for system structs to implement

+49 -1
+10
src/actor.rs
··· 1 + use uuid::Uuid; 2 + use crate::traits::Serialize; 3 + 4 + pub struct Actor { 5 + id: Uuid, 6 + in_combat: bool, 7 + name: String 8 + } 9 + 10 + pub trait ActorSystem: Serialize {}
+10
src/item.rs
··· 1 + use uuid::Uuid; 2 + use crate::traits::Serialize; 3 + 4 + pub struct Item { 5 + id: Uuid, 6 + quantity: i32, 7 + name: String 8 + } 9 + 10 + pub trait ItemSystem: Serialize {}
+26 -1
src/lib.rs
··· 1 + use crate::{hooks::Hooks, actor::Actor, item::Item}; 2 + use std::collections::HashMap; 3 + use uuid::Uuid; 4 + use wasm_bindgen::prelude::*; 5 + 1 6 pub mod hooks; 2 7 pub mod traits; 8 + pub mod actor; 9 + pub mod item; 3 10 4 11 #[cfg(feature = "pf2e")] 5 12 pub mod pf2e; ··· 11 18 pub mod dnd5e; 12 19 13 20 #[cfg(feature = "sf2e")] 14 - pub mod sf2e; 21 + pub mod sf2e; 22 + 23 + #[wasm_bindgen] 24 + pub struct Game { 25 + hooks: Hooks, 26 + actors: HashMap<Uuid, Actor>, 27 + items: HashMap<Uuid, Item> 28 + } 29 + 30 + #[wasm_bindgen] 31 + impl Game { 32 + fn new() -> Self { 33 + Self { 34 + hooks: Hooks::new(), 35 + actors: HashMap::new(), 36 + items: HashMap::new() 37 + } 38 + } 39 + }
+3
src/traits.rs
··· 1 + pub trait Serialize { 2 + fn serialize(&self) -> Vec<u8>; 3 + }