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 pub position: Vec3<f32>,
32
33 pub item_id: Uuid,
35}
36
37impl Default for Item {
38 fn default() -> Self {
39 Self::new()
40 }
41}
42
43impl Item {
44 pub fn new() -> Self {
45 Self {
46 id: Uuid::new_v4(),
47 name: "NewItem".to_string(),
48
49 module: Module::as_type(codegridfx::ModuleType::ItemTemplate),
50 map: Map::default(),
51 source: String::new(),
52 source_debug: String::new(),
53 data: String::new(),
54 position: zero(),
55
56 item_id: Uuid::new_v4(),
57 }
58 }
59}