1
0
mirror of https://git.ngram.ca/OpenJam/rc-servers synced 2026-08-23 23:08:52 +00:00

Make some data more real, not that it matters

This commit is contained in:
NGnius (Graham)
2025-02-25 22:26:53 -05:00
parent 1df3e31bb6
commit fe30e783ad
6 changed files with 126 additions and 6 deletions

View File

@@ -13,7 +13,7 @@ pub struct TechTreeNode {
impl TechTreeNode {
pub fn as_transmissible(&self) -> Typed {
Typed::HashMap(vec![
(Typed::Str("mainCubeId".into()), Typed::Str(hex::encode(self.main_cube_id.to_le_bytes()).into())),
(Typed::Str("mainCubeId".into()), Typed::Str(hex::encode(self.main_cube_id.to_be_bytes()).into())),
(Typed::Str("positionX".into()), Typed::Int(self.position_x)),
(Typed::Str("positionY".into()), Typed::Int(self.position_y)),
(Typed::Str("isUnlocked".into()), Typed::Bool(self.is_unlocked.into())),
@@ -21,8 +21,12 @@ impl TechTreeNode {
(Typed::Str("tp".into()), Typed::Int(self.tech_points as i32)),
(Typed::Str("neighbours".into()), Typed::Arr(Arr {
ty: 115, // str
items: self.neighbours.iter().map(|cube_id| Typed::Str(hex::encode(cube_id.to_le_bytes()).into())).collect(),
items: self.neighbours.iter().map(|cube_id| Typed::Str(hex::encode(cube_id.to_be_bytes()).into())).collect(),
})),
].into())
}
pub fn as_transmissible_key_val(&self) -> (Typed, Typed) {
(Typed::Str(hex::encode(self.main_cube_id.to_be_bytes()).into()), self.as_transmissible())
}
}

View File

@@ -12,15 +12,15 @@ pub(super) fn tech_tree_layout_provider() -> SimpleFunc<183, crate::UserTy, impl
key_ty: 115, // str
val_ty: 104, // hashmap
items: vec![
(Typed::Str("1".into()), TechTreeNode {
main_cube_id: 1,
TechTreeNode {
main_cube_id: 227205318, // default cube id
position_x: 0,
position_y: 0,
is_unlocked: true,
is_unlockable: true,
tech_points: 1,
neighbours: Vec::default(),
}.as_transmissible())
}.as_transmissible_key_val(),
],
}));
Ok(params.into())