diff --git a/libs/Difficult_Rocket_rs/src/src/sr1_data.rs b/libs/Difficult_Rocket_rs/src/src/sr1_data.rs index 0b62b8e..0465ded 100644 --- a/libs/Difficult_Rocket_rs/src/src/sr1_data.rs +++ b/libs/Difficult_Rocket_rs/src/src/sr1_data.rs @@ -449,6 +449,7 @@ pub mod ship { pub exploded: Option, pub rope: Option, // ? + pub activated: Option, pub deployed: Option, } @@ -505,19 +506,6 @@ pub mod ship { #[serde(rename = "Connections")] pub connects: Connections, } - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// #[derive(Debug, Serialize, Deserialize, Clone)] pub struct Connection { @@ -553,9 +541,39 @@ pub mod ship { deployed: i8_to_bool(self.deployed.unwrap_or(0_i8)), rope: i8_to_bool(self.rope.unwrap_or(0_i8)), }, + SR1PartTypeEnum::pod => { + let pod = self.pod.as_ref().unwrap(); // 一定是有的,别问我为什么 + let mut steps = Vec::new(); + for step in &pod.stages.steps { + let mut activates = Vec::new(); + for active in &step.activates { + activates.push((active.id, i8_to_bool(active.moved))) + } + steps.push(activates) + } + SR1PartDataAttr::Pod { + name: pod.name.clone(), + throttle: pod.throttle, + current_stage: pod.stages.current_stage, + steps, + } + } _ => SR1PartDataAttr::None, }; - todo!() + SR1PartData { + attr, + x: self.x, + y: self.y, + id: self.id, + angle: self.angle, + angle_v: self.angle_v, + flip_x: i8_to_bool(self.flip_x.unwrap_or(0_i8)), + flip_y: i8_to_bool(self.flip_y.unwrap_or(0_i8)), + editor_angle: self.editor_angle, + part_type: self.part_type, + active: i8_to_bool(self.activated.unwrap_or(0_i8)), + explode: i8_to_bool(self.exploded.unwrap_or(0_i8)), + } } fn to_raw_part_data(&self) -> Part { self.clone() } diff --git a/libs/Difficult_Rocket_rs/src/src/types.rs b/libs/Difficult_Rocket_rs/src/src/types.rs index ececf89..df6c174 100644 --- a/libs/Difficult_Rocket_rs/src/src/types.rs +++ b/libs/Difficult_Rocket_rs/src/src/types.rs @@ -465,6 +465,7 @@ pub mod sr1 { exploded: Some(bool_to_i8(self.explode)), rope, chute_angle, + activated: Some(bool_to_i8(self.active)), deployed, } } @@ -482,10 +483,10 @@ pub mod sr1 { pub angle_v: f64, // 状态属性 pub part_type: SR1PartTypeEnum, - pub active: bool, pub editor_angle: i32, pub flip_x: bool, pub flip_y: bool, + pub active: bool, pub explode: bool, }