fix(planets): wire planet_radius_factor UI slider into orbit radii
The "Radius factor k" UI slider wrote params.planet_radius_factor and triggered respawn via the dirty flag, but spawn_planet_system ignored it — every planet's radius_factor came from rng.gen_range(2.0..4.0), so the slider was a silent no-op (it changed the ISCO readout label and respawned, but the actual orbit radii never reflected its value). Now samples radius_factor as planet_radius_factor ± 0.75, so the slider controls the orbital scale while preserving per-planet radius diversity (no fully-identical radii). Clamped to >=1.0 so jitter near the slider's low end can't drop a planet inside the ISCO. Caught by the Phase 3.4 final code review.
This commit is contained in:
parent
b787a4c54c
commit
40ff101b6d
@ -172,7 +172,10 @@ pub fn spawn_planet_system(
|
||||
let inclination = rng.gen_range(0.0..PI);
|
||||
let longitude = rng.gen_range(0.0..TAU);
|
||||
let phase = rng.gen_range(0.0..TAU);
|
||||
let radius_factor = rng.gen_range(2.0..4.0);
|
||||
// 半径因子以 UI 的 planet_radius_factor 为中心 ±0.75 散布, 既让滑条
|
||||
// 真正控制轨道尺度, 又保留 per-planet 半径多样性 (避免全同半径).
|
||||
// 滑条范围 1.5..=5.0, 散布后实际 k ∈ [0.75, 5.75], 钳到 ISCO 外.
|
||||
let radius_factor = (params.planet_radius_factor + rng.gen_range(-0.75..0.75)).max(1.0);
|
||||
// 颜色: 暖色行星 (橙/红/黄系), 避开蓝色 (易与背景星混淆)
|
||||
let hue = rng.gen_range(0.02..0.13);
|
||||
let color = hsv_to_rgb(hue, rng.gen_range(0.5..0.9), rng.gen_range(0.7..1.0));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user