Cargo fmt
This commit is contained in:
parent
865070ed90
commit
aa7eb521b8
@ -1,5 +1,6 @@
|
||||
## Game design
|
||||
|
||||
### OUTDADED:
|
||||
4-6 guns, with 1 magazine per gun.
|
||||
Optics can be left out
|
||||
Can only be found in the world
|
||||
|
23
Readme.md
23
Readme.md
@ -1,17 +1,28 @@
|
||||
# Experimental game
|
||||
|
||||
|
||||
## Things to finish:
|
||||
- [ ] Perfect movement
|
||||
- [ ] Equipping items (Guns and armor)
|
||||
- [ ] Gun aiming and noscope is not the same position
|
||||
- [ ] Controls being bindable
|
||||
- [ ] Gun moving out of the way on a collision
|
||||
- [ ] Gun moving when walking, when running, aimed in.
|
||||
- [ ] Visual effects for camera
|
||||
|
||||
|
||||
- [ ] Fix: Make gun have more priority in rendering. So it doesn't clip through walls
|
||||
- [ ] Feature: Give a collider to the gun and when it collides with something make it move out of the way.
|
||||
- [ ] Feature: Add bullet holes
|
||||
- [ ] Fix: No Sprinting while aiming
|
||||
- [ ] Fix: Movement is clunky and very linear. Add some sort of Lerping for acceleration vectors.
|
||||
- [ ] Feature: Muzzle flashes for shots
|
||||
- [ ] Feature: Bullets (raycast or projectile?)
|
||||
- [x] Feature: Muzzle flashes for shots
|
||||
- [x] Feature: Bullets (projectile)
|
||||
- [x] Feature: Add smooth camera movement to camera on crouch. Right now it's too fast and looks arcade af.
|
||||
~~- [ ] Feature: Add jump effect to camera~~
|
||||
- [ ] Feature: Add Stamina (with bar?)
|
||||
- [ ] Feature: Subtle Headbob, FOV change on movement (Distinguish between sprinting and walking).
|
||||
- [ ] Feature: Basic ESC UI, FPS counter, stamina bar
|
||||
- [x] Feature: Basic ESC UI, FPS counter
|
||||
- [ ] Feature: Gun sprinting animations, high ready, low ready, etc...
|
||||
|
||||
- [x] Discussion: PvP vs PvE
|
||||
@ -32,15 +43,15 @@ Build a realistic fps sandbox with arcadey mechanics, and start to document it,
|
||||
|
||||
|
||||
## MVP to start documenting progress:
|
||||
- [ ] Shooting bullets.
|
||||
- [x] Shooting bullets.
|
||||
- [ ] A manequinn that registers hits in every hitbox.
|
||||
- [ ] A shooting range/place to be in and show process
|
||||
- [ ] Some resemblance of UI (Escape menu, stamina bar, etc...)
|
||||
- [x] Some resemblance of UI (Escape menu, stamina bar, etc...)
|
||||
- [ ] Stamina system
|
||||
|
||||
## End goal landmarks
|
||||
- [ ] Dynamic hitboxes (heart, brain, lungs)
|
||||
- [ ] Health system with blodloss instead of a health number
|
||||
- [ ] Dynamic lighting (Gunshots causing light to be spawned for a duration)
|
||||
- [x] Dynamic lighting (Gunshots causing light to be spawned for a duration)
|
||||
- [ ] Sound system
|
||||
- [ ] Adrenaline system
|
@ -1,6 +1,13 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::{comps::core::{items::item::{Item, ItemType}, grid::UGrid, markers::holdable::HoldableObjectType}, logic::core::guns::firearm::Firearm};
|
||||
use crate::{
|
||||
comps::core::{
|
||||
grid::UGrid,
|
||||
items::item::{Item, ItemType},
|
||||
markers::holdable::HoldableObjectType,
|
||||
},
|
||||
logic::core::guns::firearm::Firearm,
|
||||
};
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Glock17GunItem;
|
||||
@ -10,17 +17,20 @@ impl Item for Glock17GunItem {
|
||||
ItemType::Holdable(HoldableObjectType::Firearm(Firearm::Glock17))
|
||||
}
|
||||
|
||||
fn asset_path(&self) -> &str {
|
||||
fn asset_path(&self) -> &str {
|
||||
"weapons/glock_17_pistol.glb"
|
||||
}
|
||||
|
||||
#[doc = " Optional Stackable. If value is Some(x) x is the max quantity per stack"]
|
||||
fn stackable(&self) -> Option<u32> {
|
||||
fn stackable(&self) -> Option<u32> {
|
||||
None
|
||||
}
|
||||
|
||||
fn inventory_size(&self) -> UGrid {
|
||||
UGrid { width: 2, height: 1 }
|
||||
UGrid {
|
||||
width: 2,
|
||||
height: 1,
|
||||
}
|
||||
}
|
||||
|
||||
fn inventory_rotatable(&self) -> bool {
|
||||
@ -34,4 +44,4 @@ impl Item for Glock17GunItem {
|
||||
fn inventory_description(&self) -> String {
|
||||
String::from("Glock17 Firearm chambered in 9x19mm.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
pub mod glock17;
|
||||
pub mod m4a1;
|
||||
pub mod glock17;
|
@ -81,7 +81,11 @@ pub trait Item {
|
||||
..Default::default()
|
||||
},
|
||||
RigidBody::Dynamic,
|
||||
Collider::cuboid(firearm_size.x, firearm_size.y, firearm_size.z),
|
||||
Collider::cuboid(
|
||||
firearm_size.x,
|
||||
firearm_size.y,
|
||||
firearm_size.z,
|
||||
),
|
||||
Interactable::Item,
|
||||
))
|
||||
.push_children(&[firearm_asset_entity]);
|
||||
|
@ -12,6 +12,12 @@ pub struct FiringPoint {
|
||||
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.
|
||||
@ -43,6 +49,8 @@ pub struct FirearmData {
|
||||
pub final_position: Vec3,
|
||||
|
||||
pub scale_factor: f32,
|
||||
|
||||
pub firearm_type: FirearmType,
|
||||
}
|
||||
|
||||
#[derive(Component, Reflect)]
|
||||
|
@ -4,4 +4,4 @@ pub mod grid;
|
||||
pub mod inventory;
|
||||
pub mod items;
|
||||
pub mod markers;
|
||||
pub mod spawners;
|
||||
pub mod spawners;
|
||||
|
@ -1,6 +1,9 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::comps::core::{items::{guns::glock17::Glock17GunItem, item::Item}, spawners::item::ItemSpawnPoint};
|
||||
use crate::comps::core::{
|
||||
items::{guns::glock17::Glock17GunItem, item::Item},
|
||||
spawners::item::ItemSpawnPoint,
|
||||
};
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct Glock17SpawnPoint {
|
||||
@ -15,4 +18,4 @@ impl ItemSpawnPoint for Glock17SpawnPoint {
|
||||
fn get_item(&self) -> Box<dyn Item> {
|
||||
Box::new(Glock17GunItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::comps::core::{items::{guns::m4a1::M4a1GunItem, item::Item}, spawners::item::ItemSpawnPoint};
|
||||
use crate::comps::core::{
|
||||
items::{guns::m4a1::M4a1GunItem, item::Item},
|
||||
spawners::item::ItemSpawnPoint,
|
||||
};
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct M4a1SpawnPoint {
|
||||
@ -15,4 +18,4 @@ impl ItemSpawnPoint for M4a1SpawnPoint {
|
||||
fn get_item(&self) -> Box<dyn Item> {
|
||||
Box::new(M4a1GunItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
pub mod glock17_spawner;
|
||||
pub mod m4a1_spawner;
|
||||
pub mod glock17_spawner;
|
@ -1,6 +1,12 @@
|
||||
use bevy::{prelude::*, gltf::Gltf};
|
||||
use bevy::{gltf::Gltf, prelude::*};
|
||||
|
||||
use crate::{setup::{load_state::GameLoadState, assets::GltfAssets}, comps::core::{items::item::Item, spawners::guns::{m4a1_spawner::M4a1SpawnPoint, glock17_spawner::Glock17SpawnPoint}}};
|
||||
use crate::{
|
||||
comps::core::{
|
||||
items::item::Item,
|
||||
spawners::guns::{glock17_spawner::Glock17SpawnPoint, m4a1_spawner::M4a1SpawnPoint},
|
||||
},
|
||||
setup::{assets::GltfAssets, load_state::GameLoadState},
|
||||
};
|
||||
|
||||
#[bevy_trait_query::queryable]
|
||||
pub trait ItemSpawnPoint {
|
||||
@ -19,7 +25,12 @@ pub fn item_spawner(
|
||||
for (entity, item_sp_entity) in item_sp_query.iter() {
|
||||
for component_sp in item_sp_entity {
|
||||
println!("Spawning item");
|
||||
component_sp.get_item().spawn(&mut commands, component_sp.get_transform(), &assets_gltf, &loaded_gltf_assets)
|
||||
component_sp.get_item().spawn(
|
||||
&mut commands,
|
||||
component_sp.get_transform(),
|
||||
&assets_gltf,
|
||||
&loaded_gltf_assets,
|
||||
)
|
||||
}
|
||||
//m4.spawn(&mut commands, item_sp.at, &assets_gltf, &loaded_gltf_assets);
|
||||
commands.entity(entity).despawn();
|
||||
@ -31,8 +42,7 @@ pub struct ItemSpawnPointPlugin;
|
||||
impl Plugin for ItemSpawnPointPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
use bevy_trait_query::RegisterExt;
|
||||
app
|
||||
.register_component_as::<dyn ItemSpawnPoint, M4a1SpawnPoint>()
|
||||
app.register_component_as::<dyn ItemSpawnPoint, M4a1SpawnPoint>()
|
||||
.register_component_as::<dyn ItemSpawnPoint, Glock17SpawnPoint>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
pub mod guns;
|
||||
pub mod item;
|
||||
pub mod player;
|
||||
pub mod spawn;
|
||||
pub mod spawn_point;
|
||||
pub mod guns;
|
||||
pub mod spawn;
|
@ -118,7 +118,7 @@ pub fn player_spawner(
|
||||
|
||||
game_load_state.player_loaded = true;
|
||||
equipment_change_event_writer.send(EquipmentChangeEvent(
|
||||
player_spawn_point.player.0.equipment.clone()
|
||||
player_spawn_point.player.0.equipment.clone(),
|
||||
));
|
||||
commands.entity(player_spawn_point_entity).despawn();
|
||||
}
|
||||
|
@ -1,15 +1,15 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
use super::{player::player_spawner, item::{item_spawner, ItemSpawnPointPlugin}, spawn_point::SpawnPointPlugin};
|
||||
|
||||
use super::{
|
||||
item::{item_spawner, ItemSpawnPointPlugin},
|
||||
player::player_spawner,
|
||||
spawn_point::SpawnPointPlugin,
|
||||
};
|
||||
|
||||
pub struct SpawnerPlugin;
|
||||
impl Plugin for SpawnerPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_plugins((SpawnPointPlugin, ItemSpawnPointPlugin));
|
||||
app.add_systems(
|
||||
Update,
|
||||
(player_spawner, item_spawner),
|
||||
);
|
||||
app.add_systems(Update, (player_spawner, item_spawner));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,6 @@ use bevy::prelude::*;
|
||||
|
||||
use crate::comps::core::spawners::player::PlayerSpawnPoint;
|
||||
|
||||
|
||||
#[bevy_trait_query::queryable]
|
||||
pub trait SpawnPoint {
|
||||
fn get_transform(&self) -> Transform;
|
||||
@ -12,7 +11,6 @@ pub struct SpawnPointPlugin;
|
||||
impl Plugin for SpawnPointPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
use bevy_trait_query::RegisterExt;
|
||||
app.
|
||||
register_component_as::<dyn SpawnPoint, PlayerSpawnPoint>();
|
||||
app.register_component_as::<dyn SpawnPoint, PlayerSpawnPoint>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
use crate::comps::core::markers::{
|
||||
firearm::{FirearmData, FiringPoint},
|
||||
firearm::{FirearmData, FirearmType, FiringPoint},
|
||||
holdable::HoldableObjectData,
|
||||
};
|
||||
use bevy::prelude::*;
|
||||
@ -54,6 +54,7 @@ impl Firearm {
|
||||
},
|
||||
scale_factor: 1.0,
|
||||
asset_path: String::from("weapons/m4a1_rifle.glb"),
|
||||
firearm_type: FirearmType::Primary,
|
||||
}
|
||||
}
|
||||
Firearm::Glock17 => {
|
||||
@ -95,6 +96,7 @@ impl Firearm {
|
||||
},
|
||||
scale_factor: 0.25,
|
||||
asset_path: String::from("weapons/glock_17_pistol.glb"),
|
||||
firearm_type: FirearmType::Secondary,
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -113,7 +115,11 @@ impl Firearm {
|
||||
}
|
||||
pub fn get_size(&self) -> Vec3 {
|
||||
match self {
|
||||
Firearm::M4A1 => Vec3 { x: 0.3, y: 0.7, z: 2.5 },
|
||||
Firearm::M4A1 => Vec3 {
|
||||
x: 0.3,
|
||||
y: 0.7,
|
||||
z: 2.5,
|
||||
},
|
||||
Firearm::Glock17 => Vec3::ZERO,
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,13 @@
|
||||
use bevy::{prelude::*, ecs::system::SystemParam};
|
||||
use bevy::{ecs::system::SystemParam, prelude::*};
|
||||
use bevy_rapier3d::prelude::*;
|
||||
|
||||
use crate::{
|
||||
comps::core::{
|
||||
//events::loot_container::LootContainerEvent,
|
||||
markers::{
|
||||
camera::MainCamera,
|
||||
firearm::{FirearmData, MagazineData},
|
||||
holdable::InPlayerHands,
|
||||
interactable::Interactable,
|
||||
player::{Player, PlayerHand},
|
||||
},
|
||||
comps::core::markers::{
|
||||
camera::MainCamera,
|
||||
firearm::{FirearmData, MagazineData},
|
||||
holdable::InPlayerHands,
|
||||
interactable::Interactable,
|
||||
player::{Player, PlayerHand},
|
||||
},
|
||||
logic::core::guns::{firearm::Firearm, player_firing::PlayerFiringInfo, shoot::shoot_bullet},
|
||||
setup::{
|
||||
@ -19,7 +16,7 @@ use crate::{
|
||||
load_state::GameLoadState,
|
||||
},
|
||||
ui::game::{hud::hud::HudState, settings::SettingsScreenUIConfiguration},
|
||||
utils::{rad_deg::radians_from_degrees, self},
|
||||
utils::{self, rad_deg::radians_from_degrees},
|
||||
};
|
||||
|
||||
#[derive(SystemParam)]
|
||||
@ -41,7 +38,12 @@ pub fn capture_hand_usage(
|
||||
|
||||
mut hand_query: Query<&mut Transform, With<PlayerHand>>,
|
||||
mut firearm_query: Query<
|
||||
(Entity, &GlobalTransform, &'static FirearmData, &mut MagazineData),
|
||||
(
|
||||
Entity,
|
||||
&GlobalTransform,
|
||||
&'static FirearmData,
|
||||
&mut MagazineData,
|
||||
),
|
||||
(With<InPlayerHands>, Without<PlayerHand>),
|
||||
>,
|
||||
player_query: Query<&Player>,
|
||||
@ -49,7 +51,7 @@ pub fn capture_hand_usage(
|
||||
mut animation_players: Query<(Entity, &mut AnimationPlayer)>,
|
||||
|
||||
children: Query<&Children>,
|
||||
|
||||
|
||||
mut equipment_change_event_writer: EventWriter<EquipmentChangeEvent>,
|
||||
) {
|
||||
if !resources.game_load_state.player_loaded {
|
||||
@ -77,32 +79,41 @@ pub fn capture_hand_usage(
|
||||
// Firearm stuff
|
||||
if let Equipment::Firearm(player_firearm) = player_query.single().0.equipment.clone() {
|
||||
for mut player_firing_info in player_firing_info_query.iter_mut() {
|
||||
player_firing_info.full_auto_timer.tick(resources.time.delta());
|
||||
player_firing_info
|
||||
.full_auto_timer
|
||||
.tick(resources.time.delta());
|
||||
|
||||
for (firearm_entity, firearm_transform, firearm_data, mut magazine_data) in firearm_query.iter_mut() {
|
||||
for (firearm_entity, firearm_transform, firearm_data, mut magazine_data) in
|
||||
firearm_query.iter_mut()
|
||||
{
|
||||
for mut hand_transform in hand_query.iter_mut() {
|
||||
if player_firing_info.is_reloading {
|
||||
for (animation_player_entity, animation_player) in &mut animation_players {
|
||||
//children.get_component(entity)
|
||||
// Only reload if this animation_player_entity is a child of the firearm_entity
|
||||
if utils::hierarchy::find_child_in_parent_children(&mut commands, firearm_entity, animation_player_entity, &children) {
|
||||
if let Some(firearm_animations) = resources.all_firearm_animations
|
||||
.animations
|
||||
.iter()
|
||||
.find(|animation| &animation.firearm == &player_firearm)
|
||||
{
|
||||
if let Some(animation_clip) =
|
||||
resources.animation_clips.get(&firearm_animations.reload_magazine)
|
||||
if utils::hierarchy::find_child_in_parent_children(
|
||||
&mut commands,
|
||||
firearm_entity,
|
||||
animation_player_entity,
|
||||
&children,
|
||||
) {
|
||||
if let Some(firearm_animations) = resources
|
||||
.all_firearm_animations
|
||||
.animations
|
||||
.iter()
|
||||
.find(|animation| &animation.firearm == &player_firearm)
|
||||
{
|
||||
if animation_player.elapsed() >= animation_clip.duration() {
|
||||
magazine_data.rounds_shot = 0;
|
||||
player_firing_info.is_reloading = false;
|
||||
if let Some(animation_clip) = resources
|
||||
.animation_clips
|
||||
.get(&firearm_animations.reload_magazine)
|
||||
{
|
||||
if animation_player.elapsed() >= animation_clip.duration() {
|
||||
magazine_data.rounds_shot = 0;
|
||||
player_firing_info.is_reloading = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} else {
|
||||
// Player is not in a reload animation
|
||||
@ -110,13 +121,21 @@ pub fn capture_hand_usage(
|
||||
&& !resources.settings_screen_config.settings_menu_shown
|
||||
{
|
||||
// Start reload animation
|
||||
for (animation_player_entity, mut animation_player) in &mut animation_players {
|
||||
for (animation_player_entity, mut animation_player) in
|
||||
&mut animation_players
|
||||
{
|
||||
// Only reload if this animation_player_entity is a child of the firearm_entity
|
||||
if utils::hierarchy::find_child_in_parent_children(&mut commands, firearm_entity, animation_player_entity, &children) {
|
||||
if let Some(firearm_animations) = resources.all_firearm_animations
|
||||
.animations
|
||||
.iter()
|
||||
.find(|animation| &animation.firearm == &player_firearm)
|
||||
if utils::hierarchy::find_child_in_parent_children(
|
||||
&mut commands,
|
||||
firearm_entity,
|
||||
animation_player_entity,
|
||||
&children,
|
||||
) {
|
||||
if let Some(firearm_animations) = resources
|
||||
.all_firearm_animations
|
||||
.animations
|
||||
.iter()
|
||||
.find(|animation| &animation.firearm == &player_firearm)
|
||||
{
|
||||
animation_player
|
||||
.start(firearm_animations.reload_magazine.clone_weak());
|
||||
@ -133,12 +152,14 @@ pub fn capture_hand_usage(
|
||||
{
|
||||
let rotation_lerp_quat = hand_transform.rotation.lerp(
|
||||
firearm_data.final_aimed_rotation,
|
||||
(resources.time.delta_seconds() / firearm_data.rebound_time_seconds)
|
||||
(resources.time.delta_seconds()
|
||||
/ firearm_data.rebound_time_seconds)
|
||||
.clamp(0.0, 1.0),
|
||||
);
|
||||
let position_lerp_vec3 = hand_transform.translation.lerp(
|
||||
firearm_data.final_aimed_position,
|
||||
(resources.time.delta_seconds() / firearm_data.rebound_time_seconds)
|
||||
(resources.time.delta_seconds()
|
||||
/ firearm_data.rebound_time_seconds)
|
||||
.clamp(0.0, 1.0),
|
||||
);
|
||||
hand_transform.rotation = rotation_lerp_quat;
|
||||
@ -146,12 +167,14 @@ pub fn capture_hand_usage(
|
||||
} else {
|
||||
hand_transform.rotation = hand_transform.rotation.lerp(
|
||||
firearm_data.final_rotation,
|
||||
(resources.time.delta_seconds() / firearm_data.rebound_time_seconds)
|
||||
(resources.time.delta_seconds()
|
||||
/ firearm_data.rebound_time_seconds)
|
||||
.clamp(0.0, 1.0),
|
||||
);
|
||||
hand_transform.translation = hand_transform.translation.lerp(
|
||||
firearm_data.final_position,
|
||||
(resources.time.delta_seconds() / firearm_data.rebound_time_seconds)
|
||||
(resources.time.delta_seconds()
|
||||
/ firearm_data.rebound_time_seconds)
|
||||
.clamp(0.0, 1.0),
|
||||
);
|
||||
}
|
||||
@ -175,13 +198,8 @@ pub fn capture_hand_usage(
|
||||
*firearm_data.recoil_pattern.horizontal.last().expect("FOUND A FIREARM_DATA WITHOUT ANY FIREARM_RECOIL_PATTERN.")
|
||||
},
|
||||
};
|
||||
// TODO: Spawn Bullet & Muzzle flash
|
||||
/*let firing_point_global = firearm_transform.translation().clone();
|
||||
let firint_point_final = firing_point_global + (firearm_transform.forward() * 1.5) + (firearm_transform.up() / 2.5);
|
||||
shoot_bullet(&mut commands, &mut meshes, &mut materials, Transform::from_translation(firint_point_final), firearm_transform.forward() * 10.0, firearm_data.caliber.clone());*/
|
||||
|
||||
let firearm_transform = firearm_transform.clone();
|
||||
// TODO: M4 holdableobject data has a Y ROT of -90. Apply that rotation here if it exists.
|
||||
let firing_point = firearm_transform.translation()
|
||||
+ (firearm_transform.forward()
|
||||
* firearm_data.firing_point.forward)
|
||||
@ -201,7 +219,8 @@ pub fn capture_hand_usage(
|
||||
);
|
||||
// Increment indexes and timers
|
||||
player_firing_info.current_round_index += 1;
|
||||
player_firing_info.last_shot_timestamp = resources.time.elapsed_seconds();
|
||||
player_firing_info.last_shot_timestamp =
|
||||
resources.time.elapsed_seconds();
|
||||
player_firing_info.full_auto_timer.reset();
|
||||
magazine_data.rounds_shot += 1;
|
||||
|
||||
@ -275,8 +294,8 @@ pub fn interact_action(
|
||||
}*/
|
||||
Interactable::Item => {
|
||||
//loot_container_event_writer
|
||||
// .send()
|
||||
},
|
||||
// .send()
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
|
@ -39,7 +39,7 @@ impl Default for PlayerValuesState {
|
||||
max_linear_player_velocity: 20.0,
|
||||
player_acceleration: 20.0,
|
||||
player_jump_force: 1000.0,
|
||||
player_jump_cooldown_s: 0.075,
|
||||
player_jump_cooldown_s: 0.045,
|
||||
player_sprint_speed_multiplier: 3.5,
|
||||
player_crouch_speed_multiplier: 0.25,
|
||||
player_initial_weight: 75.0,
|
||||
|
@ -1,7 +1,10 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::{
|
||||
comps::core::{controller::capture_input, spawners::{player::player_spawner, spawn::SpawnerPlugin}},
|
||||
comps::core::{
|
||||
controller::capture_input,
|
||||
spawners::{player::player_spawner, spawn::SpawnerPlugin},
|
||||
},
|
||||
logic::core::{
|
||||
guns::despawn_shots::{despawn_muzzle_flashes, despawn_stray_bullets},
|
||||
player::{
|
||||
@ -43,7 +46,7 @@ pub fn load_scene(application: &mut App) {
|
||||
application.add_systems(Startup, setup_lighting);
|
||||
application.add_systems(Startup, set_spawn_points);
|
||||
// Update
|
||||
|
||||
|
||||
application.add_systems(Update, capture_input);
|
||||
application.add_systems(Update, sync_player_y_state);
|
||||
application.add_systems(Update, follow_cursor_with_camera);
|
||||
@ -59,4 +62,4 @@ pub fn load_scene(application: &mut App) {
|
||||
//application.add_systems(Update, register_bullet_hits);
|
||||
|
||||
application.add_event::<EquipmentChangeEvent>();
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,15 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::{comps::core::{markers::player::{Player, PlayerData}, spawners::{player::PlayerSpawnPoint, guns::{m4a1_spawner::M4a1SpawnPoint, glock17_spawner::Glock17SpawnPoint}}}, utils};
|
||||
use crate::{
|
||||
comps::core::{
|
||||
markers::player::{Player, PlayerData},
|
||||
spawners::{
|
||||
guns::{glock17_spawner::Glock17SpawnPoint, m4a1_spawner::M4a1SpawnPoint},
|
||||
player::PlayerSpawnPoint,
|
||||
},
|
||||
},
|
||||
utils,
|
||||
};
|
||||
|
||||
pub fn set_spawn_points(mut commands: Commands) {
|
||||
commands.spawn(PlayerSpawnPoint {
|
||||
|
@ -10,5 +10,4 @@ pub fn update_inventory_screen(
|
||||
mut _commands: Commands,
|
||||
//mut event_reader: EventReader<LootContainerEvent>,
|
||||
) {
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,27 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
|
||||
pub fn find_child_in_parent_children(commands: &mut Commands, parent_entity: Entity, descendant_entity: Entity, children: &Query<&Children>) -> bool {
|
||||
pub fn find_child_in_parent_children(
|
||||
commands: &mut Commands,
|
||||
parent_entity: Entity,
|
||||
descendant_entity: Entity,
|
||||
children: &Query<&Children>,
|
||||
) -> bool {
|
||||
let all_children = flatten_if_possible_inf_levels(commands, parent_entity, children);
|
||||
all_children.contains(&descendant_entity)
|
||||
}
|
||||
|
||||
fn flatten_if_possible_inf_levels(commands: &mut Commands, parent_entity: Entity, children: &Query<&Children>) -> Vec<Entity> {
|
||||
fn flatten_if_possible_inf_levels(
|
||||
commands: &mut Commands,
|
||||
parent_entity: Entity,
|
||||
children: &Query<&Children>,
|
||||
) -> Vec<Entity> {
|
||||
let mut all_descendant_entities: Vec<Entity> = Vec::new();
|
||||
let descendants = children.iter_descendants(parent_entity);
|
||||
for descendant in descendants {
|
||||
all_descendant_entities.push(descendant);
|
||||
all_descendant_entities.append(&mut flatten_if_possible_inf_levels(commands, descendant, children));
|
||||
all_descendant_entities.append(&mut flatten_if_possible_inf_levels(
|
||||
commands, descendant, children,
|
||||
));
|
||||
}
|
||||
all_descendant_entities
|
||||
}
|
||||
}
|
||||
|
@ -1,2 +1,2 @@
|
||||
pub mod hierarchy;
|
||||
pub mod rad_deg;
|
||||
pub mod hierarchy;
|
Loading…
Reference in New Issue
Block a user