diff --git a/world/src/site2/mod.rs b/world/src/site2/mod.rs index 9ed7badcf8..eb12c761c0 100644 --- a/world/src/site2/mod.rs +++ b/world/src/site2/mod.rs @@ -744,17 +744,17 @@ impl Site { pub fn generate_cliff_town(land: &Land, rng: &mut impl Rng, origin: Vec2) -> Self { let mut rng = reseed(rng); - let mut site = Site { origin, name: NameGen::location(&mut rng).generate_arabic(), ..Site::default() }; - + let mut campfires = 0; site.make_plaza(land, &mut rng); for _ in 0..30 { // CliffTower let size = (6.0 + rng.gen::().powf(5.0) * 1.0).round() as u32; + let campfire = campfires < 4; if let Some((aabr, door_tile, door_dir)) = attempt(32, || { site.find_roadside_aabr(&mut rng, 6..(size + 1).pow(2), Extent2::broadcast(size)) }) { @@ -765,6 +765,7 @@ impl Site { door_tile, door_dir, aabr, + campfire, ); let cliff_tower_alt = cliff_tower.alt; let plot = site.create_plot(Plot { @@ -779,6 +780,7 @@ impl Site { plot: Some(plot), hard_alt: Some(cliff_tower_alt), }); + campfires += 1; } else { 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 mut temples = 0; + let mut campfires = 0; for _ in 0..30 { match *build_chance.choose_seeded(rng.gen()) { // DesertCityMultiplot 1 => { let size = (9.0 + rng.gen::().powf(5.0) * 1.5).round() as u32; + let campfire = campfires < 4; if let Some((aabr, door_tile, door_dir)) = attempt(32, || { site.find_roadside_aabr( &mut rng, @@ -823,6 +827,7 @@ impl Site { door_tile, door_dir, aabr, + campfire, ); let desert_city_multi_plot_alt = desert_city_multi_plot.alt; let plot = site.create_plot(Plot { @@ -837,6 +842,7 @@ impl Site { plot: Some(plot), hard_alt: Some(desert_city_multi_plot_alt), }); + campfires += 1; } else { site.make_plaza(land, &mut rng); } diff --git a/world/src/site2/plot/cliff_tower.rs b/world/src/site2/plot/cliff_tower.rs index 648a989f25..90ecd5c784 100644 --- a/world/src/site2/plot/cliff_tower.rs +++ b/world/src/site2/plot/cliff_tower.rs @@ -17,6 +17,7 @@ pub struct CliffTower { bounds: Aabr, /// Approximate altitude of the door tile pub(crate) alt: i32, + campfire: bool, } impl CliffTower { @@ -27,6 +28,7 @@ impl CliffTower { door_tile: Vec2, door_dir: Vec2, tile_aabr: Aabr, + campfire: bool, ) -> Self { let bounds = Aabr { min: site.tile_wpos(tile_aabr.min), @@ -35,6 +37,7 @@ impl CliffTower { Self { bounds, 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 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()); + } } } diff --git a/world/src/site2/plot/desert_city_multiplot.rs b/world/src/site2/plot/desert_city_multiplot.rs index d44df5ff28..7325b12168 100644 --- a/world/src/site2/plot/desert_city_multiplot.rs +++ b/world/src/site2/plot/desert_city_multiplot.rs @@ -5,8 +5,9 @@ use crate::{ util::{RandomField, Sampler, DIAGONALS, NEIGHBORS}, Land, }; -use common::terrain::{ - Block, BlockKind, SpriteKind, Structure as PrefabStructure, StructuresGroup, +use common::{ + generation::EntityInfo, + terrain::{Block, BlockKind, SpriteKind, Structure as PrefabStructure, StructuresGroup}, }; use lazy_static::lazy_static; use rand::prelude::*; @@ -44,6 +45,7 @@ pub struct DesertCityMultiPlot { pub(crate) alt: i32, diameter: i32, plot_kind: PlotKind, + campfire: bool, } impl DesertCityMultiPlot { @@ -54,6 +56,7 @@ impl DesertCityMultiPlot { door_tile: Vec2, door_dir: Vec2, tile_aabr: Aabr, + campfire: bool, ) -> Self { let bounds = Aabr { 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, diameter, 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()) + } }, } }