worked on networking
This commit is contained in:
parent
7df4e86afb
commit
c9a7e071cd
8 changed files with 409 additions and 16 deletions
9
orthros-network/src/generic/mod.rs
Normal file
9
orthros-network/src/generic/mod.rs
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
use crate::starchart::star::StarInfo;
|
||||
use bevy::ecs::component::Component;
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub struct EntityID(pub u32);
|
||||
#[derive(Serialize, Deserialize, Debug, Component)]
|
||||
pub enum ObjectUpdate {
|
||||
Star(StarInfo),
|
||||
}
|
||||
|
|
@ -1,2 +1,3 @@
|
|||
pub mod generic;
|
||||
pub mod starchart;
|
||||
pub const SCALEAU: f32 = 1.0;
|
||||
|
|
|
|||
|
|
@ -1,19 +1,24 @@
|
|||
use crate::SCALEAU;
|
||||
use crate::{SCALEAU, generic::EntityID};
|
||||
|
||||
const SOLARRADIUSTOLY: f32 = 7.35355e-8;
|
||||
|
||||
use bevy::{ecs::component::Component, transform::components::Transform};
|
||||
use serde::{Deserialize, Serialize};
|
||||
fn solar_radius_to_ly_scaled(r: f32) -> f32 {
|
||||
r * SOLARRADIUSTOLY * SCALEAU
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Debug)]
|
||||
pub enum StarClass {
|
||||
MType,
|
||||
BType,
|
||||
GType,
|
||||
}
|
||||
#[derive(Serialize, Deserialize, Debug, Component)]
|
||||
pub struct StarInfo {
|
||||
pub id: EntityID,
|
||||
pub name: String,
|
||||
pub class: StarClass,
|
||||
pub diameter: f32,
|
||||
pub transform: Transform,
|
||||
}
|
||||
pub fn star_diameter_range(class: &StarClass) -> std::ops::Range<f32> {
|
||||
match class {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue