From 86cd3b049e3c49757334867d7ceace47aae7aeff Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 14 Apr 2024 14:55:00 +0200 Subject: [PATCH] rename settings.rs to var.rs, planning to add more than settings to it --- src/actor.rs | 8 ++++---- src/audio.rs | 10 +++++----- src/camera.rs | 12 ++++++------ src/chat.rs | 10 +++++----- src/effects.rs | 4 ++-- src/hud.rs | 14 +++++++------- src/main.rs | 6 +++--- src/{settings.rs => var.rs} | 0 src/world.rs | 4 ++-- 9 files changed, 34 insertions(+), 34 deletions(-) rename src/{settings.rs => var.rs} (100%) diff --git a/src/actor.rs b/src/actor.rs index 8b38d41..ee0499a 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -2,7 +2,7 @@ use bevy::prelude::*; use bevy_xpbd_3d::prelude::*; use bevy::scene::SceneInstance; use bevy::math::DVec3; -use crate::{actor, audio, camera, chat, commands, effects, hud, nature, settings, world}; +use crate::{actor, audio, camera, chat, commands, effects, hud, nature, var, world}; pub const ENGINE_SPEED_FACTOR: f32 = 30.0; const MAX_TRANSMISSION_DISTANCE: f32 = 60.0; @@ -234,7 +234,7 @@ pub fn update_physics_lifeforms( pub fn handle_input( mut commands: Commands, keyboard_input: Res>, - mut settings: ResMut, + mut settings: ResMut, q_talker: Query<(&chat::Talker, &Transform), (Without, Without)>, player: Query>, q_camera: Query<&Transform, With>, @@ -424,7 +424,7 @@ fn handle_player_death( mut ew_sfx: EventWriter, mut ew_effect: EventWriter, mut log: ResMut, - mut settings: ResMut, + mut settings: ResMut, ) { for death in er_playerdies.read() { if settings.god_mode { @@ -472,7 +472,7 @@ fn handle_player_death( fn handle_damage( mut ew_playerdies: EventWriter, mut q_hp: Query<(&mut HitPoints, Option<&Player>), Changed>, - settings: Res, + settings: Res, ) { for (mut hp, player_maybe) in &mut q_hp { if player_maybe.is_some() { diff --git a/src/audio.rs b/src/audio.rs index 8d800ae..3555e4f 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -1,6 +1,6 @@ use bevy::prelude::*; use bevy::audio::{PlaybackMode, Volume}; -use crate::settings; +use crate::var; const ASSET_CLICK: &str = "sounds/click-button-140881-crop.ogg"; const ASSET_SWITCH: &str = "sounds/typosonic-typing-192811-crop.ogg"; @@ -59,7 +59,7 @@ pub enum Sfx { pub fn setup( mut commands: Commands, - settings: Res, + settings: Res, asset_server: Res, ) { commands.spawn(( @@ -132,7 +132,7 @@ pub fn toggle_bgm( keyboard_input: Res>, mut evwriter_toggle: EventWriter, mut evwriter_sfx: EventWriter, - mut settings: ResMut, + mut settings: ResMut, ) { if keyboard_input.just_pressed(KeyCode::KeyT) { settings.mute_music ^= true; @@ -148,7 +148,7 @@ pub fn toggle_bgm( pub fn play_sfx( mut commands: Commands, - settings: Res, + settings: Res, mut events_sfx: EventReader, sound_click: Res, sound_switch: Res, @@ -200,7 +200,7 @@ pub fn str2sfx(sfx_label: &str) -> Sfx { pub fn update_music( mut events: EventReader, bgm_controller: Query<&AudioSink, With>, - settings: Res, + settings: Res, ) { if !events.is_empty() { events.clear(); diff --git a/src/camera.rs b/src/camera.rs index 725a80a..a642d9d 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -8,7 +8,7 @@ use bevy::transform::TransformSystem; use bevy::math::{DVec3, DQuat}; use bevy_xpbd_3d::prelude::*; use std::f32::consts::PI; -use crate::{actor, audio, hud, settings}; +use crate::{actor, audio, hud, var}; pub struct CameraPlugin; @@ -68,7 +68,7 @@ pub fn setup_camera( } pub fn sync_camera_to_player( - settings: Res, + settings: Res, mut q_camera: Query<&mut Transform, (With, Without)>, q_playercam: Query<(&actor::Actor, &Transform), (With, Without)>, ) { @@ -93,7 +93,7 @@ pub fn sync_camera_to_player( pub fn update_fov( q_player: Query<&actor::ExperiencesGForce, With>, mouse_input: Res>, - mut settings: ResMut, + mut settings: ResMut, mut q_camera: Query<&mut Projection, With>, ) { if let (Ok(gforce), Ok(mut projection)) = (q_player.get_single(), q_camera.get_single_mut()) @@ -116,7 +116,7 @@ pub fn update_fov( pub fn handle_input( keyboard_input: Res>, - mut settings: ResMut, + mut settings: ResMut, mut ew_sfx: EventWriter, ) { if keyboard_input.just_pressed(settings.key_camera) { @@ -129,7 +129,7 @@ pub fn handle_input( } fn manage_player_actor( - settings: Res, + settings: Res, mut q_playercam: Query<&mut Visibility, With>, mut q_hiddenplayer: Query<(&mut Visibility, &mut Position, &mut Rotation, &mut LinearVelocity, &mut AngularVelocity), (With, Without)>, q_ride: Query<(&Transform, &Position, &Rotation, &LinearVelocity, &AngularVelocity), (With, Without)>, @@ -161,7 +161,7 @@ fn manage_player_actor( #[allow(clippy::too_many_arguments)] pub fn apply_input_to_player( time: Res