mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Merge branch 'campfires_for_clifftown_and_desertcity' into 'master'
add campfires to clifftown and desertcity See merge request veloren/veloren!3538
This commit is contained in:
commit
14aad5fde7
@ -744,17 +744,17 @@ impl Site {
|
|||||||
|
|
||||||
pub fn generate_cliff_town(land: &Land, rng: &mut impl Rng, origin: Vec2<i32>) -> Self {
|
pub fn generate_cliff_town(land: &Land, rng: &mut impl Rng, origin: Vec2<i32>) -> Self {
|
||||||
let mut rng = reseed(rng);
|
let mut rng = reseed(rng);
|
||||||
|
|
||||||
let mut site = Site {
|
let mut site = Site {
|
||||||
origin,
|
origin,
|
||||||
name: NameGen::location(&mut rng).generate_arabic(),
|
name: NameGen::location(&mut rng).generate_arabic(),
|
||||||
..Site::default()
|
..Site::default()
|
||||||
};
|
};
|
||||||
|
let mut campfires = 0;
|
||||||
site.make_plaza(land, &mut rng);
|
site.make_plaza(land, &mut rng);
|
||||||
for _ in 0..30 {
|
for _ in 0..30 {
|
||||||
// CliffTower
|
// CliffTower
|
||||||
let size = (6.0 + rng.gen::<f32>().powf(5.0) * 1.0).round() as u32;
|
let size = (6.0 + rng.gen::<f32>().powf(5.0) * 1.0).round() as u32;
|
||||||
|
let campfire = campfires < 4;
|
||||||
if let Some((aabr, door_tile, door_dir)) = attempt(32, || {
|
if let Some((aabr, door_tile, door_dir)) = attempt(32, || {
|
||||||
site.find_roadside_aabr(&mut rng, 6..(size + 1).pow(2), Extent2::broadcast(size))
|
site.find_roadside_aabr(&mut rng, 6..(size + 1).pow(2), Extent2::broadcast(size))
|
||||||
}) {
|
}) {
|
||||||
@ -765,6 +765,7 @@ impl Site {
|
|||||||
door_tile,
|
door_tile,
|
||||||
door_dir,
|
door_dir,
|
||||||
aabr,
|
aabr,
|
||||||
|
campfire,
|
||||||
);
|
);
|
||||||
let cliff_tower_alt = cliff_tower.alt;
|
let cliff_tower_alt = cliff_tower.alt;
|
||||||
let plot = site.create_plot(Plot {
|
let plot = site.create_plot(Plot {
|
||||||
@ -779,6 +780,7 @@ impl Site {
|
|||||||
plot: Some(plot),
|
plot: Some(plot),
|
||||||
hard_alt: Some(cliff_tower_alt),
|
hard_alt: Some(cliff_tower_alt),
|
||||||
});
|
});
|
||||||
|
campfires += 1;
|
||||||
} else {
|
} else {
|
||||||
site.make_plaza(land, &mut rng);
|
site.make_plaza(land, &mut rng);
|
||||||
}
|
}
|
||||||
@ -803,12 +805,14 @@ impl Site {
|
|||||||
let build_chance = Lottery::from(vec![(20.0, 1), (10.0, 2)]);
|
let build_chance = Lottery::from(vec![(20.0, 1), (10.0, 2)]);
|
||||||
|
|
||||||
let mut temples = 0;
|
let mut temples = 0;
|
||||||
|
let mut campfires = 0;
|
||||||
|
|
||||||
for _ in 0..30 {
|
for _ in 0..30 {
|
||||||
match *build_chance.choose_seeded(rng.gen()) {
|
match *build_chance.choose_seeded(rng.gen()) {
|
||||||
// DesertCityMultiplot
|
// DesertCityMultiplot
|
||||||
1 => {
|
1 => {
|
||||||
let size = (9.0 + rng.gen::<f32>().powf(5.0) * 1.5).round() as u32;
|
let size = (9.0 + rng.gen::<f32>().powf(5.0) * 1.5).round() as u32;
|
||||||
|
let campfire = campfires < 4;
|
||||||
if let Some((aabr, door_tile, door_dir)) = attempt(32, || {
|
if let Some((aabr, door_tile, door_dir)) = attempt(32, || {
|
||||||
site.find_roadside_aabr(
|
site.find_roadside_aabr(
|
||||||
&mut rng,
|
&mut rng,
|
||||||
@ -823,6 +827,7 @@ impl Site {
|
|||||||
door_tile,
|
door_tile,
|
||||||
door_dir,
|
door_dir,
|
||||||
aabr,
|
aabr,
|
||||||
|
campfire,
|
||||||
);
|
);
|
||||||
let desert_city_multi_plot_alt = desert_city_multi_plot.alt;
|
let desert_city_multi_plot_alt = desert_city_multi_plot.alt;
|
||||||
let plot = site.create_plot(Plot {
|
let plot = site.create_plot(Plot {
|
||||||
@ -837,6 +842,7 @@ impl Site {
|
|||||||
plot: Some(plot),
|
plot: Some(plot),
|
||||||
hard_alt: Some(desert_city_multi_plot_alt),
|
hard_alt: Some(desert_city_multi_plot_alt),
|
||||||
});
|
});
|
||||||
|
campfires += 1;
|
||||||
} else {
|
} else {
|
||||||
site.make_plaza(land, &mut rng);
|
site.make_plaza(land, &mut rng);
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,7 @@ pub struct CliffTower {
|
|||||||
bounds: Aabr<i32>,
|
bounds: Aabr<i32>,
|
||||||
/// Approximate altitude of the door tile
|
/// Approximate altitude of the door tile
|
||||||
pub(crate) alt: i32,
|
pub(crate) alt: i32,
|
||||||
|
campfire: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl CliffTower {
|
impl CliffTower {
|
||||||
@ -27,6 +28,7 @@ impl CliffTower {
|
|||||||
door_tile: Vec2<i32>,
|
door_tile: Vec2<i32>,
|
||||||
door_dir: Vec2<i32>,
|
door_dir: Vec2<i32>,
|
||||||
tile_aabr: Aabr<i32>,
|
tile_aabr: Aabr<i32>,
|
||||||
|
campfire: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let bounds = Aabr {
|
let bounds = Aabr {
|
||||||
min: site.tile_wpos(tile_aabr.min),
|
min: site.tile_wpos(tile_aabr.min),
|
||||||
@ -35,6 +37,7 @@ impl CliffTower {
|
|||||||
Self {
|
Self {
|
||||||
bounds,
|
bounds,
|
||||||
alt: land.get_alt_approx(site.tile_center_wpos(door_tile + door_dir)) as i32,
|
alt: land.get_alt_approx(site.tile_center_wpos(door_tile + door_dir)) as i32,
|
||||||
|
campfire,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -894,5 +897,10 @@ impl Structure for CliffTower {
|
|||||||
mem::swap(&mut length, &mut width);
|
mem::swap(&mut length, &mut width);
|
||||||
mem::swap(&mut stair_pos1, &mut stair_pos2);
|
mem::swap(&mut stair_pos1, &mut stair_pos2);
|
||||||
}
|
}
|
||||||
|
// spawn campfire next to some clifftowers
|
||||||
|
if self.campfire {
|
||||||
|
let campfire_pos = (center - 20).with_z(self.alt + 18);
|
||||||
|
painter.spawn(EntityInfo::at(campfire_pos.map(|e| e as f32)).into_waypoint());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,9 @@ use crate::{
|
|||||||
util::{RandomField, Sampler, DIAGONALS, NEIGHBORS},
|
util::{RandomField, Sampler, DIAGONALS, NEIGHBORS},
|
||||||
Land,
|
Land,
|
||||||
};
|
};
|
||||||
use common::terrain::{
|
use common::{
|
||||||
Block, BlockKind, SpriteKind, Structure as PrefabStructure, StructuresGroup,
|
generation::EntityInfo,
|
||||||
|
terrain::{Block, BlockKind, SpriteKind, Structure as PrefabStructure, StructuresGroup},
|
||||||
};
|
};
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
@ -44,6 +45,7 @@ pub struct DesertCityMultiPlot {
|
|||||||
pub(crate) alt: i32,
|
pub(crate) alt: i32,
|
||||||
diameter: i32,
|
diameter: i32,
|
||||||
plot_kind: PlotKind,
|
plot_kind: PlotKind,
|
||||||
|
campfire: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl DesertCityMultiPlot {
|
impl DesertCityMultiPlot {
|
||||||
@ -54,6 +56,7 @@ impl DesertCityMultiPlot {
|
|||||||
door_tile: Vec2<i32>,
|
door_tile: Vec2<i32>,
|
||||||
door_dir: Vec2<i32>,
|
door_dir: Vec2<i32>,
|
||||||
tile_aabr: Aabr<i32>,
|
tile_aabr: Aabr<i32>,
|
||||||
|
campfire: bool,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let bounds = Aabr {
|
let bounds = Aabr {
|
||||||
min: site.tile_wpos(tile_aabr.min),
|
min: site.tile_wpos(tile_aabr.min),
|
||||||
@ -120,6 +123,7 @@ impl DesertCityMultiPlot {
|
|||||||
alt: land.get_alt_approx(site.tile_center_wpos(door_tile + door_dir)) as i32,
|
alt: land.get_alt_approx(site.tile_center_wpos(door_tile + door_dir)) as i32,
|
||||||
diameter,
|
diameter,
|
||||||
plot_kind,
|
plot_kind,
|
||||||
|
campfire,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2407,6 +2411,11 @@ impl Structure for DesertCityMultiPlot {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// spawn campfire in some multiplots that are not markethall
|
||||||
|
let campfire_pos = (center).with_z(base + 1);
|
||||||
|
if self.campfire {
|
||||||
|
painter.spawn(EntityInfo::at(campfire_pos.map(|e| e as f32)).into_waypoint())
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user