继续更新
ChatGPT依然在胡言乱语
This commit is contained in:
parent
f6c958a85b
commit
577eb629e3
24
DR-start.py
24
DR-start.py
@ -20,7 +20,31 @@ errors = {
|
|||||||
'error.happen': '游戏出现了一个报错!正在处理'
|
'error.happen': '游戏出现了一个报错!正在处理'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def print_path() -> None:
|
||||||
|
print(f'{__file__=}')
|
||||||
|
print(f'{sys.path=}')
|
||||||
|
print(f'{sys.path[0]=}')
|
||||||
|
print(f'{sys.argv[0]=}')
|
||||||
|
print(f'{os.getcwd()=}')
|
||||||
|
print(f'{os.path.abspath(__file__)=}')
|
||||||
|
print(f'{os.path.realpath(__file__)=}')
|
||||||
|
print(f'{os.path.split(os.path.split(os.path.realpath(__file__))[0])=}')
|
||||||
|
# 输出一遍大部分文件位置相关信息 以后可能会加到logs里
|
||||||
|
|
||||||
|
|
||||||
|
def modify_path() -> None:
|
||||||
|
file_path = os.path.split(os.path.realpath(__file__))[0]
|
||||||
|
os.chdir(file_path) # 将运行路径切换到文件位置 防止bug
|
||||||
|
sys.path.append(f'{file_path}/Difficult_Rocket') # 添加local path
|
||||||
|
sys.path.append(f'{file_path}/libs') # 添加 libs path
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
print(hi) # hi!
|
||||||
# 记录启动信息
|
# 记录启动信息
|
||||||
start_time_ns = time.time_ns()
|
start_time_ns = time.time_ns()
|
||||||
start_time_perf_ns = time.perf_counter_ns()
|
start_time_perf_ns = time.perf_counter_ns()
|
||||||
|
print_path()
|
||||||
|
modify_path()
|
||||||
|
|
||||||
|
|
||||||
|
14
DR.py
14
DR.py
@ -23,10 +23,9 @@ error_format = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def print_path() -> None:
|
||||||
start_time_ns = time.time_ns()
|
|
||||||
start_time_perf_ns = time.perf_counter_ns()
|
|
||||||
print(f'{__file__=}')
|
print(f'{__file__=}')
|
||||||
|
print(f'{sys.path=}')
|
||||||
print(f'{sys.path[0]=}')
|
print(f'{sys.path[0]=}')
|
||||||
print(f'{sys.argv[0]=}')
|
print(f'{sys.argv[0]=}')
|
||||||
print(f'{os.getcwd()=}')
|
print(f'{os.getcwd()=}')
|
||||||
@ -34,12 +33,17 @@ def main() -> None:
|
|||||||
print(f'{os.path.realpath(__file__)=}')
|
print(f'{os.path.realpath(__file__)=}')
|
||||||
print(f'{os.path.split(os.path.split(os.path.realpath(__file__))[0])=}')
|
print(f'{os.path.split(os.path.split(os.path.realpath(__file__))[0])=}')
|
||||||
# 输出一遍大部分文件位置相关信息 以后可能会加到logs里
|
# 输出一遍大部分文件位置相关信息 以后可能会加到logs里
|
||||||
|
|
||||||
|
|
||||||
|
def main() -> None:
|
||||||
|
print(hi) # hi!
|
||||||
|
start_time_ns = time.time_ns()
|
||||||
|
start_time_perf_ns = time.perf_counter_ns()
|
||||||
|
print_path()
|
||||||
file_path = os.path.split(os.path.realpath(__file__))[0]
|
file_path = os.path.split(os.path.realpath(__file__))[0]
|
||||||
os.chdir(file_path) # 将运行路径切换到文件位置 防止bug
|
os.chdir(file_path) # 将运行路径切换到文件位置 防止bug
|
||||||
sys.path.append(f'{file_path}/Difficult_Rocket') # 添加local path
|
sys.path.append(f'{file_path}/Difficult_Rocket') # 添加local path
|
||||||
sys.path.append(f'{file_path}/libs') # 添加 libs path
|
sys.path.append(f'{file_path}/libs') # 添加 libs path
|
||||||
print(sys.path) # 输出路径
|
|
||||||
print(hi) # hi!
|
|
||||||
|
|
||||||
from Difficult_Rocket.exception import TestError
|
from Difficult_Rocket.exception import TestError
|
||||||
from Difficult_Rocket import crash
|
from Difficult_Rocket import crash
|
||||||
|
@ -70,12 +70,13 @@
|
|||||||
- `xmltodict`: xml 与 dict 转换器
|
- `xmltodict`: xml 与 dict 转换器
|
||||||
- `pyperclip`: 剪贴板!
|
- `pyperclip`: 剪贴板!
|
||||||
- `rapier2d`: 物理模拟引擎
|
- `rapier2d`: 物理模拟引擎
|
||||||
|
- `pyo3`: Rust Python 扩展
|
||||||
|
|
||||||
- 主要贡献者
|
- 主要贡献者
|
||||||
- [@Rayawa](https://github.com/Rayawa) : 文档矫正 & 翻译部分 lang
|
- [@Rayawa](https://github.com/Rayawa) : 文档矫正 & 翻译部分 lang
|
||||||
- [@rouxiao-you](https://github.com/ruoxiao-you) : 翻译 lang
|
- [@rouxiao-you](https://github.com/ruoxiao-you) : 翻译 lang
|
||||||
- [@Billchyi](https://github.com/Billchyi) : 文档矫正
|
- [@Billchyi](https://github.com/Billchyi) : 文档矫正
|
||||||
- [@MSDNicrosoft]()
|
- [@MSDNicrosoft](https://github.com/MSDNicrosoft) : 优化代码
|
||||||
|
|
||||||
## 相关链接
|
## 相关链接
|
||||||
|
|
||||||
|
@ -21,6 +21,6 @@ if ($do -or "311" -in $args) {
|
|||||||
python3.11 setup.py build
|
python3.11 setup.py build
|
||||||
}
|
}
|
||||||
|
|
||||||
python3.10 post_build.py
|
python3 post_build.py
|
||||||
|
|
||||||
Set-Location ..\..\..\
|
Set-Location ..\..\..\
|
||||||
|
@ -70,11 +70,13 @@
|
|||||||
- `xmltodict`: translate data between xml and dict
|
- `xmltodict`: translate data between xml and dict
|
||||||
- `pyperclip`: paste board!
|
- `pyperclip`: paste board!
|
||||||
- `rapier2d`: Phy simulate engine
|
- `rapier2d`: Phy simulate engine
|
||||||
|
- `pyo3`: Rust Python Binding
|
||||||
|
|
||||||
- Main contributors
|
- Main contributors
|
||||||
- [@Rayawa](https://github.com/Rayawa) : check mistake in docs & some translates
|
- [@Rayawa](https://github.com/Rayawa) : Check mistake in docs & some translates
|
||||||
- [@rouxiao-you](https://github.com/ruoxiao-you) : translate chinese to English
|
- [@rouxiao-you](https://github.com/ruoxiao-you) : Translate chinese to English
|
||||||
- [@Billchyi](https://github.com/Billchyi) : check mistake in docs
|
- [@Billchyi](https://github.com/Billchyi) : Check mistake in docs
|
||||||
|
- [@MSDNicrosoft](https://github.com/MSDNicrosoft) : Optimize code
|
||||||
|
|
||||||
## Other links
|
## Other links
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@ open-on-text = "Found a bug? [Edit this page on GitHub.]"
|
|||||||
# Should we check links on the internet? Enabling this option adds a
|
# Should we check links on the internet? Enabling this option adds a
|
||||||
# non-negligible performance impact
|
# non-negligible performance impact
|
||||||
follow-web-links = false
|
follow-web-links = false
|
||||||
|
warning-policy = "ignore"
|
||||||
|
exclude = [ "requirement-dev.txt" ]
|
||||||
|
|
||||||
# Are we allowed to link to files outside of the book's root directory? This
|
# Are we allowed to link to files outside of the book's root directory? This
|
||||||
# may help prevent linking to sensitive files (e.g. "../../../../etc/shadow")
|
# may help prevent linking to sensitive files (e.g. "../../../../etc/shadow")
|
||||||
|
@ -5,4 +5,16 @@
|
|||||||
1. Powershell 7+
|
1. Powershell 7+
|
||||||
2. Python3.8 +
|
2. Python3.8 +
|
||||||
3. gcc / clang 编译器
|
3. gcc / clang 编译器
|
||||||
4. git
|
4. rust 工具链
|
||||||
|
5. git
|
||||||
|
|
||||||
|
## 安装依赖
|
||||||
|
|
||||||
|
1. 确保 Path 下有以下内容
|
||||||
|
- `python`
|
||||||
|
- `python3.8`
|
||||||
|
- 可供 `setuptools-rust` 调用的 rust 工具链
|
||||||
|
2. 为 Python 安装 [requrements-dev.txt](../requirement-dev.txt) 的依赖
|
||||||
|
- `python -m pip install -r requre`
|
||||||
|
3. 使用 `build_rs.ps1` 尝试编译一次 `DR_rs`
|
||||||
|
- `./build_rs.ps1` 38/39/310/311
|
||||||
|
@ -20,6 +20,24 @@
|
|||||||
- [![Readme-gitee](https://img.shields.io/badge/Readme-中文(点我!)-blue.svg?style=flat-square)](../../README.md)
|
- [![Readme-gitee](https://img.shields.io/badge/Readme-中文(点我!)-blue.svg?style=flat-square)](../../README.md)
|
||||||
- Using [SemVer 2.0.0](https://semver.org/) to manage version
|
- Using [SemVer 2.0.0](https://semver.org/) to manage version
|
||||||
|
|
||||||
|
## 202303 V 0.7.1.2
|
||||||
|
|
||||||
|
### `DR_rs` V 0.2.5.2
|
||||||
|
|
||||||
|
- `0.2.5.0` -> `0.2.5.2`
|
||||||
|
|
||||||
|
- `sr1_data.rs`
|
||||||
|
- 现在可以完整解析 SR1 的 `PartList.xml` 了
|
||||||
|
- 解析后会生成一个 `PartList` 对象
|
||||||
|
- Now can parse `PartList.xml` completely
|
||||||
|
- Will generate a `PartList` object after parsing
|
||||||
|
|
||||||
|
|
||||||
|
### 重命名
|
||||||
|
|
||||||
|
- `.github/workflows/after_compile.py` -> `.github/workflows/post_compile.py`
|
||||||
|
- `libs/Difficult_Rocket_rs/src/after_build.py` -> `libs/Difficult_Rocket_rs/src/post_build.py`
|
||||||
|
|
||||||
## 20230219 V 0.7.1.1
|
## 20230219 V 0.7.1.1
|
||||||
|
|
||||||
### 删除了多余的 print
|
### 删除了多余的 print
|
||||||
|
@ -19,7 +19,7 @@ pub mod part_list {
|
|||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct PartList {
|
pub struct PartList {
|
||||||
#[serde(rename = "PartType")]
|
#[serde(rename = "PartType")]
|
||||||
part_types: Vec<PartType>
|
part_types: Vec<PartType>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(non_camel_case_types)]
|
#[allow(non_camel_case_types)]
|
||||||
@ -38,13 +38,7 @@ pub mod part_list {
|
|||||||
solar,
|
solar,
|
||||||
dockconnector,
|
dockconnector,
|
||||||
dockport,
|
dockport,
|
||||||
lander
|
lander,
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
|
||||||
pub enum Category {
|
|
||||||
Satellite,
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
||||||
@ -62,14 +56,12 @@ pub mod part_list {
|
|||||||
TopSide,
|
TopSide,
|
||||||
BottomSide,
|
BottomSide,
|
||||||
LeftSide,
|
LeftSide,
|
||||||
RightSide
|
RightSide,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
||||||
pub struct Vertex {
|
pub struct Vertex {
|
||||||
#[serde(rename = "@x")]
|
|
||||||
pub x: Option<f64>,
|
pub x: Option<f64>,
|
||||||
#[serde(rename = "@y")]
|
|
||||||
pub y: Option<f64>,
|
pub y: Option<f64>,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,54 +70,93 @@ pub mod part_list {
|
|||||||
#[serde(rename = "Vertex")]
|
#[serde(rename = "Vertex")]
|
||||||
pub vertex: Vec<Vertex>,
|
pub vertex: Vec<Vertex>,
|
||||||
#[serde(rename = "sensor")]
|
#[serde(rename = "sensor")]
|
||||||
pub sensor: Option<bool>
|
pub sensor: Option<bool>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
||||||
pub struct AttachPoint {
|
pub struct AttachPoint {
|
||||||
pub location: Option<Location>,
|
pub location: Option<Location>,
|
||||||
#[serde(rename = "@x")]
|
|
||||||
pub x: Option<f64>,
|
pub x: Option<f64>,
|
||||||
#[serde(rename = "@y")]
|
|
||||||
pub y: Option<f64>,
|
pub y: Option<f64>,
|
||||||
#[serde(rename = "@breakAngle")]
|
#[serde(rename = "flipX")]
|
||||||
|
pub flip_x: Option<bool>,
|
||||||
|
#[serde(rename = "flipY")]
|
||||||
|
pub flip_y: Option<bool>,
|
||||||
|
#[serde(rename = "breakAngle")]
|
||||||
pub break_angle: Option<i32>,
|
pub break_angle: Option<i32>,
|
||||||
#[serde(rename = "@breakForce")]
|
#[serde(rename = "breakForce")]
|
||||||
pub break_force: Option<f64>,
|
pub break_force: Option<f64>,
|
||||||
#[serde(rename = "@fuelLine")]
|
#[serde(rename = "fuelLine")]
|
||||||
pub fuel_line: Option<bool>,
|
pub fuel_line: Option<bool>,
|
||||||
#[serde(rename = "@group")]
|
|
||||||
pub group: Option<i32>,
|
pub group: Option<i32>,
|
||||||
#[serde(rename = "@order")]
|
|
||||||
pub order: Option<i32>,
|
pub order: Option<i32>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct AttachPoints {
|
pub struct AttachPoints {
|
||||||
#[serde(rename = "AttachPoint")]
|
#[serde(rename = "AttachPoint")]
|
||||||
pub points: Vec<AttachPoint>
|
pub points: Vec<AttachPoint>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
||||||
pub enum PartAttr {
|
pub struct Damage {
|
||||||
Damage,
|
disconnect: u32,
|
||||||
Tank,
|
explode: u32,
|
||||||
Engine,
|
#[serde(rename = "explosionPower")]
|
||||||
Rcs,
|
explosion_power: u32,
|
||||||
Solar,
|
#[serde(rename = "explosionSize")]
|
||||||
Lander
|
explosion_size: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
// #[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
||||||
// pub struct PartAttr {
|
pub struct Tank {
|
||||||
// // 单独类型节点
|
fuel: f64,
|
||||||
// // pub part_attr: Option<Vec<PartAttr>>,
|
#[serde(rename = "dryMass")]
|
||||||
// }
|
dry_mass: f64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
||||||
|
pub struct Engine {
|
||||||
|
power: f64,
|
||||||
|
consumption: f64,
|
||||||
|
size: f64,
|
||||||
|
turn: f64,
|
||||||
|
#[serde(rename = "fuelType")]
|
||||||
|
fuel_type: Option<i32>,
|
||||||
|
#[serde(rename = "throttleExponential")]
|
||||||
|
throttle_exponential: Option<bool>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
||||||
|
pub struct Rcs {
|
||||||
|
power: f64,
|
||||||
|
consumption: f64,
|
||||||
|
size: f64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
||||||
|
pub struct Solar {
|
||||||
|
#[serde(rename = "chargeRate")]
|
||||||
|
charge_rate: f64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize, Copy, Clone)]
|
||||||
|
pub struct Lander {
|
||||||
|
#[serde(rename = "maxAngle")]
|
||||||
|
max_angle: i32,
|
||||||
|
#[serde(rename = "minLength")]
|
||||||
|
min_length: f64,
|
||||||
|
#[serde(rename = "maxLength")]
|
||||||
|
max_length: f64,
|
||||||
|
#[serde(rename = "angleSpeed")]
|
||||||
|
angle_speed: Option<i32>,
|
||||||
|
#[serde(rename = "lengthSpeed")]
|
||||||
|
length_speed: Option<f64>,
|
||||||
|
width: f64,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||||
pub struct PartType {
|
pub struct PartType {
|
||||||
// https://docs.rs/quick-xml/latest/quick_xml/de/index.html
|
|
||||||
// 基本属性
|
// 基本属性
|
||||||
pub id: String,
|
pub id: String,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
@ -137,16 +168,16 @@ pub mod part_list {
|
|||||||
pub height: u32,
|
pub height: u32,
|
||||||
// 可选属性
|
// 可选属性
|
||||||
pub friction: Option<f64>,
|
pub friction: Option<f64>,
|
||||||
pub category: Option<Category>,
|
pub category: Option<String>,
|
||||||
#[serde(rename = "@ignoreEditorIntersections")]
|
#[serde(rename = "ignoreEditorIntersections")]
|
||||||
pub ignore_editor_intersections: Option<bool>,
|
pub ignore_editor_intersections: Option<bool>,
|
||||||
#[serde(rename = "@disableEditorRotation")]
|
#[serde(rename = "disableEditorRotation")]
|
||||||
pub disable_editor_rotation: Option<bool>,
|
pub disable_editor_rotation: Option<bool>,
|
||||||
#[serde(rename = "@canExplode")]
|
#[serde(rename = "canExplode")]
|
||||||
pub can_explode: Option<bool>,
|
pub can_explode: Option<bool>,
|
||||||
#[serde(rename = "@coverHeight")]
|
#[serde(rename = "coverHeight")]
|
||||||
pub cover_height: Option<u32>,
|
pub cover_height: Option<u32>,
|
||||||
#[serde(rename = "@sandboxOnly")]
|
#[serde(rename = "sandboxOnly")]
|
||||||
pub sandbox_only: Option<bool>,
|
pub sandbox_only: Option<bool>,
|
||||||
pub drag: Option<f64>,
|
pub drag: Option<f64>,
|
||||||
pub hidden: Option<bool>,
|
pub hidden: Option<bool>,
|
||||||
@ -156,9 +187,27 @@ pub mod part_list {
|
|||||||
pub shape: Option<Vec<Shape>>,
|
pub shape: Option<Vec<Shape>>,
|
||||||
#[serde(rename = "AttachPoints")]
|
#[serde(rename = "AttachPoints")]
|
||||||
pub attach_points: Option<AttachPoints>,
|
pub attach_points: Option<AttachPoints>,
|
||||||
|
#[serde(rename = "Damage")]
|
||||||
|
pub damage: Option<Damage>,
|
||||||
// 特殊属性子节点
|
// 特殊属性子节点
|
||||||
|
#[serde(rename = "Tank")]
|
||||||
|
pub tank: Option<Tank>,
|
||||||
|
#[serde(rename = "Engine")]
|
||||||
|
pub engine: Option<Engine>,
|
||||||
|
#[serde(rename = "Tank")]
|
||||||
|
pub rcs: Option<Rcs>,
|
||||||
|
#[serde(rename = "Solar")]
|
||||||
|
pub solar: Option<Solar>,
|
||||||
|
#[serde(rename = "Lander")]
|
||||||
|
pub lander: Option<Lander>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PartList {
|
||||||
|
pub fn list_print(&self) -> () {
|
||||||
|
for part_data in self.part_types.iter() {
|
||||||
|
println!("{:?}\n", part_data);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -169,7 +218,7 @@ pub mod part_list {
|
|||||||
Ok(part_list_file) => {
|
Ok(part_list_file) => {
|
||||||
let part_list: PartList = from_str(part_list_file.as_str()).unwrap();
|
let part_list: PartList = from_str(part_list_file.as_str()).unwrap();
|
||||||
Some(part_list)
|
Some(part_list)
|
||||||
},
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
println!("Error while reading File {}", file_name);
|
println!("Error while reading File {}", file_name);
|
||||||
None
|
None
|
||||||
@ -183,10 +232,10 @@ pub mod part_list {
|
|||||||
let file_name = file_name.unwrap_or("./configs/PartList.xml".to_string());
|
let file_name = file_name.unwrap_or("./configs/PartList.xml".to_string());
|
||||||
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()
|
||||||
}
|
}
|
||||||
// read_part_list(file_name);
|
// read_part_list(file_name);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -8,7 +8,9 @@
|
|||||||
|
|
||||||
|
|
||||||
pub mod sr1 {
|
pub mod sr1 {
|
||||||
|
use super::math::{Shape, Point2D};
|
||||||
|
|
||||||
|
#[inline]
|
||||||
pub fn map_ptype_textures(ptype: String) -> String {
|
pub fn map_ptype_textures(ptype: String) -> String {
|
||||||
match ptype.as_str() {
|
match ptype.as_str() {
|
||||||
"pod-1" => "Pod",
|
"pod-1" => "Pod",
|
||||||
@ -42,6 +44,7 @@ pub mod sr1 {
|
|||||||
}.to_string()
|
}.to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct SR1PartData {
|
pub struct SR1PartData {
|
||||||
pub x: f64,
|
pub x: f64,
|
||||||
pub y: f64,
|
pub y: f64,
|
||||||
@ -57,6 +60,62 @@ pub mod sr1 {
|
|||||||
pub textures: String,
|
pub textures: String,
|
||||||
pub connections: Option<Vec<((usize, usize), (isize, isize))>>
|
pub connections: Option<Vec<((usize, usize), (isize, isize))>>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(non_camel_case_types)]
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
pub enum PartTypes {
|
||||||
|
pod,
|
||||||
|
detacher,
|
||||||
|
wheel,
|
||||||
|
fuselage,
|
||||||
|
strut,
|
||||||
|
tank,
|
||||||
|
engine,
|
||||||
|
parachute,
|
||||||
|
nosecone,
|
||||||
|
rcs,
|
||||||
|
solar,
|
||||||
|
dockconnector,
|
||||||
|
dockport,
|
||||||
|
lander,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Copy, Clone)]
|
||||||
|
pub struct Damage {
|
||||||
|
disconnect: i32,
|
||||||
|
// 断裂受力大小
|
||||||
|
explode: i32,
|
||||||
|
// 爆炸受力大小
|
||||||
|
explosion_power: i32,
|
||||||
|
// 爆炸力量
|
||||||
|
explosion_size: i32,
|
||||||
|
// 爆炸大小
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
|
pub struct SR1PartType {
|
||||||
|
pub id: String,
|
||||||
|
pub name: String,
|
||||||
|
pub description: String,
|
||||||
|
pub sprite: String,
|
||||||
|
pub r#type: PartTypes,
|
||||||
|
pub mass: f64,
|
||||||
|
pub width: u32,
|
||||||
|
pub height: u32,
|
||||||
|
pub friction: f64,
|
||||||
|
pub category: String,
|
||||||
|
pub ignore_editor_intersections: bool,
|
||||||
|
pub disable_editor_rotation: bool,
|
||||||
|
pub can_explode: bool,
|
||||||
|
pub cover_height: u32,
|
||||||
|
pub sandbox_only: bool,
|
||||||
|
pub drag: f64,
|
||||||
|
pub hidden: bool,
|
||||||
|
pub buoyancy: f64,
|
||||||
|
pub damage: Damage,
|
||||||
|
pub shape: Shape,
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[allow(unused)]
|
#[allow(unused)]
|
||||||
@ -113,8 +172,8 @@ pub mod math {
|
|||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub struct OneTimeLine {
|
pub struct OneTimeLine {
|
||||||
pub k: f64,
|
// pub k: f64,
|
||||||
pub b: f64,
|
// pub b: f64,
|
||||||
// y = kx + b
|
// y = kx + b
|
||||||
// kx + b - y = 0
|
// kx + b - y = 0
|
||||||
pub start: Point2D,
|
pub start: Point2D,
|
||||||
@ -125,8 +184,8 @@ pub mod math {
|
|||||||
|
|
||||||
#[derive(Clone, Copy)]
|
#[derive(Clone, Copy)]
|
||||||
pub enum Edge {
|
pub enum Edge {
|
||||||
OneTimeLine{data: OneTimeLine},
|
OneTimeLine(OneTimeLine),
|
||||||
CircularArc{data: CircularArc},
|
CircularArc(CircularArc),
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
@ -149,10 +208,10 @@ pub mod math {
|
|||||||
let d_width = width / 2.0;
|
let d_width = width / 2.0;
|
||||||
let d_height = height / 2.0;
|
let d_height = height / 2.0;
|
||||||
let mut edges: Vec<Edge> = vec![
|
let mut edges: Vec<Edge> = vec![
|
||||||
Edge::OneTimeLine{data: OneTimeLine::pos_new(-d_width, -d_height, d_width, -d_height)},
|
Edge::OneTimeLine{0: OneTimeLine::pos_new(-d_width, -d_height, d_width, -d_height)},
|
||||||
Edge::OneTimeLine{data: OneTimeLine::pos_new(d_width, -d_height, d_width, d_height)},
|
Edge::OneTimeLine{0: OneTimeLine::pos_new(d_width, -d_height, d_width, d_height)},
|
||||||
Edge::OneTimeLine{data: OneTimeLine::pos_new(d_width, d_height, -d_width, d_height)},
|
Edge::OneTimeLine{0: OneTimeLine::pos_new(d_width, d_height, -d_width, d_height)},
|
||||||
Edge::OneTimeLine{data: OneTimeLine::pos_new(-d_width, d_height, -d_width, -d_height)}
|
Edge::OneTimeLine{0: OneTimeLine::pos_new(-d_width, d_height, -d_width, -d_height)}
|
||||||
];
|
];
|
||||||
if let Some(angle) = angle {
|
if let Some(angle) = angle {
|
||||||
|
|
||||||
@ -165,11 +224,11 @@ pub mod math {
|
|||||||
impl OneTimeLine {
|
impl OneTimeLine {
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn pos_new(x1: f64, y1: f64, x2: f64, y2: f64) -> Self {
|
pub fn pos_new(x1: f64, y1: f64, x2: f64, y2: f64) -> Self {
|
||||||
let k = (x2 - x1) / (y2 - y1);
|
// let k = (x2 - x1) / (y2 - y1);
|
||||||
let b = y1 - (x1 * k);
|
// let b = y1 - (x1 * k);
|
||||||
let start = Point2D::new(x1, y1);
|
let start = Point2D::new(x1, y1);
|
||||||
let end = Point2D::new(x2, y2);
|
let end = Point2D::new(x2, y2);
|
||||||
OneTimeLine { k, b, start, end }
|
OneTimeLine { start, end }
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
@ -199,8 +258,6 @@ pub mod math {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
OneTimeLine{
|
OneTimeLine{
|
||||||
k: k_,
|
|
||||||
b: b_,
|
|
||||||
start: *point,
|
start: *point,
|
||||||
end: Point2D::new(0.0, b_)
|
end: Point2D::new(0.0, b_)
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
$start_time = Get-Uptime
|
$start_time = Get-Uptime
|
||||||
Write-Output $start_time
|
Write-Output $start_time
|
||||||
|
|
||||||
python3.9 .github/workflows/get_info.py -env
|
python3 .github/workflows/get_info.py -env
|
||||||
|
|
||||||
if (-Not (Test-Path -Path "./.github/workflows/env.ps1"))
|
if (-Not (Test-Path -Path "./.github/workflows/env.ps1"))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user