mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fix airships getting stuck in trees and campfires spawning too close to new-style dungeon stairs.
This commit is contained in:
parent
97912d2d0f
commit
c4a6875133
@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
- Server kicks old client when a user is trying to log in again (often the case when a user's original connection gets dropped)
|
- Server kicks old client when a user is trying to log in again (often the case when a user's original connection gets dropped)
|
||||||
- Added a raycast check to beams to prevent their effect applying through walls
|
- Added a raycast check to beams to prevent their effect applying through walls
|
||||||
|
- Flying agents raycast more angles to check for obstacles.
|
||||||
|
|
||||||
## [0.9.0] - 2021-03-20
|
## [0.9.0] - 2021-03-20
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
.map(|e| e as f32)
|
.map(|e| e as f32)
|
||||||
+ Vec3::new(0.5, 0.5, 0.0);
|
+ Vec3::new(0.5, 0.5, 0.0);
|
||||||
let body = entity.get_body();
|
let body = entity.get_body();
|
||||||
let pos = comp::Pos(spawn_pos);
|
let mut pos = comp::Pos(spawn_pos);
|
||||||
let agent = Some(comp::Agent::new(
|
let agent = Some(comp::Agent::new(
|
||||||
None,
|
None,
|
||||||
matches!(body, comp::Body::Humanoid(_)),
|
matches!(body, comp::Body::Humanoid(_)),
|
||||||
@ -112,12 +112,15 @@ impl<'a> System<'a> for Sys {
|
|||||||
));
|
));
|
||||||
let rtsim_entity = Some(RtSimEntity(id));
|
let rtsim_entity = Some(RtSimEntity(id));
|
||||||
let event = match body {
|
let event = match body {
|
||||||
comp::Body::Ship(ship) => ServerEvent::CreateShip {
|
comp::Body::Ship(ship) => {
|
||||||
pos,
|
pos.0 += Vec3::unit_z() * body.flying_height();
|
||||||
ship,
|
ServerEvent::CreateShip {
|
||||||
mountable: false,
|
pos,
|
||||||
agent,
|
ship,
|
||||||
rtsim_entity,
|
mountable: false,
|
||||||
|
agent,
|
||||||
|
rtsim_entity,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
_ => ServerEvent::CreateNpc {
|
_ => ServerEvent::CreateNpc {
|
||||||
pos: comp::Pos(spawn_pos),
|
pos: comp::Pos(spawn_pos),
|
||||||
|
@ -680,7 +680,7 @@ impl<'a> AgentData<'a> {
|
|||||||
.cast()
|
.cast()
|
||||||
.1
|
.1
|
||||||
.map_or(true, |b| b.is_some());
|
.map_or(true, |b| b.is_some());
|
||||||
let ground_too_close = self
|
let mut ground_too_close = self
|
||||||
.body
|
.body
|
||||||
.map(|body| {
|
.map(|body| {
|
||||||
let height_approx = self.pos.0.y
|
let height_approx = self.pos.0.y
|
||||||
@ -691,19 +691,32 @@ impl<'a> AgentData<'a> {
|
|||||||
.unwrap_or(0.0);
|
.unwrap_or(0.0);
|
||||||
|
|
||||||
height_approx < body.flying_height()
|
height_approx < body.flying_height()
|
||||||
|| read_data
|
|
||||||
.terrain
|
|
||||||
.ray(
|
|
||||||
self.pos.0,
|
|
||||||
self.pos.0 - body.flying_height() * Vec3::unit_z(),
|
|
||||||
)
|
|
||||||
.until(|b: &Block| b.is_solid() || b.is_liquid())
|
|
||||||
.cast()
|
|
||||||
.1
|
|
||||||
.map_or(false, |b| b.is_some())
|
|
||||||
})
|
})
|
||||||
.unwrap_or(false);
|
.unwrap_or(false);
|
||||||
|
|
||||||
|
const NUM_RAYS: usize = 5;
|
||||||
|
for i in 0..=NUM_RAYS {
|
||||||
|
let magnitude = self.body.map_or(20.0, |b| b.flying_height());
|
||||||
|
// Lerp between a line straight ahead and straight down to detect a
|
||||||
|
// wedge of obstacles we might fly into (inclusive so that both vectors
|
||||||
|
// are sampled)
|
||||||
|
if let Some(dir) = Lerp::lerp(
|
||||||
|
-Vec3::unit_z(),
|
||||||
|
Vec3::new(bearing.x, bearing.y, 0.0),
|
||||||
|
i as f32 / NUM_RAYS as f32,
|
||||||
|
)
|
||||||
|
.try_normalized()
|
||||||
|
{
|
||||||
|
ground_too_close |= read_data
|
||||||
|
.terrain
|
||||||
|
.ray(self.pos.0, self.pos.0 + magnitude * dir)
|
||||||
|
.until(|b: &Block| b.is_solid() || b.is_liquid())
|
||||||
|
.cast()
|
||||||
|
.1
|
||||||
|
.map_or(false, |b| b.is_some())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if obstacle_ahead || ground_too_close {
|
if obstacle_ahead || ground_too_close {
|
||||||
1.0 //fly up when approaching obstacles
|
1.0 //fly up when approaching obstacles
|
||||||
} else {
|
} else {
|
||||||
|
@ -201,7 +201,7 @@ impl Dungeon {
|
|||||||
let pos = self.origin.map2(FLOOR_SIZE, |e, sz| e + sz as i32 / 2);
|
let pos = self.origin.map2(FLOOR_SIZE, |e, sz| e + sz as i32 / 2);
|
||||||
if area.contains_point(pos - self.origin) {
|
if area.contains_point(pos - self.origin) {
|
||||||
supplement.add_entity(
|
supplement.add_entity(
|
||||||
EntityInfo::at(Vec3::new(pos.x as f32, pos.y as f32, self.alt as f32) + 2.5)
|
EntityInfo::at(Vec3::new(pos.x as f32, pos.y as f32, self.alt as f32) + 5.0)
|
||||||
.into_waypoint(),
|
.into_waypoint(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user