~starkingdoms/starkingdoms

ref: 1018826380f46e306958358cc687d9a5302b2be6 starkingdoms/crates/unified/src/ship_editor/components.rs -rw-r--r-- 1.2 KiB
10188263ghostly_zsh ship editor feat: selection and deselection 3 hours 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
use bevy::camera::visibility::RenderLayers;
use bevy::render::extract_component::ExtractComponent;
use bevy::render::render_resource::ShaderType;
use crate::prelude::{Component, Handle, Entity, Resource};
use crate::shared::config::part::PartConfig;
use crate::shared::config::ship_editor::ShipEditorConfig;

pub const OUTLINE_RENDER_LAYER: RenderLayers = RenderLayers::layer(0);
pub const MAIN_RENDER_LAYER: RenderLayers = RenderLayers::layer(1);
pub const GHOST_RENDER_LAYER: RenderLayers = RenderLayers::layer(2);

#[derive(Component)]
pub struct GhostModule;
#[derive(Component)]
pub struct Part;
#[derive(Component)]
pub struct PartConfigHolder(pub PartConfig);
#[derive(Component, Default)]
pub struct Selectable {
    pub outline_entity: Option<Entity>,
    pub is_selected: bool,
}

#[derive(Component, Default, Clone, Copy, ExtractComponent)]
pub struct OutlineCamera;
#[derive(Component)]
pub struct MainCamera;
#[derive(Component)]
pub struct GhostCamera;
#[derive(Component)]
pub struct PlayerPartRequest;
#[derive(Component)]
pub struct SpawnPartRequest(pub Handle<PartConfig>);

#[derive(Resource, Default)]
pub struct ShipEditorConfigHolder {
    pub handle: Option<Handle<ShipEditorConfig>>,
}