wyvern_tweaks

This commit is contained in:
flo 2023-08-16 09:22:04 +00:00
parent 21bf0a5572
commit a2b1097df8
2 changed files with 16 additions and 24 deletions

View File

@ -382,7 +382,7 @@ impl<'a> From<&'a Body> for Psyche {
}, },
}, },
sight_dist: match body { sight_dist: match body {
Body::BirdLarge(_) => 80.0, Body::BirdLarge(_) => 100.0,
_ => 40.0, _ => 40.0,
}, },
listen_dist: 30.0, listen_dist: 30.0,

View File

@ -414,8 +414,8 @@ fn goto_2d_flying<S: State>(
height_offset: f32, height_offset: f32,
) -> impl Action<S> { ) -> impl Action<S> {
now(move |ctx, _| { now(move |ctx, _| {
let wpos = wpos2d let wpos =
.with_z(ctx.world.sim().get_alt_approx(wpos2d.as_()).unwrap_or(0.0) + height_offset); wpos2d.with_z(ctx.world.sim().get_surface_alt_approx(wpos2d.as_()) + height_offset);
goto_flying( goto_flying(
wpos, wpos,
speed_factor, speed_factor,
@ -1155,27 +1155,23 @@ fn bird_large() -> impl Action<DefaultState> {
let bearing_dist = 24.0; let bearing_dist = 24.0;
let mut pos = ctx.npc.wpos.xy() + *bearing * bearing_dist; let mut pos = ctx.npc.wpos.xy() + *bearing * bearing_dist;
let is_deep_water = ctx let is_deep_water = ctx
.world
.sim()
.get_interpolated(pos.as_(), |c| c.alt - c.water_alt)
.unwrap_or(f32::NEG_INFINITY)
< -120.0
&& ctx
.world .world
.sim() .sim()
.get(pos.as_().wpos_to_cpos()) .get(pos.as_().wpos_to_cpos())
.map_or(false, |c| c.river.is_ocean() || c.river.is_lake()); .map_or(true, |c| {
c.alt - c.water_alt < -120.0 && (c.river.is_ocean() || c.river.is_lake())
});
// when high tree_density fly high, otherwise fly low-mid // when high tree_density fly high, otherwise fly low-mid
let npc_pos = ctx.npc.wpos.xy(); let npc_pos = ctx.npc.wpos.xy();
let tree_density = ctx let trees = ctx
.world .world
.sim() .sim()
.get_interpolated(npc_pos.as_(), |c| c.tree_density) .get(npc_pos.as_().wpos_to_cpos())
.unwrap_or(1.0); .map_or(false, |c| c.tree_density > 0.1);
let height_factor = if tree_density > 0.1 { let height_factor = if trees {
2.0 2.0
} else { } else {
ctx.rng.gen_range(0.1..0.5) ctx.rng.gen_range(0.4..0.9)
}; };
if !is_deep_water { if !is_deep_water {
goto_2d_flying( goto_2d_flying(
@ -1226,16 +1222,12 @@ fn monster() -> impl Action<DefaultState> {
let bearing_dist = 24.0; let bearing_dist = 24.0;
let mut pos = ctx.npc.wpos.xy() + *bearing * bearing_dist; let mut pos = ctx.npc.wpos.xy() + *bearing * bearing_dist;
let is_deep_water = ctx let is_deep_water = ctx
.world
.sim()
.get_interpolated(pos.as_(), |c| c.alt - c.water_alt)
.unwrap_or(f32::NEG_INFINITY)
< -10.0
&& ctx
.world .world
.sim() .sim()
.get(pos.as_().wpos_to_cpos()) .get(pos.as_().wpos_to_cpos())
.map_or(false, |c| c.river.is_ocean() || c.river.is_lake()); .map_or(true, |c| {
c.alt - c.water_alt < -10.0 && (c.river.is_ocean() || c.river.is_lake())
});
if !is_deep_water { if !is_deep_water {
goto_2d(pos, 0.7, 8.0) goto_2d(pos, 0.7, 8.0)
} else { } else {