Use inline conditional to simplify assignment.

This commit is contained in:
holychowders 2022-05-09 22:23:08 -05:00
parent 4c76e9314d
commit fc2095803d

View File

@ -1176,11 +1176,7 @@ pub fn perception_dist_multiplier_from_stealth(
let item_stealth_multiplier = stealth_multiplier_from_items(inventory);
let is_sneaking = character_state.map_or(false, |state| state.is_stealthy());
let mut multiplier = item_stealth_multiplier;
if is_sneaking {
multiplier *= SNEAK_MULTIPLIER;
}
let multiplier = item_stealth_multiplier * if is_sneaking { SNEAK_MULTIPLIER } else { 1.0 };
multiplier.clamp(0.0, 1.0)
}