diff --git a/Cargo.lock b/Cargo.lock index 050c53f22..24a59bfa9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2193,6 +2193,7 @@ dependencies = [ "de_core", "de_objects", "de_pathing", + "de_types", "glam", "parry3d", ] @@ -2206,6 +2207,7 @@ dependencies = [ "de_core", "de_map", "de_terrain", + "de_types", "de_uom", "iyes_progress", "parry3d", @@ -2283,6 +2285,7 @@ dependencies = [ "de_pathing", "de_signs", "de_spawner", + "de_types", "parry2d", "parry3d", ] @@ -2309,6 +2312,7 @@ dependencies = [ "de_signs", "de_spawner", "de_terrain", + "de_types", "enum-map", "glam", "parry2d", @@ -2321,16 +2325,13 @@ version = "0.1.0-dev" dependencies = [ "async-std", "bevy", + "de_types", "dirs", - "enum-iterator", - "enum-map", "glam", "iyes_progress", - "nalgebra", "parry2d", "parry3d", "paste", - "serde", "thiserror", "tinyvec", ] @@ -2390,6 +2391,7 @@ dependencies = [ "criterion", "de_core", "de_objects", + "de_types", "glam", "nalgebra", "parry2d", @@ -2409,6 +2411,7 @@ dependencies = [ "de_multiplayer", "de_spawner", "de_terrain", + "de_types", "futures-lite", "iyes_progress", ] @@ -2483,7 +2486,7 @@ dependencies = [ "async-std", "async-tar", "bevy", - "de_core", + "de_types", "enum-map", "glam", "parry2d", @@ -2508,6 +2511,7 @@ dependencies = [ "de_map", "de_messages", "de_multiplayer", + "de_types", "futures-lite", "thiserror", ] @@ -2530,6 +2534,7 @@ dependencies = [ "de_map", "de_objects", "de_pathing", + "de_types", "glam", "parry2d", "parry3d", @@ -2547,6 +2552,7 @@ dependencies = [ "de_gui", "de_messages", "de_net", + "de_types", "futures-lite", "iyes_progress", "tracing", @@ -2574,6 +2580,7 @@ dependencies = [ "anyhow", "bevy", "de_core", + "de_types", "enum-iterator", "enum-map", "glam", @@ -2595,6 +2602,7 @@ dependencies = [ "de_core", "de_map", "de_objects", + "de_types", "futures-lite", "glam", "nalgebra", @@ -2615,6 +2623,7 @@ dependencies = [ "de_core", "de_objects", "de_terrain", + "de_types", "glam", ] @@ -2631,6 +2640,7 @@ dependencies = [ "de_map", "de_objects", "de_terrain", + "de_types", "parry2d", "parry3d", ] @@ -2644,6 +2654,7 @@ dependencies = [ "de_core", "de_map", "de_objects", + "de_types", "glam", "itertools 0.11.0", "iyes_progress", @@ -2663,6 +2674,19 @@ dependencies = [ "parry3d", ] +[[package]] +name = "de_types" +version = "0.1.0-dev" +dependencies = [ + "enum-iterator", + "enum-map", + "glam", + "nalgebra", + "parry2d", + "parry3d", + "serde", +] + [[package]] name = "de_uom" version = "0.1.0-dev" diff --git a/Cargo.toml b/Cargo.toml index 95b9d0901..515a654e5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -106,6 +106,7 @@ de_pathing = { path = "crates/pathing", version = "0.1.0-dev" } de_signs = { path = "crates/signs", version = "0.1.0-dev" } de_spawner = { path = "crates/spawner", version = "0.1.0-dev" } de_terrain = { path = "crates/terrain", version = "0.1.0-dev" } +de_types = { path = "crates/types", version = "0.1.0-dev" } de_uom = { path = "crates/uom", version = "0.1.0-dev" } # Other diff --git a/crates/behaviour/Cargo.toml b/crates/behaviour/Cargo.toml index 6dcc91ad0..7930571c0 100644 --- a/crates/behaviour/Cargo.toml +++ b/crates/behaviour/Cargo.toml @@ -16,6 +16,7 @@ categories.workspace = true de_core.workspace = true de_objects.workspace = true de_pathing.workspace = true +de_types.workspace = true # Other bevy.workspace = true diff --git a/crates/behaviour/src/chase.rs b/crates/behaviour/src/chase.rs index cca9507ba..a6a911cfe 100644 --- a/crates/behaviour/src/chase.rs +++ b/crates/behaviour/src/chase.rs @@ -1,6 +1,7 @@ use bevy::prelude::*; -use de_core::{gamestate::GameState, projection::ToFlat}; +use de_core::gamestate::GameState; use de_pathing::{PathQueryProps, PathTarget, UpdateEntityPathEvent}; +use de_types::projection::ToFlat; pub(crate) struct ChasePlugin; diff --git a/crates/camera/Cargo.toml b/crates/camera/Cargo.toml index 07df812a8..82594478c 100644 --- a/crates/camera/Cargo.toml +++ b/crates/camera/Cargo.toml @@ -14,10 +14,11 @@ categories.workspace = true [dependencies] # DE de_conf.workspace = true -de_uom.workspace = true de_core.workspace = true de_map.workspace = true de_terrain.workspace = true +de_types.workspace = true +de_uom.workspace = true # Other bevy.workspace = true diff --git a/crates/camera/src/camera.rs b/crates/camera/src/camera.rs index 357baa460..086d344a6 100644 --- a/crates/camera/src/camera.rs +++ b/crates/camera/src/camera.rs @@ -10,12 +10,12 @@ use de_core::{ cleanup::DespawnOnGameExit, events::ResendEventPlugin, gamestate::GameState, - projection::ToAltitude, schedule::{InputSchedule, Movement, PreMovement}, state::AppState, }; use de_map::size::MapBounds; use de_terrain::{TerrainCollider, MAX_ELEVATION}; +use de_types::projection::ToAltitude; use de_uom::{InverseSecond, Metre, Quantity, Radian, Second}; use iyes_progress::prelude::*; use parry3d::{math::Vector, query::Ray}; diff --git a/crates/combat/src/attack.rs b/crates/combat/src/attack.rs index 88ef617d2..fc9078738 100644 --- a/crates/combat/src/attack.rs +++ b/crates/combat/src/attack.rs @@ -2,7 +2,7 @@ use std::{cmp::Ordering, collections::BinaryHeap}; use bevy::prelude::*; use de_behaviour::{ChaseSet, ChaseTarget, ChaseTargetEvent}; -use de_core::{gamestate::GameState, objects::ObjectType}; +use de_core::{gamestate::GameState, objects::ObjectTypeComponent}; use de_index::SpatialQuery; use de_objects::{LaserCannon, SolidObjects}; use parry3d::query::Ray; @@ -119,7 +119,7 @@ fn update_positions( mut commands: Commands, solids: SolidObjects, mut cannons: Query<(Entity, &Transform, &LaserCannon, &mut Attacking)>, - targets: Query<(&Transform, &ObjectType)>, + targets: Query<(&Transform, &ObjectTypeComponent)>, sightline: SpatialQuery, ) { for (attacker, transform, cannon, mut attacking) in cannons.iter_mut() { @@ -127,7 +127,7 @@ fn update_positions( Ok((enemy_transform, &target_type)) => { attacking.muzzle = transform.translation + cannon.muzzle(); - let enemy_aabb = solids.get(target_type).collider().aabb(); + let enemy_aabb = solids.get(*target_type).collider().aabb(); let enemy_centroid = enemy_transform.translation + Vec3::from(enemy_aabb.center()); let direction = (enemy_centroid - attacking.muzzle) .try_normalize() diff --git a/crates/construction/Cargo.toml b/crates/construction/Cargo.toml index b6d483d7b..c0892948b 100644 --- a/crates/construction/Cargo.toml +++ b/crates/construction/Cargo.toml @@ -20,6 +20,7 @@ de_objects.workspace = true de_pathing.workspace = true de_signs.workspace = true de_spawner.workspace = true +de_types.workspace = true # Other ahash.workspace = true diff --git a/crates/construction/src/manufacturing.rs b/crates/construction/src/manufacturing.rs index 06fdf173b..7eb41b4a9 100644 --- a/crates/construction/src/manufacturing.rs +++ b/crates/construction/src/manufacturing.rs @@ -6,9 +6,8 @@ use de_audio::spatial::{PlaySpatialAudioEvent, Sound}; use de_core::{ cleanup::DespawnOnGameExit, gamestate::GameState, - objects::{Active, ActiveObjectType, ObjectType, UnitType, PLAYER_MAX_UNITS}, - player::Player, - projection::{ToAltitude, ToFlat}, + objects::{Active, ObjectTypeComponent}, + player::PlayerComponent, state::AppState, }; use de_index::SpatialQuery; @@ -18,6 +17,11 @@ use de_signs::{ LineLocation, UpdateLineEndEvent, UpdateLineLocationEvent, UpdatePoleLocationEvent, }; use de_spawner::{ObjectCounter, SpawnBundle}; +use de_types::{ + objects::{ActiveObjectType, ObjectType, UnitType, PLAYER_MAX_UNITS}, + player::Player, + projection::{ToAltitude, ToFlat}, +}; use parry2d::bounding_volume::Aabb; use parry3d::math::Isometry; @@ -290,12 +294,12 @@ impl ProductionItem { fn configure( mut commands: Commands, solids: SolidObjects, - new: Query<(Entity, &Transform, &ObjectType), Added>, + new: Query<(Entity, &Transform, &ObjectTypeComponent), Added>, mut pole_events: EventWriter, mut line_events: EventWriter, ) { for (entity, transform, &object_type) in new.iter() { - let solid = solids.get(object_type); + let solid = solids.get(*object_type); if let Some(factory) = solid.factory() { let start = transform.transform_point(factory.position().to_msl()); let local_aabb = solid.ichnography().local_aabb(); @@ -351,12 +355,12 @@ fn enqueue( fn check_spawn_locations( solids: SolidObjects, space: SpatialQuery, - mut factories: Query<(Entity, &ObjectType, &Transform, &mut AssemblyLine)>, + mut factories: Query<(Entity, &ObjectTypeComponent, &Transform, &mut AssemblyLine)>, ) { for (entity, &object_type, transform, mut line) in factories.iter_mut() { line.blocks_mut().spawn_location = match line.current() { Some(unit_type) => { - let factory = solids.get(object_type).factory().unwrap(); + let factory = solids.get(*object_type).factory().unwrap(); let collider = solids .get(ObjectType::Active(ActiveObjectType::Unit(unit_type))) .collider(); @@ -377,7 +381,7 @@ fn check_spawn_locations( fn produce( time: Res