From 34ee2fcc7d3a087192cf943a6d9c57cd5322f7c8 Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Mon, 11 Aug 2025 23:25:04 -0500 Subject: [PATCH] Create a "machinery" module for game systems I'm not sold on the name, but anyway. This module will hold the systems that power the main game mechanics, as well as a few extra items to support that (in particular, the Lifetime component). --- src/lib.rs | 8 ++++---- src/{asteroids.rs => machinery.rs} | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) rename src/{asteroids.rs => machinery.rs} (96%) diff --git a/src/lib.rs b/src/lib.rs index 2627bd8..6880f3c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,18 +1,18 @@ -mod asteroids; pub mod config; mod events; +mod machinery; mod objects; mod physics; mod preparation_widget; mod resources; mod title_screen; -use crate::asteroids::AsteroidSpawner; use crate::config::{ ASTEROID_SMALL_COLOR, BACKGROUND_COLOR, BULLET_COLOR, BULLET_LIFETIME, BULLET_SPEED, PLAYER_SHIP_COLOR, SHIP_ROTATION, SHIP_THRUST, SHIP_THRUSTER_COLOR_ACTIVE, SHIP_THRUSTER_COLOR_INACTIVE, WINDOW_SIZE, }; +use crate::machinery::AsteroidSpawner; use crate::objects::{Bullet, Ship}; use crate::physics::AngularVelocity; @@ -56,8 +56,8 @@ impl Plugin for AsteroidPlugin { input_ship_rotation, input_ship_shoot, physics::wrap_entities, - asteroids::tick_asteroid_manager, - objects::spawn_asteroid.after(asteroids::tick_asteroid_manager), + machinery::tick_asteroid_manager, + objects::spawn_asteroid.after(machinery::tick_asteroid_manager), objects::split_asteroids, objects::bullet_impact_listener, objects::ship_impact_listener, diff --git a/src/asteroids.rs b/src/machinery.rs similarity index 96% rename from src/asteroids.rs rename to src/machinery.rs index 06cf0fb..57dbd00 100644 --- a/src/asteroids.rs +++ b/src/machinery.rs @@ -1,5 +1,4 @@ -//! This is the module containing all the rock-related things. -//! Not... not the whole game. +//! These are Systems that power the main game mechanics (and some misc items to support them) use rand::{Rng, SeedableRng}; use std::time::Duration;