1use codegridfx::Module;
2use num_traits::zero;
3use rusterix::Map;
4use theframework::prelude::*;
5
6#[derive(Serialize, Deserialize, Clone, Debug)]
8pub struct Item {
9 pub id: Uuid,
10 pub name: String,
11
12 pub map: Map,
14
15 #[serde(default)]
17 pub module: Module,
18
19 pub source: String,
21
22 #[serde(default)]
24 pub source_debug: String,
25
26 #[serde(default)]
28 pub data: String,
29
30 #[serde(default)]
32 pub authoring: String,
33
34 pub position: Vec3<f32>,
36
37 pub item_id: Uuid,
39}
40
41impl Default for Item {
42 fn default() -> Self {
43 Self::new()
44 }
45}
46
47impl Item {
48 pub fn new() -> Self {
49 Self {
50 id: Uuid::new_v4(),
51 name: "NewItem".to_string(),
52
53 module: Module::as_type(codegridfx::ModuleType::ItemTemplate),
54 map: Map::default(),
55 source: String::new(),
56 source_debug: String::new(),
57 data: String::new(),
58 authoring: String::new(),
59 position: zero(),
60
61 item_id: Uuid::new_v4(),
62 }
63 }
64}