diff --git a/docs/src/change_log/dr_game.md b/docs/src/change_log/dr_game.md index 4a469a6..cf65888 100644 --- a/docs/src/change_log/dr_game.md +++ b/docs/src/change_log/dr_game.md @@ -3,7 +3,19 @@ - 最新版本号 - DR game: 0.3.2.0 - - DR rs: 0.2.20.1 + - DR rs: 0.2.20.2 + +## 20230724 DR rs 0.2.20.2 + +### Fix + +- [#49](https://github.com/shenjackyuanjie/Difficult-Rocket/issues/49) + - missing field `touchingGround` + - SR1 says: `touchingGround` field is NOT Required + - make them happy + - SR1 说: `touchingGround` 字段也是可选的 + - 让他们开心 + - 我就看看我能发多少个 issue ## 20230724 DR rs 0.2.20.1 diff --git a/mods/dr_game/Difficult_Rocket_rs/src/src/lib.rs b/mods/dr_game/Difficult_Rocket_rs/src/src/lib.rs index eb1f723..352bd0f 100644 --- a/mods/dr_game/Difficult_Rocket_rs/src/src/lib.rs +++ b/mods/dr_game/Difficult_Rocket_rs/src/src/lib.rs @@ -24,7 +24,7 @@ enum LoadState { } #[pyfunction] -fn get_version_str() -> String { "0.2.20.1".to_string() } +fn get_version_str() -> String { "0.2.20.2".to_string() } #[pyfunction] fn test_call(py_obj: &PyAny) -> PyResult { diff --git a/mods/dr_game/Difficult_Rocket_rs/src/src/sr1_data.rs b/mods/dr_game/Difficult_Rocket_rs/src/src/sr1_data.rs index d83e18e..5ffdcb2 100644 --- a/mods/dr_game/Difficult_Rocket_rs/src/src/sr1_data.rs +++ b/mods/dr_game/Difficult_Rocket_rs/src/src/sr1_data.rs @@ -377,7 +377,7 @@ pub mod ship { use super::part_list::SR1PartTypeEnum; - use crate::types::sr1::{i8_to_bool, SR1PartDataTrait, SR1PartTypeAttr, SR1ShipTrait}; + use crate::types::sr1::{i8_to_bool, option_i8_to_option_bool, SR1PartDataTrait, SR1PartTypeAttr, SR1ShipTrait}; use crate::types::sr1::{IdType, SR1PartData, SR1PartDataAttr, SR1Ship}; #[derive(Debug, Serialize, Deserialize, Clone)] @@ -393,7 +393,9 @@ pub mod ship { #[serde(rename = "liftedOff")] pub lift_off: i8, #[serde(rename = "touchingGround")] - pub touch_ground: i8, + pub touch_ground: Option, // Option for https://github.com/shenjackyuanjie/Difficult-Rocket/issues/49 + // SR1 says it's optional, let them happy + // NOT always 0 #[serde(rename = "DisconnectedParts")] pub disconnected: Option, } @@ -577,7 +579,7 @@ pub mod ship { parts, connections, lift_off: i8_to_bool(self.lift_off.to_owned()), - touch_ground: i8_to_bool(self.touch_ground.to_owned()), + touch_ground: option_i8_to_option_bool(self.touch_ground.to_owned()).unwrap_or(true), disconnected, } } diff --git a/mods/dr_game/Difficult_Rocket_rs/src/src/types.rs b/mods/dr_game/Difficult_Rocket_rs/src/src/types.rs index 1c8f3ac..77b33e2 100644 --- a/mods/dr_game/Difficult_Rocket_rs/src/src/types.rs +++ b/mods/dr_game/Difficult_Rocket_rs/src/src/types.rs @@ -979,7 +979,7 @@ pub mod sr1 { connects: connections, version: Some(self.version), lift_off: bool_to_i8(self.lift_off), - touch_ground: bool_to_i8(self.touch_ground), + touch_ground: Some(bool_to_i8(self.touch_ground)), disconnected, } } diff --git a/mods/dr_game/__init__.py b/mods/dr_game/__init__.py index 51223df..17a82e5 100644 --- a/mods/dr_game/__init__.py +++ b/mods/dr_game/__init__.py @@ -16,7 +16,7 @@ from Difficult_Rocket.api.mod import ModInfo from Difficult_Rocket.client import ClientWindow from Difficult_Rocket.api.types import Options, Version -DR_rust_version = Version("0.2.20.1") # DR_mod 的 Rust 编写部分的兼容版本 +DR_rust_version = Version("0.2.20.2") # DR_mod 的 Rust 编写部分的兼容版本 logger = logging.getLogger('client.dr_game')