diff --git a/engine/src/gent.rs b/engine/src/gent.rs index eca64cf9..d92eba24 100644 --- a/engine/src/gent.rs +++ b/engine/src/gent.rs @@ -21,7 +21,7 @@ pub struct GentPhysicsBundle { pub linear_velocity: LinearVelocity, } -#[derive(Component)] +#[derive(Component, Debug)] pub struct Gent { pub e_gfx: Entity, pub e_effects_gfx: Entity, diff --git a/game/src/game/enemy.rs b/game/src/game/enemy.rs index 6ef92f90..f2041163 100644 --- a/game/src/game/enemy.rs +++ b/game/src/game/enemy.rs @@ -17,10 +17,11 @@ use theseeker_engine::script::ScriptPlayer; use super::physics::Knockback; use super::player::{Player, PlayerConfig, StatusModifier, Stealthing}; +use crate::game::attack::arc_attack::Projectile; use crate::game::attack::particles::ArcParticleEffectHandle; use crate::game::attack::*; use crate::game::gentstate::*; -use crate::game::{attack::arc_attack::Projectile, player::EnemiesNearby}; +use crate::game::player::EnemiesNearby; use crate::graphics::particles_util::BuildParticles; use crate::prelude::*; @@ -69,7 +70,7 @@ pub enum EnemyStateSet { #[derive(Bundle, LdtkEntity, Default)] pub struct EnemyBlueprintBundle { - marker: EnemyBlueprint, + pub(crate) marker: EnemyBlueprint, } #[derive(Bundle, LdtkEntity, Default)] @@ -104,7 +105,7 @@ impl EnemySpawner { #[component(storage = "SparseSet")] pub struct EnemyBlueprint { /// Hp added from spawner due to number of enemies killed. - bonus_hp: u32, + pub(crate) bonus_hp: u32, } #[derive(Bundle)] @@ -572,7 +573,7 @@ fn check_player_range( if let Ok((player_e, player_trans, player_stealth, mut enemies_nearby)) = player_query.get_single_mut() { - //reset every tick + // reset every tick **enemies_nearby = 0; for ( @@ -586,7 +587,7 @@ fn check_player_range( is_defending, ) in query.iter_mut() { - //TODO: still update enemies nearby in stealth? + // TODO: still update enemies nearby in stealth? if player_stealth.is_some() { *range = Range::Deaggro; target.0 = None; @@ -799,9 +800,11 @@ fn aggro( transitions.push(Aggroed::new_transition(Patrolling)); } else if matches!(range, Range::Melee) { match role { - Role::Melee => transitions.push(Waiting::new_transition( - MeleeAttack::default(), - )), + Role::Melee => { + transitions.push(Waiting::new_transition( + MeleeAttack::default(), + )) + }, Role::Ranged => { velocity.x = 0.; transitions.push(Waiting::new_transition( diff --git a/game/src/game/player/mod.rs b/game/src/game/player/mod.rs index 28908957..dded41dc 100644 --- a/game/src/game/player/mod.rs +++ b/game/src/game/player/mod.rs @@ -21,8 +21,9 @@ use theseeker_engine::physics::{ }; use super::physics::Knockback; +use crate::game::attack::*; use crate::game::gentstate::*; -use crate::game::{attack::*, xp_orbs::XpOrbPickup}; +use crate::game::xp_orbs::XpOrbPickup; use crate::prelude::*; pub struct PlayerPlugin; @@ -50,7 +51,10 @@ impl Plugin for PlayerPlugin { app.add_systems(Startup, load_dash_asset); app.add_systems( GameTickUpdate, - ((setup_player, despawn_dead_player) + (( + setup_player, + despawn_dead_player.after(super::game_over::on_game_over), + ) .run_if(in_state(GameState::Playing))) .before(PlayerStateSet::Transition) .run_if(in_state(AppState::InGame)), @@ -180,7 +184,7 @@ impl Passives { } } -//they could also be components...limit only by the pickup/gain function instead of sized hashmap +// they could also be components...limit only by the pickup/gain function instead of sized hashmap #[derive(Debug, Eq, PartialEq, Hash, EnumIter)] pub enum Passive { /// Heal when killing an enemy @@ -423,7 +427,7 @@ fn setup_player( ), ( PlayerStats::init_from_config(&config), - //maybe consolidate with PlayerStats + // maybe consolidate with PlayerStats PlayerStatMod::new(), EnemiesNearby(0), ), @@ -533,7 +537,7 @@ pub struct Attacking { impl Attacking { pub const MAX: u32 = 4; // pub const MAX: u32 = 4; - //minimum amount of frames that should be played from attack animation + // minimum amount of frames that should be played from attack animation pub const MIN: u32 = 2; } impl GentState for Attacking {} @@ -1147,7 +1151,7 @@ fn player_update_passive_buffs( defense *= 0.5; } if passives.contains(&Passive::HeavyBoots) { - //if we are moving + // if we are moving if vel.length() > 0.0001 { attack *= 0.5; defense *= 0.5; @@ -1178,7 +1182,7 @@ fn player_update_stats_mod( &mut PlayerStats, )>, mut gfx_query: Query<(&PlayerGfx, &mut Sprite)>, - //TODO: switch to ticks + // TODO: switch to ticks time: Res>, mut commands: Commands, ) { @@ -1195,7 +1199,7 @@ fn player_update_stats_mod( sprite.color = modifier.effect_col; - //TODO: switch to ticks + // TODO: switch to ticks modifier.time_remaining -= time.delta_seconds(); if modifier.time_remaining < 0. { @@ -1442,7 +1446,7 @@ fn track_hits( mut damage_events: EventReader, ) { if let Ok((player_e, passives, mut buff)) = query.get_single_mut() { - //tick falloff + // tick falloff buff.falloff = buff.falloff.saturating_sub(1); if passives.contains(&Passive::FrenziedAttack) { for damage_info in damage_events.read() {