Implement production vertical slice foundation
This commit is contained in:
1 parent
9d4a89f355
commit
a18e82eb44
104 files changed
+10595
-268
No files matched your search
@@ -0,0 +1,125 @@
|
||||
class_name ResolvedDiveRules
|
||||
extends RefCounted
|
||||
|
||||
var battery_capacity_kwh: float
|
||||
var oxygen_capacity_l: float
|
||||
var oxygen_consumption_l_per_min: float
|
||||
var hull_max_integrity: float
|
||||
|
||||
var certified_depth_m: float
|
||||
var critical_depth_m: float
|
||||
var crush_depth_m: float
|
||||
var certified_pressure_bar: float
|
||||
var critical_pressure_bar: float
|
||||
var crush_pressure_bar: float
|
||||
|
||||
var longitudinal_power_kw: float
|
||||
var steering_power_kw: float
|
||||
var vertical_power_kw: float
|
||||
var high_thrust_power_kw: float
|
||||
var return_energy_kwh_per_m: float
|
||||
var ascent_energy_kwh_per_m: float
|
||||
|
||||
var pressure_damage_multiplier: float
|
||||
var collision_damage_multiplier: float
|
||||
var collision_speed_threshold_mps: float
|
||||
var collision_damage_per_excess_mps: float
|
||||
var collision_repeat_delay_seconds: float
|
||||
var crush_grace_seconds: float
|
||||
|
||||
var attention_ratio: float
|
||||
var return_ratio: float
|
||||
var critical_ratio: float
|
||||
var ejection_hold_seconds: float
|
||||
|
||||
|
||||
func _init(
|
||||
p_battery_capacity_kwh: float,
|
||||
p_oxygen_capacity_l: float,
|
||||
p_oxygen_consumption_l_per_min: float,
|
||||
p_hull_max_integrity: float,
|
||||
p_certified_depth_m: float,
|
||||
p_longitudinal_power_kw: float,
|
||||
p_steering_power_kw: float,
|
||||
p_vertical_power_kw: float,
|
||||
p_high_thrust_power_kw: float,
|
||||
p_return_energy_kwh_per_m: float,
|
||||
p_ascent_energy_kwh_per_m: float,
|
||||
p_pressure_damage_multiplier: float,
|
||||
p_collision_damage_multiplier: float,
|
||||
p_collision_speed_threshold_mps: float,
|
||||
p_collision_damage_per_excess_mps: float,
|
||||
p_collision_repeat_delay_seconds: float,
|
||||
p_crush_grace_seconds: float,
|
||||
p_attention_ratio: float,
|
||||
p_return_ratio: float,
|
||||
p_critical_ratio: float,
|
||||
p_ejection_hold_seconds: float
|
||||
) -> void:
|
||||
battery_capacity_kwh = p_battery_capacity_kwh
|
||||
oxygen_capacity_l = p_oxygen_capacity_l
|
||||
oxygen_consumption_l_per_min = p_oxygen_consumption_l_per_min
|
||||
hull_max_integrity = p_hull_max_integrity
|
||||
certified_depth_m = p_certified_depth_m
|
||||
critical_depth_m = certified_depth_m * 1.15
|
||||
crush_depth_m = certified_depth_m * 1.25
|
||||
certified_pressure_bar = _pressure_at_depth(certified_depth_m)
|
||||
critical_pressure_bar = _pressure_at_depth(critical_depth_m)
|
||||
crush_pressure_bar = _pressure_at_depth(crush_depth_m)
|
||||
longitudinal_power_kw = p_longitudinal_power_kw
|
||||
steering_power_kw = p_steering_power_kw
|
||||
vertical_power_kw = p_vertical_power_kw
|
||||
high_thrust_power_kw = p_high_thrust_power_kw
|
||||
return_energy_kwh_per_m = p_return_energy_kwh_per_m
|
||||
ascent_energy_kwh_per_m = p_ascent_energy_kwh_per_m
|
||||
pressure_damage_multiplier = p_pressure_damage_multiplier
|
||||
collision_damage_multiplier = p_collision_damage_multiplier
|
||||
collision_speed_threshold_mps = p_collision_speed_threshold_mps
|
||||
collision_damage_per_excess_mps = p_collision_damage_per_excess_mps
|
||||
collision_repeat_delay_seconds = p_collision_repeat_delay_seconds
|
||||
crush_grace_seconds = p_crush_grace_seconds
|
||||
attention_ratio = p_attention_ratio
|
||||
return_ratio = p_return_ratio
|
||||
critical_ratio = p_critical_ratio
|
||||
ejection_hold_seconds = p_ejection_hold_seconds
|
||||
|
||||
|
||||
func validation_error() -> String:
|
||||
for positive_value: float in [
|
||||
battery_capacity_kwh,
|
||||
oxygen_capacity_l,
|
||||
oxygen_consumption_l_per_min,
|
||||
hull_max_integrity,
|
||||
certified_depth_m,
|
||||
longitudinal_power_kw,
|
||||
return_energy_kwh_per_m,
|
||||
collision_speed_threshold_mps,
|
||||
collision_damage_per_excess_mps,
|
||||
collision_repeat_delay_seconds,
|
||||
crush_grace_seconds,
|
||||
ejection_hold_seconds,
|
||||
]:
|
||||
if not is_finite(positive_value) or positive_value <= 0.0:
|
||||
return "resolved positive values must be finite and greater than zero"
|
||||
for non_negative_value: float in [
|
||||
steering_power_kw,
|
||||
vertical_power_kw,
|
||||
high_thrust_power_kw,
|
||||
ascent_energy_kwh_per_m,
|
||||
]:
|
||||
if not is_finite(non_negative_value) or non_negative_value < 0.0:
|
||||
return "resolved non-negative values must be finite"
|
||||
if not (
|
||||
critical_ratio > 0.0
|
||||
and critical_ratio < return_ratio
|
||||
and return_ratio < attention_ratio
|
||||
and attention_ratio < 1.0
|
||||
):
|
||||
return "alert ratios must be ordered between zero and one"
|
||||
if pressure_damage_multiplier <= 0.0 or collision_damage_multiplier <= 0.0:
|
||||
return "damage multipliers must be positive"
|
||||
return ""
|
||||
|
||||
|
||||
static func _pressure_at_depth(depth_m: float) -> float:
|
||||
return 1.0 + depth_m / 10.0
|
||||
Reference in new issue
Block a user