Merge branch 'demonic/shrubs' into 'master'

Added new Spots, Shrubs and Ships.

See merge request veloren/veloren!2953
This commit is contained in:
Joshua Barretto 2021-10-26 10:06:14 +00:00
commit 687b24d28d
49 changed files with 278 additions and 18 deletions

View File

@ -69,4 +69,26 @@
central: ("empty"),
),
),
Galleon: (
bone0: (
offset: (-16, -16, -3.0),
phys_offset: (0.0, 0.0, 0.0),
central: ("galleon.structure"),
),
bone1: (
offset: (0.0, 0.0, 0.0),
phys_offset: (0.0, 0.0, 0.0),
central: ("empty"),
),
bone2: (
offset: (0.0, 0.0, 0.0),
phys_offset: (0.0, 0.0, 0.0),
central: ("empty"),
),
bone3: (
offset: (0.0, 0.0, 0.0),
phys_offset: (0.0, 0.0, 0.0),
central: ("empty"),
),
),
})

Binary file not shown.

View File

@ -1,10 +1,6 @@
#![enable(unwrap_newtypes)]
[
(
specifier: "world.shrub.1",
center: (6, 6, 2),
),
(
specifier: "world.shrub.jungle.bush-0",
center: (5, 5, 3),
@ -29,4 +25,16 @@
specifier: "world.shrub.jungle.bush-5",
center: (5, 5, 5),
),
(
specifier: "world.shrub.jungle.bush-6",
center: (8, 7, 5),
),
(
specifier: "world.shrub.jungle.bush-7",
center: (7, 5, 5),
),
(
specifier: "world.shrub.jungle.bush-8",
center: (8, 8, 5),
),
]

View File

@ -0,0 +1,44 @@
#![enable(unwrap_newtypes)]
[
(
specifier: "world.shrub.savannah.bush-0",
center: (5, 3, 8),
),
(
specifier: "world.shrub.savannah.bush-1",
center: (5, 6, 6),
),
(
specifier: "world.shrub.savannah.bush-2",
center: (4, 4, 3),
),
(
specifier: "world.shrub.savannah.bush-3",
center: (5, 6, 3),
),
(
specifier: "world.shrub.savannah.bush-4",
center: (7, 7, 5),
),
(
specifier: "world.shrub.savannah.bush-5",
center: (4, 5, 4),
),
(
specifier: "world.shrub.savannah.bush-6",
center: (3, 3, 3),
),
(
specifier: "world.shrub.savannah.bush-7",
center: (3, 3, 3),
),
(
specifier: "world.shrub.savannah.bush-8",
center: (2, 2, 3),
),
(
specifier: "world.shrub.savannah.bush-9",
center: (4, 3, 3),
),
]

View File

@ -0,0 +1,28 @@
#![enable(unwrap_newtypes)]
[
(
specifier: "world.shrub.taiga.bush-0",
center: (4, 4, 2),
),
(
specifier: "world.shrub.taiga.bush-1",
center: (4, 4, 2),
),
(
specifier: "world.shrub.taiga.bush-2",
center: (4, 4, 2),
),
(
specifier: "world.shrub.taiga.bush-3",
center: (4, 4, 1),
),
(
specifier: "world.shrub.taiga.bush-4",
center: (3, 3, 1),
),
(
specifier: "world.shrub.taiga.bush-5",
center: (4, 4, 1),
),
]

View File

@ -0,0 +1,24 @@
#![enable(unwrap_newtypes)]
[
(
specifier: "world.shrub.temperate.bush-0",
center: (4, 4, 2),
),
(
specifier: "world.shrub.temperate.bush-1",
center: (3, 3, 2),
),
(
specifier: "world.shrub.temperate.bush-2",
center: (4, 4, 2),
),
(
specifier: "world.shrub.temperate.bush-3",
center: (4, 4, 2),
),
(
specifier: "world.shrub.temperate.bush-4",
center: (5, 5, 3),
),
]

View File

@ -0,0 +1,12 @@
#![enable(unwrap_newtypes)]
[
(
specifier: "world.structure.natural.shipwreck2",
center: (32, 31, 14),
/// ( X, Y, Z, )
custom_indices: {
48: Sprite(Chest),
},
),
]

View File

@ -0,0 +1,9 @@
#![enable(unwrap_newtypes)]
[
(
specifier: "world.structure.natural.troll_cave",
center: (23, 25, 12),
/// ( X, Y, Z, )
),
]

View File

@ -0,0 +1,12 @@
#![enable(unwrap_newtypes)]
[
(
specifier: "world.structure.natural.gnarling_tree",
center: (32, 28, 15),
/// ( X, Y, Z, )
custom_indices: {
48: Sprite(Chest),
},
),
]

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -858,6 +858,7 @@ impl Body {
ship::Body::DefaultAirship => [0.0, 0.0, 10.0],
ship::Body::AirBalloon => [0.0, 0.0, 5.0],
ship::Body::SailBoat => [-2.0, -5.0, 4.0],
ship::Body::Galleon => [-2.0, -5.0, 4.0],
},
_ => [0.0, 0.0, 0.0],
}

View File

@ -7,7 +7,12 @@ use rand::prelude::SliceRandom;
use serde::{Deserialize, Serialize};
use vek::Vec3;
pub const ALL_BODIES: [Body; 3] = [Body::DefaultAirship, Body::AirBalloon, Body::SailBoat];
pub const ALL_BODIES: [Body; 4] = [
Body::DefaultAirship,
Body::AirBalloon,
Body::SailBoat,
Body::Galleon,
];
make_case_elim!(
body,
@ -17,6 +22,7 @@ make_case_elim!(
DefaultAirship = 0,
AirBalloon = 1,
SailBoat = 2,
Galleon = 3,
}
);
@ -37,6 +43,7 @@ impl Body {
Body::DefaultAirship => "airship_human.structure",
Body::AirBalloon => "air_balloon.structure",
Body::SailBoat => "sail_boat.structure",
Body::Galleon => "galleon.structure",
}
}
@ -45,6 +52,7 @@ impl Body {
Body::DefaultAirship => Vec3::new(25.0, 50.0, 40.0),
Body::AirBalloon => Vec3::new(25.0, 50.0, 40.0),
Body::SailBoat => Vec3::new(13.0, 31.0, 3.0),
Body::Galleon => Vec3::new(13.0, 32.0, 3.0),
}
}

View File

@ -202,7 +202,7 @@ impl Body {
Body::QuadrupedLow(_) => Some(300.0 * self.mass().0),
Body::QuadrupedMedium(_) => Some(300.0 * self.mass().0),
Body::QuadrupedSmall(_) => Some(300.0 * self.mass().0),
Body::Ship(ship) if ship.has_water_thrust() => Some(1500.0 * self.mass().0),
Body::Ship(ship) if ship.has_water_thrust() => Some(3500.0 * self.mass().0),
Body::Ship(_) => None,
}
}

View File

@ -94,21 +94,25 @@ impl<'a> From<&'a Body> for SkeletonAttr {
DefaultAirship => (0.0, 0.0, 0.0),
AirBalloon => (0.0, 0.0, 0.0),
SailBoat => (0.0, 0.0, 0.0),
Galleon => (0.0, 0.0, 0.0),
},
bone1: match body {
DefaultAirship => (-13.0, -25.0, 10.0),
AirBalloon => (0.0, 0.0, 0.0),
SailBoat => (0.0, 0.0, 0.0),
Galleon => (0.0, 0.0, 0.0),
},
bone2: match body {
DefaultAirship => (13.0, -25.0, 10.0),
AirBalloon => (0.0, 0.0, 0.0),
SailBoat => (0.0, 0.0, 0.0),
Galleon => (0.0, 0.0, 0.0),
},
bone3: match body {
DefaultAirship => (0.0, -27.5, 8.5),
AirBalloon => (0.0, -9.0, 8.0),
SailBoat => (0.0, 0.0, 0.0),
Galleon => (0.0, 0.0, 0.0),
},
}
}

View File

@ -82,6 +82,22 @@ impl ForestKind {
}
}
pub fn shrub_density_factor(&self) -> f32 {
match self {
ForestKind::Palm => 0.2,
ForestKind::Acacia => 0.3,
ForestKind::Baobab => 0.2,
ForestKind::Oak => 0.4,
ForestKind::Chestnut => 0.3,
ForestKind::Cedar => 0.3,
ForestKind::Pine => 0.4,
ForestKind::Birch => 0.65,
ForestKind::Mangrove => 1.0,
ForestKind::Swamp => 0.4,
_ => 1.0,
}
}
pub fn proclivity(&self, env: &Environment) -> f32 {
self.ideal_proclivity()
* close(env.humid, self.humid_range())

View File

@ -15,6 +15,11 @@ use vek::*;
lazy_static! {
static ref JUNGLE_SHRUBS: AssetHandle<StructuresGroup> = Structure::load_group("shrubs.jungle");
static ref SAVANNAH_SHRUBS: AssetHandle<StructuresGroup> =
Structure::load_group("shrubs.savannah");
static ref TEMPERATE_SHRUBS: AssetHandle<StructuresGroup> =
Structure::load_group("shrubs.temperate");
static ref TAIGA_SHRUBS: AssetHandle<StructuresGroup> = Structure::load_group("shrubs.taiga");
}
struct Shrub {
@ -43,15 +48,20 @@ pub fn apply_shrubs_to(canvas: &mut Canvas, _dynamic_rng: &mut impl Rng) {
&& col.spawn_rate > 0.9
&& col.path.map_or(true, |(d, _, _, _)| d > 6.0)
{
Some(Shrub {
wpos: wpos.with_z(col.alt as i32),
seed,
kind: *info
.chunks()
.make_forest_lottery(wpos)
.choose_seeded(seed)
.as_ref()?,
})
let kind = *info
.chunks()
.make_forest_lottery(wpos)
.choose_seeded(seed)
.as_ref()?;
if rng.gen_bool(kind.shrub_density_factor() as f64) {
Some(Shrub {
wpos: wpos.with_z(col.alt as i32),
seed,
kind,
})
} else {
None
}
} else {
None
}
@ -65,7 +75,10 @@ pub fn apply_shrubs_to(canvas: &mut Canvas, _dynamic_rng: &mut impl Rng) {
let units = UnitChooser::new(shrub.seed).get(shrub.seed).into();
let shrubs = match shrub.kind {
ForestKind::Mangrove => &JUNGLE_SHRUBS,
ForestKind::Mangrove => &*JUNGLE_SHRUBS,
ForestKind::Acacia | ForestKind::Baobab => &*SAVANNAH_SHRUBS,
ForestKind::Oak | ForestKind::Chestnut => &*TEMPERATE_SHRUBS,
ForestKind::Pine => &*TAIGA_SHRUBS,
_ => continue, // TODO: Add more shrub varieties
}
.read();

View File

@ -46,7 +46,6 @@ pub enum Spot {
//TowerRuin,
//WellOfLight,
//MerchantOutpost,
//TrollHideout,
//RuinedHuntingCabin, <-- Bears!
//LionRock,
//WolfBurrow,
@ -58,6 +57,9 @@ pub enum Spot {
AirshipCrash,
FruitTree,
Shipwreck,
Shipwreck2,
GnarlingTree,
TrollCave,
}
impl Spot {
@ -179,6 +181,34 @@ impl Spot {
},
false,
);
Self::generate_spots(
Spot::GnarlingTree,
world,
1.0,
|g, c| {
g < 0.25
&& !c.near_cliffs()
&& !c.river.near_water()
&& !c.path.0.is_way()
&& c.sites.is_empty()
&& matches!(c.get_biome(), Forest | Grassland)
},
false,
);
Self::generate_spots(
Spot::TrollCave,
world,
1.0,
|g, c| {
g < 0.25
&& !c.near_cliffs()
&& !c.river.near_water()
&& !c.path.0.is_way()
&& c.sites.is_empty()
&& matches!(c.get_biome(), Forest | Grassland | Snowland | Taiga)
},
false,
);
// Random World Objects -> Themed to their Biome and the NPCs that regularly
// spawn there
Self::generate_spots(
@ -296,7 +326,16 @@ impl Spot {
Self::generate_spots(
Spot::Shipwreck,
world,
2.0,
1.0,
|g, c| {
g < 0.25 && c.is_underwater() && c.sites.is_empty() && c.water_alt > c.alt + 30.0
},
true,
);
Self::generate_spots(
Spot::Shipwreck2,
world,
1.0,
|g, c| {
g < 0.25 && c.is_underwater() && c.sites.is_empty() && c.water_alt > c.alt + 30.0
},
@ -440,6 +479,21 @@ pub fn apply_spots_to(canvas: &mut Canvas, _dynamic_rng: &mut impl Rng) {
(1..3, "common.entity.dungeon.tier-0.staff"),
],
},
Spot::GnarlingTree => SpotConfig {
base_structures: Some("spots_grasslands.gnarling_tree"),
entity_radius: 64.0,
entities: &[
(1..5, "common.entity.dungeon.tier-0.spear"),
(2..4, "common.entity.dungeon.tier-0.bow"),
(1..2, "common.entity.dungeon.tier-0.staff"),
(1..4, "common.entity.wild.aggressive.deadwood"),
],
},
Spot::TrollCave => SpotConfig {
base_structures: Some("spots_general.troll_cave"),
entity_radius: 40.0,
entities: &[(1..2, "common.entity.wild.aggressive.cave_troll")],
},
// Random World Objects
Spot::LionRock => SpotConfig {
base_structures: Some("spots_savannah.lion_rock"),
@ -486,6 +540,11 @@ pub fn apply_spots_to(canvas: &mut Canvas, _dynamic_rng: &mut impl Rng) {
entity_radius: 2.0,
entities: &[(0..2, "common.entity.wild.peaceful.clownfish")],
},
Spot::Shipwreck2 => SpotConfig {
base_structures: Some("spots.water.shipwreck2"),
entity_radius: 20.0,
entities: &[(2..6, "common.entity.wild.peaceful.clownfish")],
},
};
// Blit base structure
if let Some(base_structures) = spot_config.base_structures {