DR_rs 0.2.5.5
This commit is contained in:
parent
b889671f76
commit
3fbae9ce0b
@ -24,7 +24,7 @@ from libs.MCDR.version import Version
|
|||||||
|
|
||||||
game_version = Version("0.7.1.4") # 游戏版本
|
game_version = Version("0.7.1.4") # 游戏版本
|
||||||
build_version = Version("1.1.0.0") # 编译文件版本(与游戏本体无关)
|
build_version = Version("1.1.0.0") # 编译文件版本(与游戏本体无关)
|
||||||
DR_rust_version = Version("0.2.5.4") # DR 的 Rust 编写部分的版本
|
DR_rust_version = Version("0.2.5.5") # DR 的 Rust 编写部分的版本
|
||||||
Api_version = Version("0.0.0.1") # API 版本
|
Api_version = Version("0.0.0.1") # API 版本
|
||||||
__version__ = game_version
|
__version__ = game_version
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ use pyo3::prelude::*;
|
|||||||
|
|
||||||
#[pyfunction]
|
#[pyfunction]
|
||||||
fn get_version_str() -> String {
|
fn get_version_str() -> String {
|
||||||
return "0.2.5.4".to_string();
|
return "0.2.5.5".to_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pyfunction]
|
#[pyfunction]
|
||||||
|
@ -14,7 +14,7 @@ pub mod part_list {
|
|||||||
// use quick_xml::de::from_str;
|
// use quick_xml::de::from_str;
|
||||||
use serde_xml_rs::{from_str};
|
use serde_xml_rs::{from_str};
|
||||||
|
|
||||||
use crate::types::sr1::{SR1PartTypeData, SR1PartType, SR1PartAttr};
|
use crate::types::sr1::{SR1PartTypeData, SR1PartType, SR1PartAttr, SR1PartList};
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct RawPartList {
|
pub struct RawPartList {
|
||||||
@ -99,8 +99,8 @@ pub mod part_list {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl AttachPoints {
|
impl AttachPoints {
|
||||||
pub fn new(attachs: Vec<AttachPoint>) -> Self {
|
pub fn new(attaches: Vec<AttachPoint>) -> Self {
|
||||||
AttachPoints { points: attachs }
|
AttachPoints { points: attaches }
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn insert(&mut self, attach: AttachPoint) {
|
pub fn insert(&mut self, attach: AttachPoint) {
|
||||||
@ -267,7 +267,7 @@ pub mod part_list {
|
|||||||
};
|
};
|
||||||
let damage = self.damage.unwrap_or(Damage {disconnect: 0, explode: 0,
|
let damage = self.damage.unwrap_or(Damage {disconnect: 0, explode: 0,
|
||||||
explosion_power: Some(0u32), explosion_size: Some(0u32) });
|
explosion_power: Some(0u32), explosion_size: Some(0u32) });
|
||||||
let attach_points = if let Some(attach_points) = &self.attach_points {
|
let attach_points: Option<Vec<AttachPoint>> = if let Some(attach_points) = &self.attach_points {
|
||||||
Some(attach_points.unzip()) } else { None };
|
Some(attach_points.unzip()) } else { None };
|
||||||
SR1PartType {
|
SR1PartType {
|
||||||
id: self.id.clone(),
|
id: self.id.clone(),
|
||||||
@ -305,6 +305,14 @@ pub mod part_list {
|
|||||||
println!("{:?}\n", part_data);
|
println!("{:?}\n", part_data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn to_sr_part_list(&self, name: Option<String>) -> SR1PartList {
|
||||||
|
let mut part_list = Vec::new();
|
||||||
|
for part_data in self.part_types.iter() {
|
||||||
|
part_list.push(part_data.to_sr_part_type());
|
||||||
|
}
|
||||||
|
SR1PartList { types: part_list, name: name.unwrap_or("".to_string()) }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -330,7 +338,8 @@ pub mod part_list {
|
|||||||
let _parts = read_part_list(file_name);
|
let _parts = read_part_list(file_name);
|
||||||
if let Some(parts) = _parts {
|
if let Some(parts) = _parts {
|
||||||
// println!("{:?}", parts)
|
// println!("{:?}", parts)
|
||||||
parts.list_print()
|
parts.list_print();
|
||||||
|
let part_list = parts.to_sr_part_list(Some("Vanilla".to_string()));
|
||||||
}
|
}
|
||||||
// read_part_list(file_name);
|
// read_part_list(file_name);
|
||||||
Ok(())
|
Ok(())
|
||||||
|
Loading…
Reference in New Issue
Block a user