initial setup

This commit is contained in:
jshipsey 2022-02-20 00:45:00 -05:00 committed by Sam
parent eb7d712093
commit da3c2369e5
17 changed files with 2251 additions and 17 deletions

BIN
assets/voxygen/element/ui/map/buttons/adlet.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/ui/map/buttons/adlet_bg.png (Stored with Git LFS) Normal file

Binary file not shown.

BIN
assets/voxygen/element/ui/map/buttons/adlet_hover.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
#![enable(unwrap_newtypes)]
[
(
specifier: "world.structure.natural.igloo",
center: (14, 13, 3),
),
]

View File

@ -150,6 +150,7 @@ pub enum SiteKind {
Gnarling,
ChapelSite,
Bridge,
Adlet,
}
#[derive(Debug, Clone, Serialize, Deserialize)]

View File

@ -532,6 +532,9 @@ image_ids! {
mmap_site_gnarling: "voxygen.element.ui.map.buttons.gnarling",
mmap_site_gnarling_hover: "voxygen.element.ui.map.buttons.gnarling_hover",
mmap_site_gnarling_bg: "voxygen.element.ui.map.buttons.gnarling_bg",
mmap_site_adlet: "voxygen.element.ui.map.buttons.adlet",
mmap_site_adlet_hover: "voxygen.element.ui.map.buttons.adlet_hover",
mmap_site_adlet_bg: "voxygen.element.ui.map.buttons.adlet_bg",
mmap_site_minotaur: "voxygen.element.ui.map.buttons.minotaur",
mmap_site_minotaur_hover: "voxygen.element.ui.map.buttons.minotaur_hover",
mmap_site_minotaur_bg: "voxygen.element.ui.map.buttons.minotaur_bg",

View File

@ -924,6 +924,7 @@ impl<'a> Widget for Map<'a> {
SiteKind::Gnarling => i18n.get_msg("hud-map-gnarling"),
SiteKind::ChapelSite => i18n.get_msg("hud-map-chapel_Site"),
SiteKind::Bridge => i18n.get_msg("hud-map-bridge"),
SiteKind::Adlet => i18n.get_msg("hud.map.adlet"),
});
let (difficulty, desc) = match &site.kind {
SiteKind::Town => (None, i18n.get_msg("hud-map-town")),
@ -950,6 +951,7 @@ impl<'a> Widget for Map<'a> {
SiteKind::Gnarling => (Some(0), i18n.get_msg("hud-map-gnarling")),
SiteKind::ChapelSite => (Some(3), i18n.get_msg("hud-map-chapel_site")),
SiteKind::Bridge => (None, i18n.get_msg("hud-map-bridge")),
SiteKind::Adlet => (Some(0), i18n.get_msg("hud.map.adlet")),
};
let desc = desc.into_owned() + &get_site_economy(site_rich);
let site_btn = Button::image(match &site.kind {
@ -959,6 +961,7 @@ impl<'a> Widget for Map<'a> {
SiteKind::Cave => self.imgs.mmap_site_cave,
SiteKind::Tree => self.imgs.mmap_site_tree,
SiteKind::Gnarling => self.imgs.mmap_site_gnarling,
SiteKind::Adlet => self.imgs.mmap_site_adlet,
SiteKind::Dungeon { difficulty } => match difficulty {
4 => self.imgs.mmap_site_minotaur,
5 => self.imgs.mmap_site_mindflayer,
@ -979,6 +982,7 @@ impl<'a> Widget for Map<'a> {
SiteKind::Cave => self.imgs.mmap_site_cave_hover,
SiteKind::Tree => self.imgs.mmap_site_tree_hover,
SiteKind::Gnarling => self.imgs.mmap_site_gnarling_hover,
SiteKind::Adlet => self.imgs.mmap_site_adlet_hover,
SiteKind::Dungeon { difficulty } => match difficulty {
4 => self.imgs.mmap_site_minotaur_hover,
5 => self.imgs.mmap_site_mindflayer_hover,
@ -995,15 +999,16 @@ impl<'a> Widget for Map<'a> {
match &site.kind {
SiteKind::Town => TEXT_COLOR,
SiteKind::Castle => TEXT_COLOR,
SiteKind::Dungeon { .. } | SiteKind::Gnarling | SiteKind::ChapelSite => {
match difficulty {
Some(0) => QUALITY_LOW,
Some(1) => QUALITY_COMMON,
Some(2) => QUALITY_MODERATE,
Some(3) => QUALITY_HIGH,
Some(4 | 5) => QUALITY_EPIC,
_ => TEXT_COLOR,
}
SiteKind::Dungeon { .. }
| SiteKind::Gnarling
| SiteKind::ChapelSite
| SiteKind::Adlet => match difficulty {
Some(0) => QUALITY_LOW,
Some(1) => QUALITY_COMMON,
Some(2) => QUALITY_MODERATE,
Some(3) => QUALITY_HIGH,
Some(4 | 5) => QUALITY_EPIC,
_ => TEXT_COLOR,
},
SiteKind::Cave => TEXT_COLOR,
SiteKind::Tree => TEXT_COLOR,
@ -1022,9 +1027,10 @@ impl<'a> Widget for Map<'a> {
// Only display sites that are toggled on
let show_site = match &site.kind {
SiteKind::Town => show_towns,
SiteKind::Dungeon { .. } | SiteKind::Gnarling | SiteKind::ChapelSite => {
show_dungeons
},
SiteKind::Dungeon { .. }
| SiteKind::Gnarling
| SiteKind::ChapelSite
| SiteKind::Adlet => show_dungeons,
SiteKind::Castle => show_castles,
SiteKind::Cave => show_caves,
SiteKind::Tree => show_trees,
@ -1081,7 +1087,10 @@ impl<'a> Widget for Map<'a> {
dif_img.set(state.ids.site_difs[i], ui)
}
},
SiteKind::Dungeon { .. } | SiteKind::Gnarling | SiteKind::ChapelSite => {
SiteKind::Dungeon { .. }
| SiteKind::Gnarling
| SiteKind::ChapelSite
| SiteKind::Adlet => {
if show_dungeons {
dif_img.set(state.ids.site_difs[i], ui)
}

View File

@ -701,6 +701,7 @@ impl<'a> Widget for MiniMap<'a> {
SiteKind::Tree => None,
SiteKind::Gnarling => Some(0),
SiteKind::Bridge => None,
SiteKind::Adlet => Some(1),
};
Image::new(match &site.kind {
@ -712,6 +713,7 @@ impl<'a> Widget for MiniMap<'a> {
SiteKind::Tree => self.imgs.mmap_site_tree,
SiteKind::Gnarling => self.imgs.mmap_site_gnarling_bg,
SiteKind::Bridge => self.imgs.mmap_site_bridge_bg,
SiteKind::Adlet => self.imgs.mmap_site_adlet_bg,
})
.x_y_position_relative_to(
state.ids.map_layers[0],
@ -738,6 +740,7 @@ impl<'a> Widget for MiniMap<'a> {
SiteKind::Tree => self.imgs.mmap_site_tree,
SiteKind::Gnarling => self.imgs.mmap_site_gnarling,
SiteKind::Bridge => self.imgs.mmap_site_bridge,
SiteKind::Adlet => self.imgs.mmap_site_adlet,
})
.middle_of(state.ids.mmap_site_icons_bgs[i])
.w_h(20.0, 20.0)

View File

@ -248,6 +248,10 @@ impl Civs {
)?,
SiteKind::ChapelSite,
),
44..=49 => (
find_site_loc(&mut ctx, (&this.gnarling_enemies(), 40), SiteKind::Adlet)?,
SiteKind::Adlet,
),
_ => (
find_site_loc(
&mut ctx,
@ -289,6 +293,7 @@ impl Civs {
SiteKind::Gnarling => (16i32, 10.0),
SiteKind::Citadel => (16i32, 0.0),
SiteKind::Bridge(_, _) => (0, 0.0),
SiteKind::Adlet => (16i32, 10.0),
};
let (raise, raise_dist, make_waypoint): (f32, i32, bool) = match &site.kind {
@ -420,6 +425,11 @@ impl Civs {
*a,
*b,
)),
SiteKind::Adlet => WorldSite::adlet(site2::Site::generate_adlet(
&Land::from_sim(ctx.sim),
&mut rng,
wpos,
)),
}
});
sim_site.site_tmp = Some(site);
@ -1260,6 +1270,13 @@ impl Civs {
})
}
fn adlet_enemies(&self) -> Vec<Vec2<i32>> {
self.sites().filter_map(|s| match s.kind {
SiteKind::Tree | SiteKind::GiantTree => None,
_ => Some(s.center),
})
}
fn chapel_site_enemies(&self) -> impl Iterator<Item = Vec2<i32>> + '_ {
self.sites().filter_map(|s| match s.kind {
SiteKind::Tree | SiteKind::GiantTree => None,
@ -1545,6 +1562,7 @@ pub enum SiteKind {
Gnarling,
Citadel,
Bridge(Vec2<i32>, Vec2<i32>),
Adlet,
}
impl SiteKind {
@ -1672,6 +1690,7 @@ impl SiteKind {
&& (-0.3..0.4).contains(&chunk.temp)
&& chunk.tree_density > 0.75
},
SiteKind::Adlet => (-0.8..0.2).contains(&chunk.temp) && chunk.tree_density > 0.2,
SiteKind::GiantTree | SiteKind::Tree => {
on_land()
&& on_flat_terrain()

View File

@ -177,6 +177,7 @@ impl World {
civ::SiteKind::ChapelSite => world_msg::SiteKind::ChapelSite,
civ::SiteKind::Citadel => world_msg::SiteKind::Castle,
civ::SiteKind::Bridge(_, _) => world_msg::SiteKind::Bridge,
civ::SiteKind::Adlet => world_msg::SiteKind::Adlet,
},
wpos: site.center * TerrainChunkSize::RECT_SIZE.map(|e| e as i32),
}

View File

@ -129,6 +129,7 @@ impl Environment {
SiteKind::Tree(_) => (),
SiteKind::GiantTree(_) => (),
SiteKind::Gnarling(_) => {},
SiteKind::Adlet(_) => {},
SiteKind::ChapelSite(_) => {},
SiteKind::Bridge(_) => {},
}

View File

@ -74,6 +74,7 @@ pub enum SiteKind {
GiantTree(site2::Site),
Gnarling(site2::Site),
Bridge(site2::Site),
Adlet(site2::Site),
}
impl Site {
@ -98,6 +99,13 @@ impl Site {
}
}
pub fn adlet(g: site2::Site) -> Self {
Self {
kind: SiteKind::Adlet(g),
economy: Economy::default(),
}
}
pub fn castle(c: Castle) -> Self {
Self {
kind: SiteKind::Castle(c),
@ -175,6 +183,7 @@ impl Site {
SiteKind::GiantTree(gt) => gt.radius(),
SiteKind::Gnarling(g) => g.radius(),
SiteKind::Bridge(b) => b.radius(),
SiteKind::Adlet(g) => g.radius(),
}
}
@ -192,6 +201,7 @@ impl Site {
SiteKind::GiantTree(gt) => gt.origin,
SiteKind::Gnarling(g) => g.origin,
SiteKind::Bridge(b) => b.origin,
SiteKind::Adlet(g) => g.origin,
}
}
@ -209,6 +219,7 @@ impl Site {
SiteKind::GiantTree(gt) => gt.spawn_rules(wpos),
SiteKind::Gnarling(g) => g.spawn_rules(wpos),
SiteKind::Bridge(b) => b.spawn_rules(wpos),
SiteKind::Adlet(g) => g.spawn_rules(wpos),
}
}
@ -226,6 +237,7 @@ impl Site {
SiteKind::GiantTree(gt) => gt.name(),
SiteKind::Gnarling(g) => g.name(),
SiteKind::Bridge(b) => b.name(),
SiteKind::Adlet(g) => g.name(),
}
}
@ -262,6 +274,7 @@ impl Site {
SiteKind::GiantTree(gt) => gt.render(canvas, dynamic_rng),
SiteKind::Gnarling(g) => g.render(canvas, dynamic_rng),
SiteKind::Bridge(b) => b.render(canvas, dynamic_rng),
SiteKind::Adlet(g) => g.render(canvas, dynamic_rng),
}
}
@ -292,6 +305,7 @@ impl Site {
SiteKind::GiantTree(gt) => gt.apply_supplement(dynamic_rng, wpos2d, supplement),
SiteKind::Gnarling(g) => g.apply_supplement(dynamic_rng, wpos2d, supplement),
SiteKind::Bridge(b) => b.apply_supplement(dynamic_rng, wpos2d, supplement),
SiteKind::Adlet(g) => g.apply_supplement(dynamic_rng, wpos2d, supplement),
}
}

View File

@ -643,4 +643,24 @@ impl<'a, R: Rng> NameGen<'a, R> {
];
self.generate_theme_from_parts(&start, &middle, &vowel, &end)
}
//adlet placeholder
pub fn generate_adlet(mut self) -> String {
let start = ["gn", "kr", "k", "r", "t", "kn", "tr", "kt", "gr"];
let middle = [
"t", "tt", "k", "kk", "r", "r", "rl", "lm", "km", "tm", "kn", "kr", "tr", "nk", "gn",
"kl", "kt", "lt", "arln", "ln", "k't", "k'n", "k'm", "g'm", "l'k", "t'n", "r'k",
"n'kr", "k R", "t K", "rl Gn", "rl K", "k Gn", "t M", "t N", "r K", "r N", "k M",
"k T", "rl T", "t Kn", "r Kn",
];
let vowel = ["e", "a", "i", "o"];
let end = [
"arak", "orok", "arok", "orak", "attak", "akarl", "okarl", "atok", "anak", "etak",
"orek", "arek", "atik", "arik", "etik", "arlak", "arlek", "otek", "almek", "arlnok",
"arlnak", "okorl", "eknok", "ottok", "erlek", "akkat", "okkar", "attor", "ittor",
"aktor", "okomor", "imor", "inork", "inor", "amakkor", "ikkor", "amarl", "omarl",
"ikkarl", "okkarl", "emekk", "akatak", "okatak",
];
self.generate_theme_from_parts(&start, &middle, &vowel, &end)
}
}

View File

@ -105,6 +105,7 @@ impl Site {
.filter_map(|plot| match &plot.kind {
PlotKind::Dungeon(d) => Some(d.spawn_rules(wpos)),
PlotKind::Gnarling(g) => Some(g.spawn_rules(wpos)),
PlotKind::Adlet(g) => Some(g.spawn_rules(wpos)),
_ => None,
})
.fold(base_spawn_rules, |a, b| a.combine(b))
@ -470,6 +471,34 @@ impl Site {
site
}
pub fn generate_adlet(land: &Land, rng: &mut impl Rng, origin: Vec2<i32>) -> Self {
let mut rng = reseed(rng);
let mut site = Site {
origin,
..Site::default()
};
site.demarcate_obstacles(land);
let adlet_stronghold = plot::AdletStronghold::generate(origin, land, &mut rng);
site.name = adlet_stronghold.name().to_string();
let size = adlet_stronghold.radius() / tile::TILE_SIZE as i32;
let aabr = Aabr {
min: Vec2::broadcast(-size),
max: Vec2::broadcast(size),
};
let plot = site.create_plot(Plot {
kind: PlotKind::Adlet(adlet_stronghold),
root_tile: aabr.center(),
tiles: aabr_tiles(aabr).collect(),
seed: rng.gen(),
});
site.blit_aabr(aabr, Tile {
kind: TileKind::AdletStronghold,
plot: Some(plot),
hard_alt: None,
});
site
}
pub fn generate_giant_tree(land: &Land, rng: &mut impl Rng, origin: Vec2<i32>) -> Self {
let mut rng = reseed(rng);
let mut site = Site {
@ -1341,6 +1370,7 @@ impl Site {
PlotKind::SeaChapel(sea_chapel) => sea_chapel.render_collect(self, canvas),
PlotKind::Dungeon(dungeon) => dungeon.render_collect(self, canvas),
PlotKind::Gnarling(gnarling) => gnarling.render_collect(self, canvas),
PlotKind::Adlet(adlet) => adlet.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),
@ -1420,6 +1450,7 @@ impl Site {
match &plot.kind {
PlotKind::Dungeon(d) => d.apply_supplement(dynamic_rng, wpos2d, supplement),
PlotKind::Gnarling(g) => g.apply_supplement(dynamic_rng, wpos2d, supplement),
PlotKind::Adlet(g) => g.apply_supplement(dynamic_rng, wpos2d, supplement),
_ => {},
}
}

View File

@ -1,3 +1,4 @@
mod adlet;
mod bridge;
mod castle;
mod citadel;
@ -13,10 +14,11 @@ mod sea_chapel;
mod workshop;
pub use self::{
bridge::Bridge, castle::Castle, citadel::Citadel, cliff_tower::CliffTower,
desert_city_multiplot::DesertCityMultiPlot, desert_city_temple::DesertCityTemple,
dungeon::Dungeon, giant_tree::GiantTree, gnarling::GnarlingFortification, house::House,
savannah_pit::SavannahPit, sea_chapel::SeaChapel, workshop::Workshop,
adlet::AdletStronghold, bridge::Bridge, castle::Castle, citadel::Citadel,
cliff_tower::CliffTower, desert_city_multiplot::DesertCityMultiPlot,
desert_city_temple::DesertCityTemple, dungeon::Dungeon, giant_tree::GiantTree,
gnarling::GnarlingFortification, house::House, savannah_pit::SavannahPit,
sea_chapel::SeaChapel, workshop::Workshop,
};
use super::*;
@ -67,6 +69,7 @@ pub enum PlotKind {
Road(Path<Vec2<i32>>),
Dungeon(Dungeon),
Gnarling(GnarlingFortification),
Adlet(AdletStronghold),
GiantTree(GiantTree),
CliffTower(CliffTower),
Citadel(Citadel),

File diff suppressed because it is too large Load Diff

View File

@ -192,6 +192,7 @@ pub enum TileKind {
Gate,
GnarlingFortification,
Bridge,
AdletStronghold,
}
#[derive(Clone, PartialEq)]