Skip to content

Commit

Permalink
update some names and comments
Browse files Browse the repository at this point in the history
  • Loading branch information
reeceyang committed Jan 1, 2024
1 parent c12ea0a commit 6d06c06
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions simulation/src/wildlife/bird.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use geom::angle_lerpxy;
use geom::AABB;
use geom::{Transform, Vec3};

/// spawns a bird in the world
pub fn spawn_bird(sim: &mut Simulation, spawn_pos: Vec3) -> Option<BirdID> {
profiling::scope!("spawn_bird");

Expand All @@ -22,8 +23,9 @@ pub fn spawn_bird(sim: &mut Simulation, spawn_pos: Vec3) -> Option<BirdID> {
Some(id)
}

/// Update the movement of each bird in the world
pub fn bird_decision_system(world: &mut World, resources: &mut Resources) {
profiling::scope!("wildlife::animal_decision_system");
profiling::scope!("wildlife::bird_decision_system");
let ra = &*resources.read::<GameTime>();
let map = &*resources.read::<Map>();

Expand Down Expand Up @@ -60,7 +62,7 @@ pub fn bird_decision_system(world: &mut World, resources: &mut Resources) {
});
}

/// Update the speed, position, and direction of a bird
/// Update the speed, position, and direction of a bird using the boids algorithm
pub fn bird_decision(
time: &GameTime,
trans: &mut Transform,
Expand Down Expand Up @@ -141,7 +143,7 @@ fn bounds_adjustment(trans: &Transform, aabb: AABB) -> Vec3 {
const MAX_Z: f32 = 200.0;
const TURN_AMOUNT: f32 = 1.0;
let mut v = Vec3::new(0.0, 0.0, 0.0);
// TODO: the ground might not be at 0
// TODO: the ground might not be at z: 0
if trans.position.z < MARGIN {
v.z += TURN_AMOUNT;
}
Expand Down
2 changes: 1 addition & 1 deletion simulation/src/wildlife/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const NUM_FLOCKS: u32 = 20;
const BIRDS_PER_FLOCK: u32 = 50;
const SPAWN_RANGE: f32 = 5.0; // how spread out birds in the flock should be initially

/// HACK (for now): spawns birds in random clusters around the map
/// spawns birds in random clusters around the map
pub(crate) fn add_flocks_randomly(sim: &mut Simulation) {
profiling::scope!("wildlife::add_flocks_randomly");

Expand Down

0 comments on commit 6d06c06

Please sign in to comment.