~starkingdoms/starkingdoms

ref: e2c74ff0a4af609afb2869c59835838dd76f639c starkingdoms/crates/unified/src/config/planet.rs -rw-r--r-- 1.0 KiB
e2c74ff0 — core Revert "aaa ??? ?? ? ?? ???????????????????????????????????????????? i would like to explosion" 10 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
use bevy::asset::Asset;
use bevy::color::Color;
use crate::prelude::*;
use serde::{Deserialize, Serialize};


#[derive(Deserialize, Asset, TypePath, Component, Serialize, Clone, Debug)]
#[require(
    RigidBody::Static,
    Replicated,
)]
pub struct Planet {
    pub name: String,
    pub sprite: String,
    pub indicator_sprite: Option<String>,
    pub radius: f32,
    pub mass: f32,
    pub default_transform: [f32; 3],
    pub special_sprite_properties: Option<SpecialSpriteProperties>,
    pub orbit: Option<OrbitData>
}

#[derive(Deserialize, TypePath, Serialize, Clone, Debug)]
pub struct OrbitData {
    pub orbiting: String,
    pub eccentricity: f32,
}

#[derive(Deserialize, TypePath, Serialize, Clone, Debug)]
pub enum SpecialSpriteProperties {
    ForceColor(Color),
}

#[derive(Bundle)]
pub struct PlanetBundle {
    pub planet: Planet,
    pub transform: Transform,
    pub collider: Collider,
    pub mass: Mass
}

#[derive(Deserialize, Asset, TypePath)]
pub struct PlanetConfigCollection {
    pub planets: Vec<Planet>,
}