mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'ubruntu/bird-pathing' into 'master'
Slightly better bird pathing See merge request veloren/veloren!1692
This commit is contained in:
@ -223,8 +223,16 @@ impl<'a> System<'a> for Sys {
|
|||||||
match &mut agent.activity {
|
match &mut agent.activity {
|
||||||
Activity::Idle { bearing, chaser } => {
|
Activity::Idle { bearing, chaser } => {
|
||||||
if let Some(travel_to) = agent.rtsim_controller.travel_to {
|
if let Some(travel_to) = agent.rtsim_controller.travel_to {
|
||||||
//if it has an rtsim destination and can fly then it should
|
// if it has an rtsim destination and can fly then it should
|
||||||
inputs.fly.set_state(traversal_config.can_fly);
|
// 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)) =
|
if let Some((bearing, speed)) =
|
||||||
chaser.chase(&*terrain, pos.0, vel.0, travel_to, TraversalConfig {
|
chaser.chase(&*terrain, pos.0, vel.0, travel_to, TraversalConfig {
|
||||||
min_tgt_dist: 1.25,
|
min_tgt_dist: 1.25,
|
||||||
|
@ -27,8 +27,8 @@ impl Entity {
|
|||||||
|
|
||||||
pub fn get_body(&self) -> comp::Body {
|
pub fn get_body(&self) -> comp::Body {
|
||||||
match self.rng(PERM_GENUS).gen::<f32>() {
|
match self.rng(PERM_GENUS).gen::<f32>() {
|
||||||
//we want 75% birds, 25% humans for now
|
//we want 50% birds, 50% humans for now
|
||||||
x if x < 0.75 => {
|
x if x < 0.50 => {
|
||||||
let species = *(&comp::bird_medium::ALL_SPECIES)
|
let species = *(&comp::bird_medium::ALL_SPECIES)
|
||||||
.choose(&mut self.rng(PERM_SPECIES))
|
.choose(&mut self.rng(PERM_SPECIES))
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -88,7 +88,7 @@ pub fn init(state: &mut State, #[cfg(feature = "worldgen")] world: &world::World
|
|||||||
#[cfg(not(feature = "worldgen"))]
|
#[cfg(not(feature = "worldgen"))]
|
||||||
let mut rtsim = RtSim::new(Vec2::new(40, 40));
|
let mut rtsim = RtSim::new(Vec2::new(40, 40));
|
||||||
|
|
||||||
for _ in 0..10000 {
|
for _ in 0..5000 {
|
||||||
let pos = rtsim
|
let pos = rtsim
|
||||||
.chunks
|
.chunks
|
||||||
.size()
|
.size()
|
||||||
|
Reference in New Issue
Block a user