auto-disable reactor overload inside vehicles (as there's infinite power anyway)

This commit is contained in:
yuni 2024-10-03 06:48:03 +02:00
parent 5597411bac
commit 8172af8084

View file

@ -355,8 +355,10 @@ pub fn update_physics_lifeforms(
&Position, &Position,
Option<&Player>, Option<&Player>,
)>, )>,
q_bike: Query<&PlayerDrivesThis>,
) { ) {
let d = time.delta_seconds(); let d = time.delta_seconds();
let inside_vehicle = !q_bike.is_empty();
for (mut lifeform, mut hp, mut suit, velocity, pos, player) in query.iter_mut() { for (mut lifeform, mut hp, mut suit, velocity, pos, player) in query.iter_mut() {
if lifeform.adrenaline_jolt.abs() > 1e-3 { if lifeform.adrenaline_jolt.abs() > 1e-3 {
lifeform.adrenaline_jolt *= 0.99; lifeform.adrenaline_jolt *= 0.99;
@ -371,7 +373,7 @@ pub fn update_physics_lifeforms(
(lifeform.adrenaline - 0.0001 + lifeform.adrenaline_jolt * 0.01).clamp(0.0, 1.0); (lifeform.adrenaline - 0.0001 + lifeform.adrenaline_jolt * 0.01).clamp(0.0, 1.0);
if player.is_some() { if player.is_some() {
lifeform.is_radioactively_damaged = if settings.reactor_state == 2 { lifeform.is_radioactively_damaged = if !inside_vehicle && settings.reactor_state == 2 {
true true
} else if let Some(pos_jupiter) = id2pos.0.get(cmd::ID_JUPITER) { } else if let Some(pos_jupiter) = id2pos.0.get(cmd::ID_JUPITER) {
pos_jupiter.distance(pos.0) < 140_000_000.0 pos_jupiter.distance(pos.0) < 140_000_000.0