~starkingdoms/starkingdoms

ref: ac4be9832c7cc1a735c4a593f3e9a4c4fb952deb starkingdoms/crates/unified/src/config/planet.rs -rw-r--r-- 790 bytes
ac4be983 — core chore(lint): pass clippy 5 months 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
use bevy::asset::Asset;
use bevy::prelude::{Bundle, Component, Transform, TypePath};
use bevy_rapier2d::prelude::{AdditionalMassProperties, Collider, ReadMassProperties, RigidBody};
use serde::{Deserialize, Serialize};

#[derive(Deserialize, Asset, TypePath, Component, Serialize, Clone, Debug)]
#[require(ReadMassProperties, RigidBody::Fixed)]
pub struct Planet {
    pub name: String,
    pub sprite: String,
    pub radius: f32,
    pub mass: f32,
    pub default_transform: [f32; 3],
}

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

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