diff --git a/CHANGELOG.md b/CHANGELOG.md index a9a8471b05..8cc9131bfd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -97,6 +97,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Lantern color changes when swapping lanterns - NPCs no longer wander off cliffs - Guards will defend villagers instead of simply threatening the attacker +- Seafaring ships no longer spawn on dry land ## [0.11.0] - 2021-09-11 diff --git a/common/src/comp/body/ship.rs b/common/src/comp/body/ship.rs index ca3175aeec..5a69a38498 100644 --- a/common/src/comp/body/ship.rs +++ b/common/src/comp/body/ship.rs @@ -16,6 +16,8 @@ pub const ALL_BODIES: [Body; 4] = [ Body::Galleon, ]; +pub const ALL_AIRSHIPS: [Body; 2] = [Body::DefaultAirship, Body::AirBalloon]; + make_case_elim!( body, #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)] @@ -41,6 +43,10 @@ impl Body { pub fn random_with(rng: &mut impl rand::Rng) -> Self { *(&ALL_BODIES).choose(rng).unwrap() } + pub fn random_airship_with(rng: &mut impl rand::Rng) -> Self { + *(&ALL_AIRSHIPS).choose(rng).unwrap() + } + /// Return the structure manifest that this ship uses. `None` means that it /// should be derived from the collider. pub fn manifest_entry(&self) -> Option<&'static str> { diff --git a/server/src/rtsim/entity.rs b/server/src/rtsim/entity.rs index e16c6f7cd3..73ca0c4198 100644 --- a/server/src/rtsim/entity.rs +++ b/server/src/rtsim/entity.rs @@ -69,7 +69,9 @@ impl Entity { RtSimEntityKind::Random => { match self.rng(PERM_GENUS).gen::() { // we want 5% airships, 45% birds, 50% humans - x if x < 0.05 => comp::ship::Body::random_with(&mut self.rng(PERM_BODY)).into(), + x if x < 0.05 => { + comp::ship::Body::random_airship_with(&mut self.rng(PERM_BODY)).into() + }, x if x < 0.45 => { let species = *BIRD_MEDIUM_ROSTER .choose(&mut self.rng(PERM_SPECIES))