mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added waypoints outside of dungeons
This commit is contained in:
@ -3,7 +3,7 @@ use crate::{
|
|||||||
column::ColumnSample,
|
column::ColumnSample,
|
||||||
sim::{SimChunk, WorldSim},
|
sim::{SimChunk, WorldSim},
|
||||||
site::BlockMask,
|
site::BlockMask,
|
||||||
util::{attempt, Grid, RandomField, Sampler, StructureGen2d},
|
util::{attempt, DIRS, CARDINALS, Grid, RandomField, Sampler, StructureGen2d},
|
||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
assets,
|
assets,
|
||||||
@ -131,6 +131,19 @@ impl Dungeon {
|
|||||||
max: rpos + TerrainChunkSize::RECT_SIZE.map(|e| e as i32),
|
max: rpos + TerrainChunkSize::RECT_SIZE.map(|e| e as i32),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if area.contains_point(Vec2::zero()) {
|
||||||
|
let offs = Vec2::new(
|
||||||
|
rng.gen_range(-1.0, 1.0),
|
||||||
|
rng.gen_range(-1.0, 1.0),
|
||||||
|
).try_normalized().unwrap_or(Vec2::unit_y()) * 16.0;
|
||||||
|
supplement.add_entity(EntityInfo::at(Vec3::new(
|
||||||
|
self.origin.x,
|
||||||
|
self.origin.y,
|
||||||
|
self.alt + 4,
|
||||||
|
).map(|e| e as f32) + Vec3::from(offs))
|
||||||
|
.into_waypoint());
|
||||||
|
}
|
||||||
|
|
||||||
let mut z = self.alt;
|
let mut z = self.alt;
|
||||||
for floor in &self.floors {
|
for floor in &self.floors {
|
||||||
z -= floor.total_depth();
|
z -= floor.total_depth();
|
||||||
@ -140,24 +153,6 @@ impl Dungeon {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const CARDINALS: [Vec2<i32>; 4] = [
|
|
||||||
Vec2::new(0, 1),
|
|
||||||
Vec2::new(1, 0),
|
|
||||||
Vec2::new(0, -1),
|
|
||||||
Vec2::new(-1, 0),
|
|
||||||
];
|
|
||||||
|
|
||||||
const DIRS: [Vec2<i32>; 8] = [
|
|
||||||
Vec2::new(0, 1),
|
|
||||||
Vec2::new(1, 0),
|
|
||||||
Vec2::new(0, -1),
|
|
||||||
Vec2::new(-1, 0),
|
|
||||||
Vec2::new(1, 1),
|
|
||||||
Vec2::new(1, -1),
|
|
||||||
Vec2::new(-1, 1),
|
|
||||||
Vec2::new(-1, -1),
|
|
||||||
];
|
|
||||||
|
|
||||||
const TILE_SIZE: i32 = 13;
|
const TILE_SIZE: i32 = 13;
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
Reference in New Issue
Block a user