From 94d732d9f0e875fca31afc4b9f4bd3c6df0fce39 Mon Sep 17 00:00:00 2001 From: hut Date: Sun, 12 May 2024 23:42:56 +0200 Subject: [PATCH] simplify crate module imports --- src/actor.rs | 1 - src/audio.rs | 2 +- src/camera.rs | 2 +- src/chat.rs | 2 +- src/cmd.rs | 1 - src/hud.rs | 1 - src/main.rs | 25 +++++++++++++------------ src/menu.rs | 1 - src/visual.rs | 2 +- src/world.rs | 1 - 10 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/actor.rs b/src/actor.rs index e183ea1..8a05d5d 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -19,7 +19,6 @@ use bevy_xpbd_3d::prelude::*; use bevy::scene::SceneInstance; use bevy::math::DVec3; use crate::prelude::*; -use crate::{actor, audio, camera, chat, hud, menu, nature, visual, world}; use std::collections::HashMap; pub const ENGINE_SPEED_FACTOR: f32 = 30.0; diff --git a/src/audio.rs b/src/audio.rs index 689663f..24a6ac8 100644 --- a/src/audio.rs +++ b/src/audio.rs @@ -12,7 +12,7 @@ use bevy::prelude::*; use bevy::audio::{PlaybackMode, Volume}; -use crate::{camera, var}; +use crate::prelude::*; const ASSET_CLICK: &str = "sounds/click-button-140881-crop.ogg"; const ASSET_SWITCH: &str = "sounds/typosonic-typing-192811-crop.ogg"; diff --git a/src/camera.rs b/src/camera.rs index 93aa253..ef3109c 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -24,7 +24,7 @@ use bevy_xpbd_3d::prelude::*; use bevy_xpbd_3d::plugins::sync; use std::f32::consts::PI; use std::f64::consts::PI as PI64; -use crate::{actor, audio, hud, var}; +use crate::prelude::*; pub const INITIAL_ZOOM_LEVEL: f64 = 10.0; diff --git a/src/chat.rs b/src/chat.rs index 2c8861a..cb0b478 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -11,7 +11,7 @@ // This module loads the chat definitions from the YAML files // and manages the flow of conversations. -use crate::{actor, audio, hud, var, visual, world}; +use crate::prelude::*; use bevy::prelude::*; use bevy::math::DVec3; use bevy_xpbd_3d::prelude::*; diff --git a/src/cmd.rs b/src/cmd.rs index b8b01ee..b3c5210 100644 --- a/src/cmd.rs +++ b/src/cmd.rs @@ -16,7 +16,6 @@ use bevy_xpbd_3d::prelude::*; use bevy::math::DVec3; use bevy::pbr::{NotShadowCaster, NotShadowReceiver}; use crate::prelude::*; -use crate::{actor, camera, chat, hud, load, nature, var, world}; use regex::Regex; use std::f32::consts::PI; use std::f64::consts::PI as PI64; diff --git a/src/hud.rs b/src/hud.rs index dafdf3e..685c78c 100644 --- a/src/hud.rs +++ b/src/hud.rs @@ -11,7 +11,6 @@ // This module manages the heads-up display and augmented reality overlays. use crate::prelude::*; -use crate::{actor, audio, camera, chat, nature}; use bevy::pbr::{NotShadowCaster, NotShadowReceiver}; use bevy::prelude::*; use bevy::diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin}; diff --git a/src/main.rs b/src/main.rs index 85f50bf..ce891ef 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,22 +11,23 @@ // This module initializes the game, handles command-line arguments, // and manages window-related key bindings. -mod actor; -mod audio; -mod camera; -mod chat; -mod cmd; -mod hud; -mod load; -mod menu; -mod var; -mod visual; -mod world; +pub mod actor; +pub mod audio; +pub mod camera; +pub mod chat; +pub mod cmd; +pub mod hud; +pub mod load; +pub mod menu; +pub mod var; +pub mod visual; +pub mod world; #[allow(dead_code)] -mod nature; +pub mod nature; pub mod prelude { + pub use crate::{actor, audio, camera, chat, cmd, hud, load, menu, nature, var, visual, world}; pub use crate::var::{FONT, Settings}; pub use crate::load::load_asset; pub fn bool2vis(boolean: bool) -> bevy::prelude::Visibility { diff --git a/src/menu.rs b/src/menu.rs index 0afa997..c296a4d 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -11,7 +11,6 @@ // This plugin manages game menus and the player death screen use crate::prelude::*; -use crate::{audio, hud, visual, world}; use bevy::prelude::*; pub struct MenuPlugin; diff --git a/src/visual.rs b/src/visual.rs index 27d091d..2ad6ce4 100644 --- a/src/visual.rs +++ b/src/visual.rs @@ -11,7 +11,7 @@ // This module manages visual effects. use bevy::prelude::*; -use crate::{camera, var}; +use crate::prelude::*; pub struct VisualPlugin; diff --git a/src/world.rs b/src/world.rs index e852840..05a790b 100644 --- a/src/world.rs +++ b/src/world.rs @@ -11,7 +11,6 @@ // This module populates the world with stars and asteroids. use crate::prelude::*; -use crate::{actor, cmd, hud, load, nature}; use bevy::prelude::*; use bevy::math::{DVec3, I64Vec3}; use bevy::scene::{InstanceId, SceneInstance};