Slightly better bird pathing

This commit is contained in:
ubruntu 2021-01-15 00:42:57 +00:00 committed by Joshua Barretto
parent 69476f46af
commit 74d17ff4c8
3 changed files with 13 additions and 5 deletions

View File

@ -223,8 +223,16 @@ impl<'a> System<'a> for Sys {
match &mut agent.activity {
Activity::Idle { bearing, chaser } => {
if let Some(travel_to) = agent.rtsim_controller.travel_to {
//if it has an rtsim destination and can fly then it should
inputs.fly.set_state(traversal_config.can_fly);
// if it has an rtsim destination and can fly then it should
// if it is flying and bumps something above it then it should move down
inputs.fly.set_state(traversal_config.can_fly && !terrain
.ray(
pos.0,
pos.0 + (Vec3::unit_z() * 3.0))
.until(Block::is_solid)
.cast()
.1
.map_or(true, |b| b.is_some()));
if let Some((bearing, speed)) =
chaser.chase(&*terrain, pos.0, vel.0, travel_to, TraversalConfig {
min_tgt_dist: 1.25,

View File

@ -27,8 +27,8 @@ impl Entity {
pub fn get_body(&self) -> comp::Body {
match self.rng(PERM_GENUS).gen::<f32>() {
//we want 75% birds, 25% humans for now
x if x < 0.75 => {
//we want 50% birds, 50% humans for now
x if x < 0.50 => {
let species = *(&comp::bird_medium::ALL_SPECIES)
.choose(&mut self.rng(PERM_SPECIES))
.unwrap();

View File

@ -88,7 +88,7 @@ pub fn init(state: &mut State, #[cfg(feature = "worldgen")] world: &world::World
#[cfg(not(feature = "worldgen"))]
let mut rtsim = RtSim::new(Vec2::new(40, 40));
for _ in 0..10000 {
for _ in 0..5000 {
let pos = rtsim
.chunks
.size()