Town music

This commit is contained in:
DaforLynx 2021-04-28 05:07:59 +00:00 committed by Justin Shipsey
parent 5948025327
commit 2e0272ce28
14 changed files with 75 additions and 24 deletions

View File

@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Day period dependant wildlife spawns
- You can now block and parry with melee weapons
- Lift is now calculated for gliders based on dimensions (currently same for all)
- Specific music tracks can now play exclusively in towns.
### Changed

View File

@ -7,6 +7,46 @@
(
tracks: [
Individual((
title: "Rest Assured",
path: "voxygen.audio.soundtrack.town.rest_assured",
length: 189.0,
timing: Some(Day),
biomes: [],
site: Some(Settlement),
music_state: Activity(Explore),
artist: "badbbad",
)),
Individual((
title: "Library Theme",
path: "voxygen.audio.soundtrack.town.library_theme",
length: 65.0,
timing: Some(Day),
biomes: [],
site: Some(Settlement),
music_state: Activity(Explore),
artist: "Aeronic",
)),
Individual((
title: "Onwards!",
path: "voxygen.audio.soundtrack.town.onwards",
length: 151.0,
timing: Some(Night),
biomes: [],
site: Some(Settlement),
music_state: Activity(Explore),
artist: "lorenzo_rozzi",
)),
Individual((
title: "I'm Home",
path: "voxygen.audio.soundtrack.town.im_home",
length: 125.0,
timing: Some(Night),
biomes: [],
site: Some(Settlement),
music_state: Activity(Explore),
artist: "badbbad",
)),
Individual((
title: "Dank Dungeon",
path: "voxygen.audio.soundtrack.dungeon.dank_dungeon",
@ -381,14 +421,9 @@
biomes: [],
site: Some(Dungeon),
segments: [
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-hi-end", 6.0, Transition(Combat(High), Explore), None),
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-hi-loop", 54.0, Activity(Combat(High)), None),
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-hi-start", 56.0, Transition(Explore, Combat(High)), Some(Combat(High))),
// ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-lo-end", 3.0, Transition(Combat(Low), Explore), None),
// ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-lo-loop", 7.0, Activity(Combat(Low)), None),
// ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-lo-start", 10.0, Transition(Explore, Combat(Low)), None),
// ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-trans-hi-lo", 10.0, Transition(Combat(High), Combat(Low)), None),
// ("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-trans-lo-hi", 7.0, Transition(Combat(Low), Combat(High)), None),
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-end", 6.0, Transition(Combat(High), Explore), None),
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-loop", 54.0, Activity(Combat(High)), None),
("voxygen.audio.soundtrack.combat.barred_paths.barred_paths-start", 56.0, Transition(Explore, Combat(High)), Some(Combat(High))),
],
),
]

View File

@ -1306,14 +1306,20 @@ impl Client {
}
let mut contains_cave = false;
let mut terrain_alt = 0.0;
let mut contains_dungeon = false;
let mut contains_settlement = false;
if let Some(chunk) = self.current_chunk() {
terrain_alt = chunk.meta().alt();
contains_cave = chunk.meta().contains_cave();
contains_dungeon = chunk.meta().contains_dungeon();
contains_settlement = chunk.meta().contains_settlement();
}
if player_alt < (terrain_alt - 25.0) && contains_cave {
SitesKind::Cave
} else if player_alt < (terrain_alt - 25.0) {
} else if player_alt < (terrain_alt - 25.0) && contains_dungeon {
SitesKind::Dungeon
} else if contains_settlement {
SitesKind::Settlement
} else {
SitesKind::Void
}

View File

@ -87,8 +87,11 @@ pub struct TerrainChunkMeta {
contains_cave: bool,
contains_river: bool,
temp: f32,
contains_settlement: bool,
contains_dungeon: bool,
}
#[allow(clippy::clippy::too_many_arguments)]
impl TerrainChunkMeta {
pub fn new(
name: Option<String>,
@ -98,6 +101,8 @@ impl TerrainChunkMeta {
contains_cave: bool,
contains_river: bool,
temp: f32,
contains_settlement: bool,
contains_dungeon: bool,
) -> Self {
Self {
name,
@ -107,6 +112,8 @@ impl TerrainChunkMeta {
contains_cave,
contains_river,
temp,
contains_settlement,
contains_dungeon,
}
}
@ -119,6 +126,8 @@ impl TerrainChunkMeta {
contains_cave: false,
contains_river: false,
temp: 0.0,
contains_settlement: false,
contains_dungeon: false,
}
}
@ -134,6 +143,10 @@ impl TerrainChunkMeta {
pub fn contains_river(&self) -> bool { self.contains_river }
pub fn contains_settlement(&self) -> bool { self.contains_settlement }
pub fn contains_dungeon(&self) -> bool { self.contains_dungeon }
pub fn temp(&self) -> f32 { self.temp }
}

View File

@ -221,6 +221,8 @@ impl MusicMgr {
//println!("alt: {}", current_chunk.meta().alt());
//println!("tree_density: {}",
// current_chunk.meta().tree_density());
// let current_site = client.current_site();
// println!("{:?}", current_site);
//if let Some(position) = client.current::<comp::Pos>() {
// player_alt = position.0.z;
//}

View File

@ -45,6 +45,7 @@ pub use index::{IndexOwned, IndexRef};
use crate::{
column::ColumnGen,
index::Index,
site::SiteKind,
util::{Grid, Sampler},
};
use common::{
@ -281,6 +282,14 @@ impl World {
sim_chunk.cave.1.alt != 0.0,
sim_chunk.river.is_river(),
sim_chunk.temp,
sim_chunk
.sites
.iter()
.any(|site| matches!(index.sites[*site].kind, SiteKind::Settlement(_))),
sim_chunk
.sites
.iter()
.any(|site| matches!(index.sites[*site].kind, SiteKind::Dungeon(_))),
);
let mut chunk = TerrainChunk::new(base_z, stone, air, meta);