rename effects.rs to visual.rs

This commit is contained in:
yuni 2024-05-10 10:37:40 +02:00
parent 932a54b460
commit 83f43ee06c
4 changed files with 18 additions and 18 deletions

View file

@ -18,7 +18,7 @@ use bevy::prelude::*;
use bevy_xpbd_3d::prelude::*; use bevy_xpbd_3d::prelude::*;
use bevy::scene::SceneInstance; use bevy::scene::SceneInstance;
use bevy::math::DVec3; use bevy::math::DVec3;
use crate::{actor, audio, camera, chat, commands, effects, hud, nature, var, world}; use crate::{actor, audio, camera, chat, commands, hud, nature, var, visual, world};
use std::collections::HashMap; use std::collections::HashMap;
pub const ENGINE_SPEED_FACTOR: f32 = 30.0; pub const ENGINE_SPEED_FACTOR: f32 = 30.0;
@ -506,7 +506,7 @@ fn handle_player_death(
mut scene_spawner: ResMut<SceneSpawner>, mut scene_spawner: ResMut<SceneSpawner>,
mut active_asteroids: ResMut<world::ActiveAsteroids>, mut active_asteroids: ResMut<world::ActiveAsteroids>,
mut ew_sfx: EventWriter<audio::PlaySfxEvent>, mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
mut ew_effect: EventWriter<effects::SpawnEffectEvent>, mut ew_effect: EventWriter<visual::SpawnEffectEvent>,
mut log: ResMut<hud::Log>, mut log: ResMut<hud::Log>,
mut settings: ResMut<var::Settings>, mut settings: ResMut<var::Settings>,
) { ) {
@ -528,22 +528,22 @@ fn handle_player_death(
match death.0 { match death.0 {
DamageType::Mental => { DamageType::Mental => {
ew_effect.send(effects::SpawnEffectEvent { ew_effect.send(visual::SpawnEffectEvent {
class: effects::Effects::FadeIn(Color::BLACK), class: visual::Effects::FadeIn(Color::BLACK),
duration: 4.0, duration: 4.0,
}); });
} }
DamageType::Asphyxiation => { DamageType::Asphyxiation => {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp)); ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp));
ew_effect.send(effects::SpawnEffectEvent { ew_effect.send(visual::SpawnEffectEvent {
class: effects::Effects::FadeIn(Color::BLACK), class: visual::Effects::FadeIn(Color::BLACK),
duration: 1.0, duration: 1.0,
}); });
} }
DamageType::Trauma | _ => { DamageType::Trauma | _ => {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp)); ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp));
ew_effect.send(effects::SpawnEffectEvent { ew_effect.send(visual::SpawnEffectEvent {
class: effects::Effects::FadeIn(Color::MAROON), class: visual::Effects::FadeIn(Color::MAROON),
duration: 1.0, duration: 1.0,
}); });
} }

View file

@ -11,7 +11,7 @@
// This module loads the chat definitions from the YAML files // This module loads the chat definitions from the YAML files
// and manages the flow of conversations. // and manages the flow of conversations.
use crate::{actor, audio, effects, hud, var, world}; use crate::{actor, audio, hud, var, visual, world};
use bevy::prelude::*; use bevy::prelude::*;
use bevy::math::DVec3; use bevy::math::DVec3;
use bevy_xpbd_3d::prelude::*; use bevy_xpbd_3d::prelude::*;
@ -791,7 +791,7 @@ pub fn handle_chat_scripts(
mut q_player: Query<(&mut actor::Actor, &mut actor::Suit, &mut actor::ExperiencesGForce), With<actor::Player>>, mut q_player: Query<(&mut actor::Actor, &mut actor::Suit, &mut actor::ExperiencesGForce), With<actor::Player>>,
mut q_playercam: Query<(&mut Position, &mut LinearVelocity), With<actor::PlayerCamera>>, mut q_playercam: Query<(&mut Position, &mut LinearVelocity), With<actor::PlayerCamera>>,
mut ew_sfx: EventWriter<audio::PlaySfxEvent>, mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
mut ew_effect: EventWriter<effects::SpawnEffectEvent>, mut ew_effect: EventWriter<visual::SpawnEffectEvent>,
id2pos: Res<actor::Id2Pos>, id2pos: Res<actor::Id2Pos>,
) { ) {
for script in er_chatscript.read() { for script in er_chatscript.read() {
@ -871,15 +871,15 @@ pub fn handle_chat_scripts(
gforce.ignore_gforce_seconds = 1.0; gforce.ignore_gforce_seconds = 1.0;
} }
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp)); ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::WakeUp));
ew_effect.send(effects::SpawnEffectEvent { ew_effect.send(visual::SpawnEffectEvent {
class: effects::Effects::FadeIn(Color::CYAN), class: visual::Effects::FadeIn(Color::CYAN),
duration: 1.0, duration: 1.0,
}); });
} }
} }
"cryofadeout" => { "cryofadeout" => {
ew_effect.send(effects::SpawnEffectEvent { ew_effect.send(visual::SpawnEffectEvent {
class: effects::Effects::FadeOut(Color::CYAN), class: visual::Effects::FadeOut(Color::CYAN),
duration: 5.1, duration: 5.1,
}); });
} }

View file

@ -16,10 +16,10 @@ mod audio;
mod camera; mod camera;
mod chat; mod chat;
mod commands; mod commands;
mod effects;
mod hud; mod hud;
mod load; mod load;
mod var; mod var;
mod visual;
mod world; mod world;
#[allow(dead_code)] #[allow(dead_code)]
@ -128,7 +128,7 @@ impl Plugin for OutFlyPlugin {
camera::CameraPlugin, camera::CameraPlugin,
chat::ChatPlugin, chat::ChatPlugin,
commands::CommandsPlugin, commands::CommandsPlugin,
effects::EffectsPlugin, visual::VisualPlugin,
hud::HudPlugin, hud::HudPlugin,
load::LoadPlugin, load::LoadPlugin,
world::WorldPlugin, world::WorldPlugin,

View file

@ -13,9 +13,9 @@
use bevy::prelude::*; use bevy::prelude::*;
use crate::{camera, var}; use crate::{camera, var};
pub struct EffectsPlugin; pub struct VisualPlugin;
impl Plugin for EffectsPlugin { impl Plugin for VisualPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_systems(Startup, setup); app.add_systems(Startup, setup);
app.add_systems(Startup, spawn_effects.after(setup).after(camera::setup_camera)); app.add_systems(Startup, spawn_effects.after(setup).after(camera::setup_camera));