Removed potential for divide by zero

This commit is contained in:
Sam 2021-03-27 20:38:56 -04:00
parent 0c19679406
commit ade466a12b
2 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Admins can now grant normal players plots to place blocks within - Admins can now grant normal players plots to place blocks within
- Diamonds are now much more than twice as expensive as twigs. - Diamonds are now much more than twice as expensive as twigs.
- Permission to build is no longer tied to being an admin - Permission to build is no longer tied to being an admin
- Seperated character randomization buttons into appearance and name. - Separated character randomization buttons into appearance and name.
- Reworked mindflayer to have unique attacks - Reworked mindflayer to have unique attacks
### Removed ### Removed

View File

@ -132,7 +132,7 @@ impl Health {
} }
/// Returns the fraction of health an entity has remaining /// Returns the fraction of health an entity has remaining
pub fn fraction(&self) -> f32 { self.current as f32 / self.maximum as f32 } pub fn fraction(&self) -> f32 { self.current as f32 / self.maximum.max(1) as f32 }
} }
#[cfg(not(target_arch = "wasm32"))] #[cfg(not(target_arch = "wasm32"))]