mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
savannah_pit
This commit is contained in:
parent
938fd77b5a
commit
698a00bae3
@ -18,8 +18,9 @@ pub enum DungeonKindMeta {
|
||||
#[derive(Debug, Copy, Clone, Serialize, Deserialize, PartialEq, Eq)]
|
||||
pub enum SettlementKindMeta {
|
||||
Default,
|
||||
Cliff,
|
||||
Desert,
|
||||
CliffTown,
|
||||
DesertCity,
|
||||
SavannahPit,
|
||||
}
|
||||
|
||||
impl Default for SiteKindMeta {
|
||||
|
@ -116,8 +116,9 @@ impl ActivityUpdate {
|
||||
Dungeon(Gnarling) => format!("Hunting Gnarlings in {chunk_name}"),
|
||||
Cave => "In a Cave".to_string(),
|
||||
Settlement(Default) => format!("Visiting {chunk_name}"),
|
||||
Settlement(Cliff) => format!("Climbing the towers of {chunk_name}"),
|
||||
Settlement(Desert) => format!("Hiding from the sun in {chunk_name}"),
|
||||
Settlement(CliffTown) => format!("Climbing the towers of {chunk_name}"),
|
||||
Settlement(DesertCity) => format!("Hiding from the sun in {chunk_name}"),
|
||||
Settlement(SavannahPit) => format!("Shop at the market down in {chunk_name}"),
|
||||
_ => format!("In {chunk_name}"),
|
||||
};
|
||||
|
||||
|
@ -184,6 +184,7 @@ impl Civs {
|
||||
SiteKind::Castle => (16i32, 5.0),
|
||||
SiteKind::Refactor => (32i32, 10.0),
|
||||
SiteKind::CliffTown => (32i32, 10.0),
|
||||
SiteKind::SavannahPit => (36i32, 20.0),
|
||||
SiteKind::DesertCity => (64i32, 25.0),
|
||||
SiteKind::ChapelSite => (36i32, 10.0),
|
||||
SiteKind::Tree => (12i32, 8.0),
|
||||
@ -249,54 +250,60 @@ impl Civs {
|
||||
});
|
||||
|
||||
let mut rng = ctx.reseed().rng;
|
||||
let site =
|
||||
index.sites.insert(match &sim_site.kind {
|
||||
SiteKind::Settlement => {
|
||||
WorldSite::settlement(Settlement::generate(wpos, Some(ctx.sim), &mut rng))
|
||||
},
|
||||
SiteKind::Dungeon => WorldSite::dungeon(site2::Site::generate_dungeon(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
SiteKind::Castle => {
|
||||
WorldSite::castle(Castle::generate(wpos, Some(ctx.sim), &mut rng))
|
||||
},
|
||||
SiteKind::Refactor => WorldSite::refactor(site2::Site::generate_city(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
SiteKind::CliffTown => WorldSite::cliff_town(site2::Site::generate_cliff_town(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
SiteKind::DesertCity => WorldSite::desert_city(
|
||||
site2::Site::generate_desert_city(&Land::from_sim(ctx.sim), &mut rng, wpos),
|
||||
),
|
||||
SiteKind::Tree => {
|
||||
WorldSite::tree(Tree::generate(wpos, &Land::from_sim(ctx.sim), &mut rng))
|
||||
},
|
||||
SiteKind::GiantTree => WorldSite::giant_tree(site2::Site::generate_giant_tree(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
SiteKind::Gnarling => WorldSite::gnarling(site2::Site::generate_gnarling(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
SiteKind::ChapelSite => WorldSite::chapel_site(
|
||||
site2::Site::generate_chapel_site(&Land::from_sim(ctx.sim), &mut rng, wpos),
|
||||
),
|
||||
SiteKind::Citadel => WorldSite::gnarling(site2::Site::generate_citadel(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
});
|
||||
let site = index.sites.insert(match &sim_site.kind {
|
||||
SiteKind::Settlement => {
|
||||
WorldSite::settlement(Settlement::generate(wpos, Some(ctx.sim), &mut rng))
|
||||
},
|
||||
SiteKind::Dungeon => WorldSite::dungeon(site2::Site::generate_dungeon(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
SiteKind::Castle => {
|
||||
WorldSite::castle(Castle::generate(wpos, Some(ctx.sim), &mut rng))
|
||||
},
|
||||
SiteKind::Refactor => WorldSite::refactor(site2::Site::generate_city(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
SiteKind::CliffTown => WorldSite::cliff_town(site2::Site::generate_cliff_town(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
SiteKind::SavannahPit => WorldSite::savannah_pit(
|
||||
site2::Site::generate_savannah_pit(&Land::from_sim(ctx.sim), &mut rng, wpos),
|
||||
),
|
||||
SiteKind::DesertCity => WorldSite::desert_city(site2::Site::generate_desert_city(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
SiteKind::Tree => {
|
||||
WorldSite::tree(Tree::generate(wpos, &Land::from_sim(ctx.sim), &mut rng))
|
||||
},
|
||||
SiteKind::GiantTree => WorldSite::giant_tree(site2::Site::generate_giant_tree(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
SiteKind::Gnarling => WorldSite::gnarling(site2::Site::generate_gnarling(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
SiteKind::ChapelSite => WorldSite::chapel_site(site2::Site::generate_chapel_site(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
SiteKind::Citadel => WorldSite::gnarling(site2::Site::generate_citadel(
|
||||
&Land::from_sim(ctx.sim),
|
||||
&mut rng,
|
||||
wpos,
|
||||
)),
|
||||
});
|
||||
sim_site.site_tmp = Some(site);
|
||||
let site_ref = &index.sites[site];
|
||||
|
||||
@ -580,6 +587,7 @@ impl Civs {
|
||||
let kind = match ctx.rng.gen_range(0..64) {
|
||||
0..=10 => SiteKind::CliffTown,
|
||||
11..=12 => SiteKind::DesertCity,
|
||||
13..=18 => SiteKind::SavannahPit,
|
||||
_ => SiteKind::Refactor,
|
||||
};
|
||||
let site = attempt(100, || {
|
||||
@ -999,6 +1007,7 @@ impl Civs {
|
||||
SiteKind::Refactor
|
||||
| SiteKind::Settlement
|
||||
| SiteKind::CliffTown
|
||||
| SiteKind::SavannahPit
|
||||
| SiteKind::DesertCity
|
||||
| SiteKind::Castle
|
||||
)
|
||||
@ -1011,6 +1020,7 @@ impl Civs {
|
||||
if let SiteKind::Refactor
|
||||
| SiteKind::Settlement
|
||||
| SiteKind::CliffTown
|
||||
| SiteKind::SavannahPit
|
||||
| SiteKind::DesertCity
|
||||
| SiteKind::Castle = self.sites[site].kind
|
||||
{
|
||||
@ -1248,6 +1258,7 @@ pub enum SiteKind {
|
||||
Castle,
|
||||
Refactor,
|
||||
CliffTown,
|
||||
SavannahPit,
|
||||
DesertCity,
|
||||
ChapelSite,
|
||||
Tree,
|
||||
@ -1393,6 +1404,12 @@ impl SiteKind {
|
||||
&& chunk.near_cliffs()
|
||||
&& suitable_for_town(4.0)
|
||||
},
|
||||
SiteKind::SavannahPit => {
|
||||
matches!(chunk.get_biome(), BiomeKind::Savannah)
|
||||
&& !chunk.near_cliffs()
|
||||
&& !chunk.river.near_water()
|
||||
&& suitable_for_town(4.0)
|
||||
},
|
||||
SiteKind::DesertCity => {
|
||||
(0.9..1.0).contains(&chunk.temp)
|
||||
&& !chunk.near_cliffs()
|
||||
@ -1452,7 +1469,11 @@ impl Site {
|
||||
pub fn is_settlement(&self) -> bool {
|
||||
matches!(
|
||||
self.kind,
|
||||
SiteKind::Settlement | SiteKind::Refactor | SiteKind::CliffTown | SiteKind::DesertCity
|
||||
SiteKind::Settlement
|
||||
| SiteKind::Refactor
|
||||
| SiteKind::CliffTown
|
||||
| SiteKind::DesertCity
|
||||
| SiteKind::SavannahPit
|
||||
)
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ impl World {
|
||||
name: site.site_tmp.map(|id| index.sites[id].name().to_string()),
|
||||
// TODO: Probably unify these, at some point
|
||||
kind: match &site.kind {
|
||||
civ::SiteKind::Settlement | civ::SiteKind::Refactor | civ::SiteKind::CliffTown | civ::SiteKind::DesertCity => world_msg::SiteKind::Town,
|
||||
civ::SiteKind::Settlement | civ::SiteKind::Refactor | civ::SiteKind::CliffTown | civ::SiteKind::SavannahPit | civ::SiteKind::DesertCity => world_msg::SiteKind::Town,
|
||||
civ::SiteKind::Dungeon => world_msg::SiteKind::Dungeon {
|
||||
difficulty: match site.site_tmp.map(|id| &index.sites[id].kind) {
|
||||
Some(SiteKind::Dungeon(d)) => d.dungeon_difficulty().unwrap_or(0),
|
||||
|
@ -122,6 +122,7 @@ impl Environment {
|
||||
SiteKind::Settlement(_)
|
||||
| SiteKind::Refactor(_)
|
||||
| SiteKind::CliffTown(_)
|
||||
| SiteKind::SavannahPit(_)
|
||||
| SiteKind::DesertCity(_) => towns += site.economy.pop,
|
||||
SiteKind::Dungeon(_) => dungeons += site.economy.pop,
|
||||
SiteKind::Castle(_) => castles += site.economy.pop,
|
||||
|
@ -67,6 +67,7 @@ pub enum SiteKind {
|
||||
Castle(Castle),
|
||||
Refactor(site2::Site),
|
||||
CliffTown(site2::Site),
|
||||
SavannahPit(site2::Site),
|
||||
Tree(Tree),
|
||||
DesertCity(site2::Site),
|
||||
ChapelSite(site2::Site),
|
||||
@ -117,6 +118,13 @@ impl Site {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn savannah_pit(sp: site2::Site) -> Self {
|
||||
Self {
|
||||
kind: SiteKind::SavannahPit(sp),
|
||||
economy: Economy::default(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn desert_city(dc: site2::Site) -> Self {
|
||||
Self {
|
||||
kind: SiteKind::DesertCity(dc),
|
||||
@ -152,6 +160,7 @@ impl Site {
|
||||
SiteKind::Castle(c) => c.radius(),
|
||||
SiteKind::Refactor(s) => s.radius(),
|
||||
SiteKind::CliffTown(ct) => ct.radius(),
|
||||
SiteKind::SavannahPit(sp) => sp.radius(),
|
||||
SiteKind::DesertCity(dc) => dc.radius(),
|
||||
SiteKind::ChapelSite(p) => p.radius(),
|
||||
SiteKind::Tree(t) => t.radius(),
|
||||
@ -167,6 +176,7 @@ impl Site {
|
||||
SiteKind::Castle(c) => c.get_origin(),
|
||||
SiteKind::Refactor(s) => s.origin,
|
||||
SiteKind::CliffTown(ct) => ct.origin,
|
||||
SiteKind::SavannahPit(sp) => sp.origin,
|
||||
SiteKind::DesertCity(dc) => dc.origin,
|
||||
SiteKind::ChapelSite(p) => p.origin,
|
||||
SiteKind::Tree(t) => t.origin,
|
||||
@ -182,6 +192,7 @@ impl Site {
|
||||
SiteKind::Castle(c) => c.spawn_rules(wpos),
|
||||
SiteKind::Refactor(s) => s.spawn_rules(wpos),
|
||||
SiteKind::CliffTown(ct) => ct.spawn_rules(wpos),
|
||||
SiteKind::SavannahPit(sp) => sp.spawn_rules(wpos),
|
||||
SiteKind::DesertCity(dc) => dc.spawn_rules(wpos),
|
||||
SiteKind::ChapelSite(p) => p.spawn_rules(wpos),
|
||||
SiteKind::Tree(t) => t.spawn_rules(wpos),
|
||||
@ -197,6 +208,7 @@ impl Site {
|
||||
SiteKind::Castle(c) => c.name(),
|
||||
SiteKind::Refactor(s) => s.name(),
|
||||
SiteKind::CliffTown(ct) => ct.name(),
|
||||
SiteKind::SavannahPit(sp) => sp.name(),
|
||||
SiteKind::DesertCity(dc) => dc.name(),
|
||||
SiteKind::ChapelSite(p) => p.name(),
|
||||
SiteKind::Tree(_) => "Giant Tree",
|
||||
@ -213,6 +225,7 @@ impl Site {
|
||||
SiteKind::Settlement(_)
|
||||
| SiteKind::Refactor(_)
|
||||
| SiteKind::CliffTown(_)
|
||||
| SiteKind::SavannahPit(_)
|
||||
| SiteKind::DesertCity(_) => Some(common::trade::SiteInformation {
|
||||
id: site_id,
|
||||
unconsumed_stock: self.economy.get_available_stock(),
|
||||
@ -230,6 +243,7 @@ impl Site {
|
||||
SiteKind::Castle(c) => c.apply_to(canvas.index, canvas.wpos, get_col, canvas.chunk),
|
||||
SiteKind::Refactor(s) => s.render(canvas, dynamic_rng),
|
||||
SiteKind::CliffTown(ct) => ct.render(canvas, dynamic_rng),
|
||||
SiteKind::SavannahPit(sp) => sp.render(canvas, dynamic_rng),
|
||||
SiteKind::DesertCity(dc) => dc.render(canvas, dynamic_rng),
|
||||
SiteKind::ChapelSite(p) => p.render(canvas, dynamic_rng),
|
||||
SiteKind::Tree(t) => t.render(canvas, dynamic_rng),
|
||||
@ -258,6 +272,7 @@ impl Site {
|
||||
SiteKind::Castle(c) => c.apply_supplement(dynamic_rng, wpos2d, get_column, supplement),
|
||||
SiteKind::Refactor(_) => {},
|
||||
SiteKind::CliffTown(_) => {},
|
||||
SiteKind::SavannahPit(_) => {},
|
||||
SiteKind::DesertCity(_) => {},
|
||||
SiteKind::ChapelSite(p) => p.apply_supplement(dynamic_rng, wpos2d, supplement),
|
||||
SiteKind::Tree(_) => {},
|
||||
@ -271,6 +286,7 @@ impl Site {
|
||||
self.kind,
|
||||
SiteKind::Refactor(_)
|
||||
| SiteKind::CliffTown(_)
|
||||
| SiteKind::SavannahPit(_)
|
||||
| SiteKind::DesertCity(_)
|
||||
| SiteKind::Settlement(_)
|
||||
)
|
||||
@ -283,8 +299,13 @@ impl SiteKind {
|
||||
SiteKind::Refactor(_) | SiteKind::Settlement(_) => {
|
||||
Some(SiteKindMeta::Settlement(SettlementKindMeta::Default))
|
||||
},
|
||||
SiteKind::CliffTown(_) => Some(SiteKindMeta::Settlement(SettlementKindMeta::Cliff)),
|
||||
SiteKind::DesertCity(_) => Some(SiteKindMeta::Settlement(SettlementKindMeta::Desert)),
|
||||
SiteKind::CliffTown(_) => Some(SiteKindMeta::Settlement(SettlementKindMeta::CliffTown)),
|
||||
SiteKind::SavannahPit(_) => {
|
||||
Some(SiteKindMeta::Settlement(SettlementKindMeta::SavannahPit))
|
||||
},
|
||||
SiteKind::DesertCity(_) => {
|
||||
Some(SiteKindMeta::Settlement(SettlementKindMeta::DesertCity))
|
||||
},
|
||||
SiteKind::Dungeon(_) => Some(SiteKindMeta::Dungeon(DungeonKindMeta::Old)),
|
||||
SiteKind::Gnarling(_) => Some(SiteKindMeta::Dungeon(DungeonKindMeta::Gnarling)),
|
||||
_ => None,
|
||||
|
@ -817,6 +817,38 @@ impl Site {
|
||||
site
|
||||
}
|
||||
|
||||
pub fn generate_savannah_pit(land: &Land, rng: &mut impl Rng, origin: Vec2<i32>) -> Self {
|
||||
let mut rng = reseed(rng);
|
||||
let mut site = Site {
|
||||
origin,
|
||||
name: NameGen::location(&mut rng).generate_savannah_custom(),
|
||||
..Site::default()
|
||||
};
|
||||
let size = 11.0 as i32;
|
||||
let aabr = Aabr {
|
||||
min: Vec2::broadcast(-size),
|
||||
max: Vec2::broadcast(size),
|
||||
};
|
||||
{
|
||||
let savannah_pit =
|
||||
plot::SavannahPit::generate(land, &mut reseed(&mut rng), &site, aabr);
|
||||
let savannah_pit_alt = savannah_pit.alt;
|
||||
let plot = site.create_plot(Plot {
|
||||
kind: PlotKind::SavannahPit(savannah_pit),
|
||||
root_tile: aabr.center(),
|
||||
tiles: aabr_tiles(aabr).collect(),
|
||||
seed: rng.gen(),
|
||||
});
|
||||
|
||||
site.blit_aabr(aabr, Tile {
|
||||
kind: TileKind::Building,
|
||||
plot: Some(plot),
|
||||
hard_alt: Some(savannah_pit_alt),
|
||||
});
|
||||
}
|
||||
site
|
||||
}
|
||||
|
||||
pub fn generate_desert_city(land: &Land, rng: &mut impl Rng, origin: Vec2<i32>) -> Self {
|
||||
let mut rng = reseed(rng);
|
||||
|
||||
@ -1196,6 +1228,7 @@ impl Site {
|
||||
PlotKind::Gnarling(gnarling) => gnarling.render_collect(self, canvas),
|
||||
PlotKind::GiantTree(giant_tree) => giant_tree.render_collect(self, canvas),
|
||||
PlotKind::CliffTower(cliff_tower) => cliff_tower.render_collect(self, canvas),
|
||||
PlotKind::SavannahPit(savannah_pit) => savannah_pit.render_collect(self, canvas),
|
||||
PlotKind::DesertCityMultiPlot(desert_city_multi_plot) => {
|
||||
desert_city_multi_plot.render_collect(self, canvas)
|
||||
},
|
||||
|
@ -7,6 +7,7 @@ pub mod dungeon;
|
||||
mod giant_tree;
|
||||
mod gnarling;
|
||||
mod house;
|
||||
mod savannah_pit;
|
||||
mod sea_chapel;
|
||||
mod workshop;
|
||||
|
||||
@ -14,7 +15,7 @@ pub use self::{
|
||||
castle::Castle, citadel::Citadel, cliff_tower::CliffTower,
|
||||
desert_city_multiplot::DesertCityMultiPlot, desert_city_temple::DesertCityTemple,
|
||||
dungeon::Dungeon, giant_tree::GiantTree, gnarling::GnarlingFortification, house::House,
|
||||
sea_chapel::SeaChapel, workshop::Workshop,
|
||||
savannah_pit::SavannahPit, sea_chapel::SeaChapel, workshop::Workshop,
|
||||
};
|
||||
|
||||
use super::*;
|
||||
@ -64,4 +65,5 @@ pub enum PlotKind {
|
||||
GiantTree(GiantTree),
|
||||
CliffTower(CliffTower),
|
||||
Citadel(Citadel),
|
||||
SavannahPit(SavannahPit),
|
||||
}
|
||||
|
1649
world/src/site2/plot/savannah_pit.rs
Normal file
1649
world/src/site2/plot/savannah_pit.rs
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user