Restrict RtSim ships to airships

This commit is contained in:
James Melkonian 2022-02-03 21:00:21 -08:00
parent 19c764dde6
commit f21e0f31fb
3 changed files with 10 additions and 1 deletions

View File

@ -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

View File

@ -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> {

View File

@ -69,7 +69,9 @@ impl Entity {
RtSimEntityKind::Random => {
match self.rng(PERM_GENUS).gen::<f32>() {
// 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))