mirror of
https://git.ngram.ca/OpenJam/rc-servers
synced 2026-08-23 23:08:52 +00:00
Move common components to shared lib
This commit is contained in:
1 parent
610f54e236
commit
0e048a17b1
76 files changed
+284
-1110
No files matched your search
@@ -0,0 +1,25 @@
|
||||
use serde::{Serialize, Deserialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug, Default)]
|
||||
#[serde(default)]
|
||||
pub struct TechTreeData {
|
||||
pub position_x: i32,
|
||||
pub position_y: i32,
|
||||
pub tech_points: u32,
|
||||
pub neighbours: Vec<u32>, // cube IDs
|
||||
pub requires: Vec<u32>,
|
||||
}
|
||||
|
||||
impl TechTreeData {
|
||||
pub fn into_data(self, self_id: u32, self_is_unlocked: bool, self_is_unlockable: bool) -> crate::data::tech_tree::TechTreeNode {
|
||||
crate::data::tech_tree::TechTreeNode {
|
||||
main_cube_id: self_id as i32,
|
||||
position_x: self.position_x,
|
||||
position_y: self.position_y,
|
||||
is_unlocked: self_is_unlocked,
|
||||
is_unlockable: self_is_unlockable,
|
||||
tech_points: self.tech_points,
|
||||
neighbours: self.neighbours.into_iter().map(|x| x as i32).collect(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user