diff --git a/Animations.md b/Animations.md index 0af8b66..96ba6b9 100644 --- a/Animations.md +++ b/Animations.md @@ -24,5 +24,16 @@ Limit mods to attachments, for now, I don't want to change barrel lengths or for Only do silencers/compensators, sights, Foregrips. ### Blender: +Use a single file for attachments and a single file for weapons, then export them one by one as a new gltf asset + + - Mark every weapon parent with a FirearmEnum custom property -- Mark Firing point \ No newline at end of file +- Mark Firing point without attachments (FiringPoint) +- Mark Sight placement start and end +- Mark Attachment slots (CompensatorSlot, ForeGripSlot, MagazineSlot, StockSlot, SightPlacementStart, SightPlacementEnd, UtilitySlot) +- Attempt to center all the slots +- Mark Gun part slots (ChargingHandle, Trigger) + +- Set all attachments origin to where they will be placed on the gun +- Mark them with the specific WeaponAttachment variant +- Set all attachments transform to 0 and the same scale as the gun diff --git a/assets/attachments/aimpoint_t1.glb b/assets/attachments/aimpoint_t1.glb new file mode 100644 index 0000000..ad4b553 Binary files /dev/null and b/assets/attachments/aimpoint_t1.glb differ diff --git a/assets/attachments/ak105_magazine.glb b/assets/attachments/ak105_magazine.glb new file mode 100644 index 0000000..b5f9cd4 Binary files /dev/null and b/assets/attachments/ak105_magazine.glb differ diff --git a/assets/attachments/first_compensator.glb b/assets/attachments/first_compensator.glb new file mode 100644 index 0000000..202fbe6 Binary files /dev/null and b/assets/attachments/first_compensator.glb differ diff --git a/assets/attachments/pk5_foregrip.glb b/assets/attachments/pk5_foregrip.glb new file mode 100644 index 0000000..3799666 Binary files /dev/null and b/assets/attachments/pk5_foregrip.glb differ diff --git a/assets/attachments/tan_magpull_stock.glb b/assets/attachments/tan_magpull_stock.glb new file mode 100644 index 0000000..6b4480a Binary files /dev/null and b/assets/attachments/tan_magpull_stock.glb differ diff --git a/assets/character/main_character.glb b/assets/character/main_character.glb index f7a2d37..1eb3cc7 100644 Binary files a/assets/character/main_character.glb and b/assets/character/main_character.glb differ diff --git a/assets/weapons/ak105_rifle.glb b/assets/weapons/ak105_rifle.glb new file mode 100644 index 0000000..6538703 Binary files /dev/null and b/assets/weapons/ak105_rifle.glb differ diff --git a/src/comps/core/inventory/player_inventory.rs b/src/comps/core/inventory/player_inventory.rs index 9357823..2b6d0d6 100644 --- a/src/comps/core/inventory/player_inventory.rs +++ b/src/comps/core/inventory/player_inventory.rs @@ -1,6 +1,6 @@ use bevy::{prelude::*, gltf::Gltf}; -use crate::{comps::core::{items::item::Item, events::inventory_changed::PlayerInventoryChangedEvent, markers::firearm::FirearmType}, setup::assets::GltfAssets}; +use crate::{comps::core::{items::item::Item, events::inventory_changed::PlayerInventoryChangedEvent, weapons::firearm_data::FirearmType}, setup::assets::GltfAssets}; use super::{item_inventory::ItemInventory, slot::PlayerInventorySlotType}; diff --git a/src/comps/core/items/guns/ak105.rs b/src/comps/core/items/guns/ak105.rs new file mode 100644 index 0000000..fd2e595 --- /dev/null +++ b/src/comps/core/items/guns/ak105.rs @@ -0,0 +1,48 @@ +use bevy::prelude::*; + +use crate::comps::core::{ + grid::UGrid, + items::item::{Item, ItemType}, + markers::holdable::HoldableObjectType, inventory::slot::PlayerInventorySlotType, weapons::firearm::Firearm, +}; + +#[derive(Component, Reflect)] +pub struct Ak105GunItem; + +impl Item for Ak105GunItem { + fn get_type(&self) -> ItemType { + ItemType::Holdable(HoldableObjectType::Firearm(Firearm::Glock17)) + } + + fn asset_path(&self) -> &str { + "weapons/ak105_rifle.glb" + } + + #[doc = " Optional Stackable. If value is Some(x) x is the max quantity per stack"] + fn stackable(&self) -> Option { + None + } + + fn inventory_size(&self) -> UGrid { + UGrid { + width: 4, + height: 2, + } + } + + fn inventory_rotatable(&self) -> bool { + true + } + + fn inventory_title(&self) -> String { + String::from("AK105") + } + + fn inventory_description(&self) -> String { + String::from("Rifle chambered in 5.45x39mm.") + } + + fn get_item_slot(&self) -> PlayerInventorySlotType { + PlayerInventorySlotType::Primary + } +} diff --git a/src/comps/core/items/guns/glock17.rs b/src/comps/core/items/guns/glock17.rs index 8bb98ad..aff643b 100644 --- a/src/comps/core/items/guns/glock17.rs +++ b/src/comps/core/items/guns/glock17.rs @@ -1,12 +1,9 @@ use bevy::prelude::*; -use crate::{ - comps::core::{ +use crate::comps::core::{ grid::UGrid, items::item::{Item, ItemType}, - markers::holdable::HoldableObjectType, inventory::slot::PlayerInventorySlotType, - }, - logic::core::guns::firearm::Firearm, + markers::holdable::HoldableObjectType, inventory::slot::PlayerInventorySlotType, weapons::firearm::Firearm, }; #[derive(Component, Reflect)] diff --git a/src/comps/core/items/guns/m4a1.rs b/src/comps/core/items/guns/m4a1.rs index ca2c014..5ac47b5 100644 --- a/src/comps/core/items/guns/m4a1.rs +++ b/src/comps/core/items/guns/m4a1.rs @@ -1,12 +1,9 @@ -use bevy::prelude::*; +/*use bevy::prelude::*; -use crate::{ - comps::core::{ +use crate::comps::core::{ grid::UGrid, items::item::{Item, ItemType}, - markers::holdable::HoldableObjectType, inventory::slot::PlayerInventorySlotType, - }, - logic::core::guns::firearm::Firearm, + markers::holdable::HoldableObjectType, inventory::slot::PlayerInventorySlotType, weapons::firearm::Firearm, }; #[derive(Component, Reflect)] @@ -48,3 +45,4 @@ impl Item for M4a1GunItem { PlayerInventorySlotType::Primary } } +*/ \ No newline at end of file diff --git a/src/comps/core/items/guns/mod.rs b/src/comps/core/items/guns/mod.rs index d204833..6a9b48d 100644 --- a/src/comps/core/items/guns/mod.rs +++ b/src/comps/core/items/guns/mod.rs @@ -1,2 +1,3 @@ pub mod glock17; pub mod m4a1; +pub mod ak105; \ No newline at end of file diff --git a/src/comps/core/items/item.rs b/src/comps/core/items/item.rs index a19c3bc..3e35919 100644 --- a/src/comps/core/items/item.rs +++ b/src/comps/core/items/item.rs @@ -1,9 +1,8 @@ use crate::{ comps::core::{ grid::UGrid, - markers::{firearm::FirearmData, holdable::HoldableObjectType, interactable::Interactable}, inventory::slot::PlayerInventorySlotType, + markers::{holdable::HoldableObjectType, interactable::Interactable}, inventory::slot::PlayerInventorySlotType, weapons::{firearm_data::FirearmData, firearm::Firearm}, }, - logic::core::guns::firearm::Firearm, setup::assets::{GltfAssetType, GltfAssets}, utils, }; diff --git a/src/comps/core/markers/bullet.rs b/src/comps/core/markers/bullet.rs index 027b680..a61b575 100644 --- a/src/comps/core/markers/bullet.rs +++ b/src/comps/core/markers/bullet.rs @@ -4,7 +4,7 @@ use bevy::{ time::Timer, }; -use crate::logic::core::guns::caliber::Caliber; +use crate::comps::core::weapons::caliber::Caliber; #[derive(Component, Reflect)] pub struct BulletMarker { diff --git a/src/comps/core/markers/firearm.rs b/src/comps/core/markers/firearm.rs deleted file mode 100644 index 922b47e..0000000 --- a/src/comps/core/markers/firearm.rs +++ /dev/null @@ -1,60 +0,0 @@ -use bevy::{ - prelude::{Component, Quat, Vec3}, - reflect::Reflect, -}; - -use crate::logic::core::guns::{caliber::Caliber, spray_pattern::FirearmSprayPattern}; - -#[derive(Default, Debug, Clone, Reflect)] -pub struct FiringPoint { - pub forward: f32, - pub up: f32, - pub right: f32, -} - -#[derive(Reflect, Clone)] -pub enum FirearmType { - Primary, - Secondary, -} - -#[derive(Component, Clone, Reflect)] -pub struct FirearmData { - /// Where the bullets will come out of, and muzzle flash will be spawned out of. - /// Also, this transform's .forward() should be pointing the same Vec3 as the barrel is - /// Global transform - pub firing_point: FiringPoint, - pub caliber: Caliber, - /// Placeholder until mags get implemented - pub max_capacity: usize, - /// Rounds per minute - pub fire_rate: f32, - /// Amount of seconds it takes for gun to come down from shooting - /// Also is the time it takes for the gun to aim in or aim out. - pub rebound_time_seconds: f32, - - pub asset_path: String, - - pub vertical_recoil_modifier: f32, - pub horizontal_recoil_modifier: f32, - pub recoil_pattern: FirearmSprayPattern, - - /// Final rotation of hands when aimed in - pub final_aimed_rotation: Quat, - /// Final rotation of hands when not aimed in - pub final_rotation: Quat, - /// Final position of hands when aimed in - pub final_aimed_position: Vec3, - /// Final position of hands when not aimed in - pub final_position: Vec3, - - pub scale_factor: f32, - - pub firearm_type: FirearmType, -} - -#[derive(Component, Reflect)] -pub struct MagazineData { - pub rounds_shot: usize, - pub max_capacity: usize, -} diff --git a/src/comps/core/markers/holdable.rs b/src/comps/core/markers/holdable.rs index c3a6427..0d533db 100644 --- a/src/comps/core/markers/holdable.rs +++ b/src/comps/core/markers/holdable.rs @@ -1,6 +1,6 @@ use bevy::prelude::*; -use crate::logic::core::guns::firearm::Firearm; +use crate::comps::core::weapons::firearm::Firearm; /// Anything that can go in the player's hands. #[derive(Component, Default, Debug, Reflect)] diff --git a/src/comps/core/markers/mod.rs b/src/comps/core/markers/mod.rs index 18dbd4b..3ea8700 100644 --- a/src/comps/core/markers/mod.rs +++ b/src/comps/core/markers/mod.rs @@ -1,6 +1,5 @@ pub mod bullet; pub mod camera; -pub mod firearm; pub mod holdable; pub mod interactable; pub mod inventory_screen; diff --git a/src/comps/core/markers/proxy/mod.rs b/src/comps/core/markers/proxy/mod.rs index 273481d..02da4e3 100644 --- a/src/comps/core/markers/proxy/mod.rs +++ b/src/comps/core/markers/proxy/mod.rs @@ -1,4 +1,5 @@ pub mod character; pub mod plugin; pub mod physics; -pub mod bevy; \ No newline at end of file +pub mod bevy; +pub mod weapons; \ No newline at end of file diff --git a/src/comps/core/markers/proxy/plugin.rs b/src/comps/core/markers/proxy/plugin.rs index 30a1c5e..d084aea 100644 --- a/src/comps/core/markers/proxy/plugin.rs +++ b/src/comps/core/markers/proxy/plugin.rs @@ -1,6 +1,6 @@ use bevy::app::{Plugin, Update}; -use crate::setup::load_state::update_game_load_state; +use crate::{setup::load_state::update_game_load_state, comps::core::weapons::{firearm::Firearm, attachments::{weapon_attachment::WeaponAttachment, optic::Optic, stock::Stock, compensator::Compensator, magazine::Magazine, foregrip::ForeGrip}, parts::{charging_handle::ChargingHandle, fire_selector::FireSelector, firing_point::FiringPoint, trigger::Trigger}, slot::{compensator_slot::CompensatorSlot, fore_grip_slot::ForeGripSlot, magazine_slot::MagazineSlot, sight_placement_start_slot::SightPlacementStartSlot, sight_placement_end_slot::SightPlacementEndSlot, stock_slot::StockSlot, utility_slot::UtilitySlot}}}; use super::{character::{player_hitbox::PlayerHitBox, player_character::PlayerCharacter, player_eye::{PlayerEye, insert_components_into_spawned_player}, in_player_hands_parent::{InPlayerHandsParent, insert_components_into_player_hand}, third_person_camera::ThirdPersonCameraProxy}, physics::{rapier::{AutoAABBCollider, physics_replace_proxies}, self}}; @@ -20,6 +20,32 @@ impl Plugin for ProxyComponentsPlugin { app.register_type::(); app.register_type::(); + // Firearms + app.register_type::(); + + // Attachments + app.register_type::(); + app.register_type::(); + app.register_type::(); + app.register_type::(); + app.register_type::(); + app.register_type::(); + + // Parts + app.register_type::(); + app.register_type::(); + app.register_type::(); + app.register_type::(); + + // Slots + app.register_type::(); + app.register_type::(); + app.register_type::(); + app.register_type::(); + app.register_type::(); + app.register_type::(); + app.register_type::(); + // Physics app.register_type::(); app.register_type::(); diff --git a/src/comps/core/markers/proxy/weapons/firearm.rs b/src/comps/core/markers/proxy/weapons/firearm.rs new file mode 100644 index 0000000..6912e0a --- /dev/null +++ b/src/comps/core/markers/proxy/weapons/firearm.rs @@ -0,0 +1,8 @@ +use bevy::prelude::*; + + +#[derive(Component, Reflect, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] +pub enum Firearm { + Ak105, + Glock17 +} \ No newline at end of file diff --git a/src/comps/core/markers/proxy/weapons/mod.rs b/src/comps/core/markers/proxy/weapons/mod.rs new file mode 100644 index 0000000..21435c1 --- /dev/null +++ b/src/comps/core/markers/proxy/weapons/mod.rs @@ -0,0 +1 @@ +pub mod firearm; \ No newline at end of file diff --git a/src/comps/core/mod.rs b/src/comps/core/mod.rs index 1005fae..70f087b 100644 --- a/src/comps/core/mod.rs +++ b/src/comps/core/mod.rs @@ -5,3 +5,5 @@ pub mod inventory; pub mod items; pub mod markers; pub mod spawners; +#[allow(unused)] +pub mod weapons; \ No newline at end of file diff --git a/src/comps/core/spawners/guns/ak105_spawner.rs b/src/comps/core/spawners/guns/ak105_spawner.rs new file mode 100644 index 0000000..29ec6a4 --- /dev/null +++ b/src/comps/core/spawners/guns/ak105_spawner.rs @@ -0,0 +1,21 @@ +use bevy::prelude::*; + +use crate::comps::core::{ + items::{guns::ak105::Ak105GunItem, item::Item}, + spawners::item::ItemSpawnPoint, +}; + +#[derive(Component)] +pub struct Ak105SpawnPoint { + pub transform: Transform, +} + +impl ItemSpawnPoint for Ak105SpawnPoint { + fn get_transform(&self) -> Transform { + self.transform + } + + fn get_item(&self) -> Box { + Box::new(Ak105GunItem) + } +} diff --git a/src/comps/core/spawners/guns/m4a1_spawner.rs b/src/comps/core/spawners/guns/m4a1_spawner.rs index b567f90..e59729b 100644 --- a/src/comps/core/spawners/guns/m4a1_spawner.rs +++ b/src/comps/core/spawners/guns/m4a1_spawner.rs @@ -1,4 +1,4 @@ -use bevy::prelude::*; +/*use bevy::prelude::*; use crate::comps::core::{ items::{guns::m4a1::M4a1GunItem, item::Item}, @@ -18,4 +18,4 @@ impl ItemSpawnPoint for M4a1SpawnPoint { fn get_item(&self) -> Box { Box::new(M4a1GunItem) } -} +}*/ diff --git a/src/comps/core/spawners/guns/mod.rs b/src/comps/core/spawners/guns/mod.rs index 37289a5..217d3bb 100644 --- a/src/comps/core/spawners/guns/mod.rs +++ b/src/comps/core/spawners/guns/mod.rs @@ -1,2 +1,3 @@ pub mod glock17_spawner; pub mod m4a1_spawner; +pub mod ak105_spawner; \ No newline at end of file diff --git a/src/comps/core/spawners/item.rs b/src/comps/core/spawners/item.rs index 8026b34..fa19278 100644 --- a/src/comps/core/spawners/item.rs +++ b/src/comps/core/spawners/item.rs @@ -3,7 +3,7 @@ use bevy::{gltf::Gltf, prelude::*}; use crate::{ comps::core::{ items::item::Item, - spawners::guns::{glock17_spawner::Glock17SpawnPoint, m4a1_spawner::M4a1SpawnPoint}, + spawners::guns::{glock17_spawner::Glock17SpawnPoint, ak105_spawner::Ak105SpawnPoint}, }, setup::{assets::GltfAssets, load_state::GameLoadState}, }; @@ -43,7 +43,8 @@ pub struct ItemSpawnPointPlugin; impl Plugin for ItemSpawnPointPlugin { fn build(&self, app: &mut App) { use bevy_trait_query::RegisterExt; - app.register_component_as::() + app + .register_component_as::()//.register_component_as::() .register_component_as::(); } } diff --git a/src/comps/core/weapons/attachments/compensator.rs b/src/comps/core/weapons/attachments/compensator.rs new file mode 100644 index 0000000..83f0f29 --- /dev/null +++ b/src/comps/core/weapons/attachments/compensator.rs @@ -0,0 +1,9 @@ +use bevy::{reflect::Reflect, ecs::{component::Component, reflect::ReflectComponent}}; + + +#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Reflect, Component, Debug, Default)] +#[reflect(Component)] +pub enum Compensator { + #[default] + FirstCompensator, +} \ No newline at end of file diff --git a/src/comps/core/weapons/attachments/foregrip.rs b/src/comps/core/weapons/attachments/foregrip.rs new file mode 100644 index 0000000..62cb3b7 --- /dev/null +++ b/src/comps/core/weapons/attachments/foregrip.rs @@ -0,0 +1,9 @@ +use bevy::{reflect::Reflect, ecs::{component::Component, reflect::ReflectComponent}}; + + +#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Reflect, Component, Debug, Default)] +#[reflect(Component)] +pub enum ForeGrip { + #[default] + Pk5, +} \ No newline at end of file diff --git a/src/comps/core/weapons/attachments/magazine.rs b/src/comps/core/weapons/attachments/magazine.rs new file mode 100644 index 0000000..be7f861 --- /dev/null +++ b/src/comps/core/weapons/attachments/magazine.rs @@ -0,0 +1,9 @@ +use bevy::{reflect::Reflect, ecs::{component::Component, reflect::ReflectComponent}}; + + +#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Reflect, Component, Debug, Default)] +#[reflect(Component)] +pub enum Magazine { + #[default] + Ak105, +} \ No newline at end of file diff --git a/src/comps/core/weapons/attachments/mod.rs b/src/comps/core/weapons/attachments/mod.rs new file mode 100644 index 0000000..bb061dc --- /dev/null +++ b/src/comps/core/weapons/attachments/mod.rs @@ -0,0 +1,6 @@ +pub mod weapon_attachment; +pub mod optic; +pub mod magazine; +pub mod compensator; +pub mod stock; +pub mod foregrip; \ No newline at end of file diff --git a/src/comps/core/weapons/attachments/optic.rs b/src/comps/core/weapons/attachments/optic.rs new file mode 100644 index 0000000..6f83eee --- /dev/null +++ b/src/comps/core/weapons/attachments/optic.rs @@ -0,0 +1,9 @@ +use bevy::{reflect::Reflect, ecs::{component::Component, reflect::ReflectComponent}}; + + +#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Reflect, Component, Debug, Default)] +#[reflect(Component)] +pub enum Optic { + #[default] + AimpointT1, +} \ No newline at end of file diff --git a/src/comps/core/weapons/attachments/stock.rs b/src/comps/core/weapons/attachments/stock.rs new file mode 100644 index 0000000..ed86c9a --- /dev/null +++ b/src/comps/core/weapons/attachments/stock.rs @@ -0,0 +1,9 @@ +use bevy::{reflect::Reflect, ecs::{component::Component, reflect::ReflectComponent}}; + + +#[derive(PartialEq, Eq, PartialOrd, Ord, Clone, Reflect, Component, Debug, Default)] +#[reflect(Component)] +pub enum Stock { + #[default] + MagpullTan, +} \ No newline at end of file diff --git a/src/comps/core/weapons/attachments/weapon_attachment.rs b/src/comps/core/weapons/attachments/weapon_attachment.rs new file mode 100644 index 0000000..5ea29ea --- /dev/null +++ b/src/comps/core/weapons/attachments/weapon_attachment.rs @@ -0,0 +1,59 @@ +use bevy::prelude::*; + +use super::{compensator::Compensator, magazine::Magazine, stock::Stock, foregrip::ForeGrip, optic::Optic}; + +#[derive(Component, PartialEq, Eq, PartialOrd, Ord, Clone, Reflect, Debug)] +#[reflect(Component)] +pub enum WeaponAttachment { + Compensator(Compensator), + Magazine(Magazine), + Stock(Stock), + ForeGrip(ForeGrip), + Optic(Optic) +} + +impl Default for WeaponAttachment { + fn default() -> Self { + Self::Optic(Optic::default()) + } +} + +impl WeaponAttachment { + pub fn vertical_recoil_modifier(&self) -> f32 { + match self { + WeaponAttachment::Compensator(_) => 0.0, + WeaponAttachment::Magazine(_) => 0.0, + WeaponAttachment::Stock(_) => 0.0, + WeaponAttachment::ForeGrip(_) => 0.0, + WeaponAttachment::Optic(_) => 0.0, + } + } + pub fn horizontal_recoil_modifier(&self) -> f32 { + match self { + WeaponAttachment::Compensator(_) => 0.0, + WeaponAttachment::Magazine(_) => 0.0, + WeaponAttachment::Stock(_) => 0.0, + WeaponAttachment::ForeGrip(_) => 0.0, + WeaponAttachment::Optic(_) => 0.0, + } + } + pub fn asset_path<'a>(&self) -> &'a str { + match self { + WeaponAttachment::Compensator(compensator) => match compensator { + Compensator::FirstCompensator => "attachments/first_compensator.glb", + }, + WeaponAttachment::Magazine(magazine) => match magazine { + Magazine::Ak105 => "attachments/ak105_magazine.glb", + }, + WeaponAttachment::Stock(stock) => match stock { + Stock::MagpullTan => "attachments/tan_magpull_stock.glb", + }, + WeaponAttachment::ForeGrip(foregrip) => match foregrip { + ForeGrip::Pk5 => "attachments/pk5_foregrip.glb", + }, + WeaponAttachment::Optic(optic) => match optic { + Optic::AimpointT1 => "attachments/aimpoint_t1.glb", + }, + } + } +} \ No newline at end of file diff --git a/src/logic/core/guns/caliber.rs b/src/comps/core/weapons/caliber.rs similarity index 79% rename from src/logic/core/guns/caliber.rs rename to src/comps/core/weapons/caliber.rs index d7626cd..618bf71 100644 --- a/src/logic/core/guns/caliber.rs +++ b/src/comps/core/weapons/caliber.rs @@ -3,50 +3,61 @@ use bevy::reflect::Reflect; #[allow(unused)] #[derive(Clone, Reflect)] pub enum Caliber { + /// 5.56x45mm NATO556, + /// 9x19mm Parabellum9mm, + /// 5.45x39mm + RU545 } impl Caliber { pub fn range(&self) -> f32 { match self { Caliber::NATO556 => 7500.0, Caliber::Parabellum9mm => 2500.0, + Caliber::RU545 => 4500.0, } } pub fn max_airtime_secs(&self) -> f32 { match self { Caliber::NATO556 => 3.0, Caliber::Parabellum9mm => 3.0, + Caliber::RU545 => 3.0, } } pub fn impulse(&self) -> f32 { match self { Caliber::NATO556 => 100.0, Caliber::Parabellum9mm => 50.0, + Caliber::RU545 => 75.0, } } pub fn mass(&self) -> f32 { match self { Caliber::NATO556 => 0.1, Caliber::Parabellum9mm => 0.05, + Caliber::RU545 => 0.07, } } pub fn linear_damping(&self) -> f32 { match self { Caliber::NATO556 => 1.0, Caliber::Parabellum9mm => 2.0, + Caliber::RU545 => 1.5, } } pub fn angular_damping(&self) -> f32 { match self { Caliber::NATO556 => 1.0, Caliber::Parabellum9mm => 1.0, + Caliber::RU545 => 1.0, } } pub fn size(&self) -> f32 { match self { Caliber::NATO556 => 0.07, Caliber::Parabellum9mm => 0.05, + Caliber::RU545 => 0.06 } } } diff --git a/src/logic/core/guns/firearm.rs b/src/comps/core/weapons/firearm.rs similarity index 69% rename from src/logic/core/guns/firearm.rs rename to src/comps/core/weapons/firearm.rs index 6bfa1ae..ac4903b 100644 --- a/src/logic/core/guns/firearm.rs +++ b/src/comps/core/weapons/firearm.rs @@ -1,29 +1,23 @@ use std::sync::Arc; -use crate::comps::core::{ - items::{ - guns::{glock17::Glock17GunItem, m4a1::M4a1GunItem}, - item::Item, - }, - markers::{ - firearm::{FirearmData, FirearmType, FiringPoint}, - holdable::HoldableObjectData, - }, -}; use bevy::prelude::*; -use super::{caliber::Caliber, spray_pattern::FirearmSprayPattern}; +use crate::comps::core::{markers::holdable::HoldableObjectData, items::{item::Item, guns::glock17::Glock17GunItem}}; -#[derive(Component, PartialEq, Eq, PartialOrd, Ord, Clone, Reflect)] +use super::{firearm_data::{FirearmData, FirearmType}, caliber::Caliber, spray_pattern::FirearmSprayPattern}; + +#[derive(Component, Reflect, PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Default)] +#[reflect(Component)] pub enum Firearm { - M4A1, - Glock17, + Ak105, + #[default] + Glock17 } impl Firearm { pub fn firearm_data(&self) -> FirearmData { match self { - Firearm::M4A1 => { + /*Firearm::M4A1 => { FirearmData { firing_point: FiringPoint { forward: 2.5, @@ -64,20 +58,12 @@ impl Firearm { asset_path: String::from("weapons/m4a1_rifle.glb"), firearm_type: FirearmType::Primary, } - } + }*/ Firearm::Glock17 => { FirearmData { - firing_point: FiringPoint { - forward: 1.2, - up: 0.445, - right: 0.0, - }, caliber: Caliber::Parabellum9mm, - max_capacity: 17, fire_rate: 600.0, rebound_time_seconds: 0.1, - vertical_recoil_modifier: 5.0, - horizontal_recoil_modifier: 1.0, recoil_pattern: FirearmSprayPattern { vertical: Vec::from([ 1.0, 1.2, 1.3, 1.6, 1.5, 1.7, 1.5, 1.5, 1.5, 2.0, // 10 for now @@ -107,44 +93,78 @@ impl Firearm { firearm_type: FirearmType::Secondary, } } + Firearm::Ak105 => FirearmData { + caliber: Caliber::RU545, + fire_rate: 600.0, + rebound_time_seconds: 0.2, + asset_path: String::from("weapons/ak105_rifle.glb"), + recoil_pattern: FirearmSprayPattern { + vertical: Vec::from([ + 1.0, 1.2, 1.3, 1.6, 1.5, 1.7, 1.5, 1.5, 1.5, 2.0, // 10 for now + ]), + horizontal: Vec::from([ + 1.0, 1.2, 1.3, -1.6, 1.5, -1.7, -1.5, 1.5, -1.5, 2.0, // 10 for now + ]), + }, + final_aimed_rotation: Quat::default(), + final_rotation: Quat::default(), + final_aimed_position: Vec3::ZERO, + final_position: Vec3::ZERO, + scale_factor: 0.3, + firearm_type: FirearmType::Primary, + }, } } pub fn holdable_object_data(&self) -> HoldableObjectData { match self { + /* Firearm::M4A1 => HoldableObjectData { held_at: Vec3::ZERO, y_rot: -90.0, - }, + },*/ Firearm::Glock17 => HoldableObjectData { held_at: Vec3::ZERO, y_rot: 0.0, }, + Firearm::Ak105 => HoldableObjectData { + held_at: Vec3::ZERO, + y_rot: 0.0 + }, } } pub fn get_size(&self) -> Vec3 { match self { - Firearm::M4A1 => Vec3 { + /*Firearm::M4A1 => Vec3 { x: 0.3, y: 0.7, z: 2.5, - }, + },*/ Firearm::Glock17 => Vec3 { x: 0.3, y: 0.4, z: 1.0, }, + Firearm::Ak105 => Vec3 { + x: 0.3, + y: 0.7, + z: 2.5, + }, + } } + pub fn get_item_arc(&self) -> Arc { match self { - Firearm::M4A1 => Arc::new(M4a1GunItem), + //Firearm::M4A1 => Arc::new(M4a1GunItem), Firearm::Glock17 => Arc::new(Glock17GunItem), + Firearm::Ak105 => todo!(), } } pub fn get_item_box(&self) -> Box { match self { - Firearm::M4A1 => Box::new(M4a1GunItem), + //Firearm::M4A1 => Box::new(M4a1GunItem), Firearm::Glock17 => Box::new(Glock17GunItem), + Firearm::Ak105 => todo!(), } } -} +} \ No newline at end of file diff --git a/src/comps/core/weapons/firearm_data.rs b/src/comps/core/weapons/firearm_data.rs new file mode 100644 index 0000000..70768f4 --- /dev/null +++ b/src/comps/core/weapons/firearm_data.rs @@ -0,0 +1,34 @@ +use bevy::prelude::*; + +use super::{spray_pattern::FirearmSprayPattern, caliber::Caliber}; + + +/// Static data retrieved from a trait impl (Firearm) +#[derive(Clone, Reflect)] +pub struct FirearmData { + pub caliber: Caliber, + /// Rounds per minute + pub fire_rate: f32, + /// Amount of seconds it takes for gun to come down from shooting + /// Also is the time it takes for the gun to aim in or aim out. + pub rebound_time_seconds: f32, + pub asset_path: String, + pub recoil_pattern: FirearmSprayPattern, + /// Final rotation of hands when aimed in + pub final_aimed_rotation: Quat, + /// Final rotation of hands when not aimed in + pub final_rotation: Quat, + /// Final position of hands when aimed in + pub final_aimed_position: Vec3, + /// Final position of hands when not aimed in + pub final_position: Vec3, + pub scale_factor: f32, + pub firearm_type: FirearmType, +} + +#[derive(Reflect, Clone)] +pub enum FirearmType { + Primary, + Secondary, +} + diff --git a/src/comps/core/weapons/magazine_data.rs b/src/comps/core/weapons/magazine_data.rs new file mode 100644 index 0000000..22d3e95 --- /dev/null +++ b/src/comps/core/weapons/magazine_data.rs @@ -0,0 +1,8 @@ +use bevy::prelude::*; + + +#[derive(Component, Reflect, Debug, Default, Clone, PartialEq, Eq, PartialOrd, Ord)] +pub struct MagazineData { + pub rounds_shot: usize, + pub max_capacity: usize, +} \ No newline at end of file diff --git a/src/comps/core/weapons/mod.rs b/src/comps/core/weapons/mod.rs new file mode 100644 index 0000000..c7c3f58 --- /dev/null +++ b/src/comps/core/weapons/mod.rs @@ -0,0 +1,8 @@ +pub mod attachments; +pub mod firearm; +pub mod firearm_data; +pub mod caliber; +pub mod spray_pattern; +pub mod magazine_data; +pub mod slot; +pub mod parts; \ No newline at end of file diff --git a/src/comps/core/weapons/parts/charging_handle.rs b/src/comps/core/weapons/parts/charging_handle.rs new file mode 100644 index 0000000..cb5caac --- /dev/null +++ b/src/comps/core/weapons/parts/charging_handle.rs @@ -0,0 +1,5 @@ +use bevy::{ecs::{component::Component, reflect::ReflectComponent}, reflect::Reflect}; + +#[derive(Component, Reflect, PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Default)] +#[reflect(Component)] +pub struct ChargingHandle; \ No newline at end of file diff --git a/src/comps/core/weapons/parts/fire_selector.rs b/src/comps/core/weapons/parts/fire_selector.rs new file mode 100644 index 0000000..546d687 --- /dev/null +++ b/src/comps/core/weapons/parts/fire_selector.rs @@ -0,0 +1,5 @@ +use bevy::{ecs::{component::Component, reflect::ReflectComponent}, reflect::Reflect}; + +#[derive(Component, Reflect, PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Default)] +#[reflect(Component)] +pub struct FireSelector; \ No newline at end of file diff --git a/src/comps/core/weapons/parts/firing_point.rs b/src/comps/core/weapons/parts/firing_point.rs new file mode 100644 index 0000000..6c989b5 --- /dev/null +++ b/src/comps/core/weapons/parts/firing_point.rs @@ -0,0 +1,5 @@ +use bevy::{ecs::{component::Component, reflect::ReflectComponent}, reflect::Reflect}; + +#[derive(Component, Reflect, PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Default)] +#[reflect(Component)] +pub struct FiringPoint; \ No newline at end of file diff --git a/src/comps/core/weapons/parts/mod.rs b/src/comps/core/weapons/parts/mod.rs new file mode 100644 index 0000000..63e9810 --- /dev/null +++ b/src/comps/core/weapons/parts/mod.rs @@ -0,0 +1,4 @@ +pub mod fire_selector; +pub mod charging_handle; +pub mod trigger; +pub mod firing_point; \ No newline at end of file diff --git a/src/comps/core/weapons/parts/trigger.rs b/src/comps/core/weapons/parts/trigger.rs new file mode 100644 index 0000000..b74bb75 --- /dev/null +++ b/src/comps/core/weapons/parts/trigger.rs @@ -0,0 +1,5 @@ +use bevy::{ecs::{component::Component, reflect::ReflectComponent}, reflect::Reflect}; + +#[derive(Component, Reflect, PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Default)] +#[reflect(Component)] +pub struct Trigger; \ No newline at end of file diff --git a/src/comps/core/weapons/slot/compensator_slot.rs b/src/comps/core/weapons/slot/compensator_slot.rs new file mode 100644 index 0000000..b57b83a --- /dev/null +++ b/src/comps/core/weapons/slot/compensator_slot.rs @@ -0,0 +1,5 @@ +use bevy::{ecs::{component::Component, reflect::ReflectComponent}, reflect::Reflect}; + +#[derive(Component, Reflect, PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Default)] +#[reflect(Component)] +pub struct CompensatorSlot; \ No newline at end of file diff --git a/src/comps/core/weapons/slot/fore_grip_slot.rs b/src/comps/core/weapons/slot/fore_grip_slot.rs new file mode 100644 index 0000000..e03eec8 --- /dev/null +++ b/src/comps/core/weapons/slot/fore_grip_slot.rs @@ -0,0 +1,5 @@ +use bevy::{ecs::{component::Component, reflect::ReflectComponent}, reflect::Reflect}; + +#[derive(Component, Reflect, PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Default)] +#[reflect(Component)] +pub struct ForeGripSlot; \ No newline at end of file diff --git a/src/comps/core/weapons/slot/magazine_slot.rs b/src/comps/core/weapons/slot/magazine_slot.rs new file mode 100644 index 0000000..084f005 --- /dev/null +++ b/src/comps/core/weapons/slot/magazine_slot.rs @@ -0,0 +1,5 @@ +use bevy::{ecs::{component::Component, reflect::ReflectComponent}, reflect::Reflect}; + +#[derive(Component, Reflect, PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Default)] +#[reflect(Component)] +pub struct MagazineSlot; \ No newline at end of file diff --git a/src/comps/core/weapons/slot/mod.rs b/src/comps/core/weapons/slot/mod.rs new file mode 100644 index 0000000..1568dbc --- /dev/null +++ b/src/comps/core/weapons/slot/mod.rs @@ -0,0 +1,7 @@ +pub mod compensator_slot; +pub mod magazine_slot; +pub mod stock_slot; +pub mod fore_grip_slot; +pub mod utility_slot; +pub mod sight_placement_start_slot; +pub mod sight_placement_end_slot; \ No newline at end of file diff --git a/src/comps/core/weapons/slot/sight_placement_end_slot.rs b/src/comps/core/weapons/slot/sight_placement_end_slot.rs new file mode 100644 index 0000000..c25e75f --- /dev/null +++ b/src/comps/core/weapons/slot/sight_placement_end_slot.rs @@ -0,0 +1,5 @@ +use bevy::{ecs::{component::Component, reflect::ReflectComponent}, reflect::Reflect}; + +#[derive(Component, Reflect, PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Default)] +#[reflect(Component)] +pub struct SightPlacementEndSlot; \ No newline at end of file diff --git a/src/comps/core/weapons/slot/sight_placement_start_slot.rs b/src/comps/core/weapons/slot/sight_placement_start_slot.rs new file mode 100644 index 0000000..1fcf69b --- /dev/null +++ b/src/comps/core/weapons/slot/sight_placement_start_slot.rs @@ -0,0 +1,5 @@ +use bevy::{ecs::{component::Component, reflect::ReflectComponent}, reflect::Reflect}; + +#[derive(Component, Reflect, PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Default)] +#[reflect(Component)] +pub struct SightPlacementStartSlot; \ No newline at end of file diff --git a/src/comps/core/weapons/slot/stock_slot.rs b/src/comps/core/weapons/slot/stock_slot.rs new file mode 100644 index 0000000..9ee7685 --- /dev/null +++ b/src/comps/core/weapons/slot/stock_slot.rs @@ -0,0 +1,5 @@ +use bevy::{ecs::{component::Component, reflect::ReflectComponent}, reflect::Reflect}; + +#[derive(Component, Reflect, PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Default)] +#[reflect(Component)] +pub struct StockSlot; \ No newline at end of file diff --git a/src/comps/core/weapons/slot/utility_slot.rs b/src/comps/core/weapons/slot/utility_slot.rs new file mode 100644 index 0000000..09e1e91 --- /dev/null +++ b/src/comps/core/weapons/slot/utility_slot.rs @@ -0,0 +1,5 @@ +use bevy::{ecs::{component::Component, reflect::ReflectComponent}, reflect::Reflect}; + +#[derive(Component, Reflect, PartialEq, Eq, PartialOrd, Ord, Clone, Debug, Default)] +#[reflect(Component)] +pub struct UtilitySlot; \ No newline at end of file diff --git a/src/logic/core/guns/spray_pattern.rs b/src/comps/core/weapons/spray_pattern.rs similarity index 100% rename from src/logic/core/guns/spray_pattern.rs rename to src/comps/core/weapons/spray_pattern.rs diff --git a/src/logic/core/guns/mod.rs b/src/logic/core/guns/mod.rs index 1a6a129..9676614 100644 --- a/src/logic/core/guns/mod.rs +++ b/src/logic/core/guns/mod.rs @@ -1,6 +1,3 @@ -pub mod caliber; pub mod despawn_shots; -pub mod firearm; pub mod player_firing; pub mod shoot; -pub mod spray_pattern; diff --git a/src/logic/core/guns/shoot.rs b/src/logic/core/guns/shoot.rs index 16b4e82..ba54c5f 100644 --- a/src/logic/core/guns/shoot.rs +++ b/src/logic/core/guns/shoot.rs @@ -3,9 +3,7 @@ use std::time::Duration; use bevy::prelude::*; use bevy_rapier3d::prelude::*; -use crate::comps::core::markers::{bullet::BulletMarker, muzzle_flash::MuzzleFlashMarker}; - -use super::caliber::Caliber; +use crate::comps::core::{markers::{bullet::BulletMarker, muzzle_flash::MuzzleFlashMarker}, weapons::caliber::Caliber}; pub fn shoot_bullet( commands: &mut Commands, diff --git a/src/logic/core/player/hands.rs b/src/logic/core/player/hands.rs index 992a6dc..ed16da6 100644 --- a/src/logic/core/player/hands.rs +++ b/src/logic/core/player/hands.rs @@ -7,7 +7,6 @@ use crate::{ inventory::{player_inventory::{PlayerInventory, self}, slot::PlayerInventorySlotType}, markers::{ camera::MainCamera, - firearm::{FirearmData, MagazineData}, holdable::InPlayerHands, interactable::Interactable, player::Player, proxy::{character::in_player_hands_parent::InPlayerHandsParent, physics::rapier::LinkToPlayer}, @@ -47,8 +46,6 @@ pub fn capture_hand_usage( ( Entity, &GlobalTransform, - &'static FirearmData, - &mut MagazineData, ), (With, Without), >, @@ -120,7 +117,7 @@ pub fn capture_hand_usage( .full_auto_timer .tick(resources.time.delta()); - for (_f, firearm_transform, firearm_data, mut magazine_data) in + for (_f, firearm_transform) in firearm_query.iter_mut() { for mut hand_transform in hand_query.iter_mut() { @@ -157,7 +154,7 @@ pub fn capture_hand_usage( // Player is not in a reload animation if resources.keyboard_input.just_pressed(KeyCode::R) && !resources.game_ui_state.any_window() - { + {} /* // Start reload animation for (animation_player_entity, mut animation_player) in @@ -186,6 +183,7 @@ pub fn capture_hand_usage( // At the end of reload animation, set magazine data to capacity = 0 } // AIMING IN/OUT + /* if resources.mouse_buttons.pressed(MouseButton::Right) && !resources.game_ui_state.any_window() { @@ -281,7 +279,7 @@ pub fn capture_hand_usage( player_firing_info.current_round_index = 0; } } - } + }*/ } } diff --git a/src/scenes/scene1/spawn_points.rs b/src/scenes/scene1/spawn_points.rs index e73a36f..5cb9499 100644 --- a/src/scenes/scene1/spawn_points.rs +++ b/src/scenes/scene1/spawn_points.rs @@ -4,7 +4,7 @@ use crate::{ comps::core::{ markers::player::{Player, PlayerData}, spawners::{ - guns::{glock17_spawner::Glock17SpawnPoint, m4a1_spawner::M4a1SpawnPoint}, + guns::glock17_spawner::Glock17SpawnPoint, player::PlayerSpawnPoint, }, }, @@ -16,13 +16,13 @@ pub fn set_spawn_points(mut commands: Commands) { transform: Transform::from_xyz(3.0, 5.0, 2.0), player: Player(PlayerData::default()), }); - commands.spawn(M4a1SpawnPoint { + /*commands.spawn(M4a1SpawnPoint { transform: { let mut transform = Transform::from_xyz(18.0, 10.0, 10.0); transform.rotate_z(utils::rad_deg::radians_from_degrees(-90.0)); transform }, - }); + });*/ commands.spawn(Glock17SpawnPoint { transform: { let mut transform = Transform::from_xyz(20.0, 10.0, 10.0); @@ -30,13 +30,13 @@ pub fn set_spawn_points(mut commands: Commands) { transform }, }); - commands.spawn(M4a1SpawnPoint { + /*commands.spawn(M4a1SpawnPoint { transform: { let mut transform = Transform::from_xyz(18.0, 10.0, 18.0); transform.rotate_z(utils::rad_deg::radians_from_degrees(-90.0)); transform }, - }); + });*/ commands.spawn(Glock17SpawnPoint { transform: { let mut transform = Transform::from_xyz(20.0, 10.0, 20.0); diff --git a/src/setup/assets.rs b/src/setup/assets.rs index 6463bd1..7a77d3b 100644 --- a/src/setup/assets.rs +++ b/src/setup/assets.rs @@ -1,13 +1,11 @@ use bevy::{gltf::Gltf, prelude::*}; -use crate::{ - logic::core::guns::firearm::Firearm, - scenes::scene1::skybox::{Cubemap, CUBEMAPS}, -}; +use crate::{scenes::scene1::skybox::{Cubemap, CUBEMAPS}, comps::core::weapons::{firearm::Firearm, attachments::{weapon_attachment::WeaponAttachment, optic::Optic, magazine::Magazine, compensator::Compensator, foregrip::ForeGrip, stock::Stock}}}; #[derive(PartialEq, Eq, PartialOrd, Ord, Reflect)] pub enum GltfAssetType { Firearm(Firearm), + Attachment(WeaponAttachment), Character, #[allow(unused)] Enemy, @@ -35,20 +33,67 @@ pub fn load_all_assets( is_loaded: false, image_handle: skybox_handle, }); - let m4a1_gltf_asset = GltfAsset { + /*let m4a1_gltf_asset = GltfAsset { asset_type: GltfAssetType::Firearm(Firearm::M4A1), asset: asset_server.load(Firearm::M4A1.firearm_data().asset_path), + };*/ + // Weapons + let ak105_gltf_asset = GltfAsset { + asset_type: GltfAssetType::Firearm(Firearm::Ak105), + asset: asset_server.load(Firearm::Ak105.firearm_data().asset_path), }; let glock17_gltf_asset = GltfAsset { asset_type: GltfAssetType::Firearm(Firearm::Glock17), asset: asset_server.load(Firearm::Glock17.firearm_data().asset_path), }; + // Attachments + let aimpoint_t1_gltf_asset = { + let attachment = WeaponAttachment::Optic(Optic::AimpointT1); + GltfAsset { + asset: asset_server.load(attachment.asset_path()), + asset_type: GltfAssetType::Attachment(attachment), + } + }; + let ak105_magazine_gltf_asset = { + let attachment = WeaponAttachment::Magazine(Magazine::Ak105); + GltfAsset { + asset: asset_server.load(attachment.asset_path()), + asset_type: GltfAssetType::Attachment(attachment), + } + }; + let first_compensator_gltf_asset = { + let attachment = WeaponAttachment::Compensator(Compensator::FirstCompensator); + GltfAsset { + asset: asset_server.load(attachment.asset_path()), + asset_type: GltfAssetType::Attachment(attachment), + } + }; + let pk5_foregrip_gltf_asset = { + let attachment = WeaponAttachment::ForeGrip(ForeGrip::Pk5); + GltfAsset { + asset: asset_server.load(attachment.asset_path()), + asset_type: GltfAssetType::Attachment(attachment), + } + }; + let tan_magpull_stock_gltf_asset = { + let attachment = WeaponAttachment::Stock(Stock::MagpullTan); + GltfAsset { + asset: asset_server.load(attachment.asset_path()), + asset_type: GltfAssetType::Attachment(attachment), + } + }; + // Characters let main_character_asset = GltfAsset { asset_type: GltfAssetType::Character, asset: asset_server.load("character/main_character.glb"), }; + commands.insert_resource(GltfAssets { - assets: Vec::from([m4a1_gltf_asset, glock17_gltf_asset, main_character_asset]), + assets: Vec::from([/*m4a1_gltf_asset, */ + ak105_gltf_asset, glock17_gltf_asset, // Firearms + main_character_asset, // Characters + aimpoint_t1_gltf_asset, pk5_foregrip_gltf_asset, ak105_magazine_gltf_asset, first_compensator_gltf_asset, tan_magpull_stock_gltf_asset // Attachments + ]), }); } diff --git a/src/setup/equipment.rs b/src/setup/equipment.rs index 4d37e27..f621060 100644 --- a/src/setup/equipment.rs +++ b/src/setup/equipment.rs @@ -3,12 +3,11 @@ use std::time::Duration; use bevy::{gltf::Gltf, prelude::*}; use crate::{ - comps::core::markers::{ - firearm::{FirearmData, MagazineData}, + comps::core::{markers::{ holdable::InPlayerHands, player::Player, proxy::character::in_player_hands_parent::InPlayerHandsParent, - }, - logic::core::guns::{firearm::Firearm, player_firing::PlayerFiringInfo}, + }, weapons::{firearm::Firearm, firearm_data::FirearmData}}, + logic::core::guns::player_firing::PlayerFiringInfo, utils, }; @@ -96,12 +95,7 @@ fn spawn_firearm_on_player_hands( .id(); let firearm_entity = commands .spawn(( - firearm_data.clone(), firearm.holdable_object_data(), - MagazineData { - rounds_shot: 0, - max_capacity: firearm_data.max_capacity, - }, InPlayerHands, Name::new("Firearm"), TransformBundle { diff --git a/src/setup/load_state.rs b/src/setup/load_state.rs index d8de3ed..04d108a 100644 --- a/src/setup/load_state.rs +++ b/src/setup/load_state.rs @@ -13,7 +13,7 @@ pub struct GameLoadState { impl GameLoadState { pub fn is_everything_except_player_loaded(&self) -> bool { - self.assets_loaded && self.animations_loaded + self.assets_loaded// && self.animations_loaded } } diff --git a/src/ui/editor/plugin.rs b/src/ui/editor/plugin.rs index ef50594..e59cc23 100644 --- a/src/ui/editor/plugin.rs +++ b/src/ui/editor/plugin.rs @@ -3,16 +3,12 @@ use bevy_editor_pls::EditorPlugin; use bevy_inspector_egui::bevy_egui::EguiPlugin; use crate::{ - comps::core::markers::{ - firearm::{FirearmData, MagazineData}, + comps::core::{markers::{ holdable::{HoldableObjectData, InPlayerHands}, player::{Player, PlayerData, PlayerHand}, - }, + }, weapons::{firearm_data::FirearmData, magazine_data::MagazineData, caliber::Caliber, firearm::Firearm, spray_pattern::FirearmSprayPattern}}, logic::core::{ - guns::{ - caliber::Caliber, firearm::Firearm, player_firing::PlayerFiringInfo, - spray_pattern::FirearmSprayPattern, - }, + guns::player_firing::PlayerFiringInfo, player::{ camera_player_sync::MouseMovementSettings, player_movement::{PlayerLinearXZState, PlayerLinearYState, PlayerMovementInput},