Publish 0.3.1 fleet metadata#1
Conversation
Full underwater room system with: - UnderwaterRoom struct with sonar physics simulation - Fish schools, seabed features, bioluminescence - Jerlov water type classification with attenuation - UnderwaterRoomBuilder for ocean → column → seabed chains - 8 unit tests covering physics, descriptions, conversion Integration: rooms push into holodeck Room graph with 5 gauges
| pub fn to_holodeck_room(&self, id: &str, name: &str) -> Room { | ||
| let mut room = Room::new(id, name, &self.generate_description()); | ||
| room.data_source = DataSource::Sim; | ||
| room.add_gauge(Gauge::new("depth", "m", 0.0, 100.0)); | ||
| room.add_gauge(Gauge::new("temperature", "°C", -5.0, 40.0)); | ||
| room.add_gauge(Gauge::new("visibility", "m", 0.0, 50.0)); | ||
| room.add_gauge(Gauge::new("ambient_light", "%", 0.0, 1.0)); | ||
| room.add_gauge(Gauge::new("bioluminescence", "", 0.0, 1.0)); | ||
| room | ||
| } |
There was a problem hiding this comment.
🟡 Gauges in to_holodeck_room are never initialized with the UnderwaterRoom's computed values
to_holodeck_room at src/sonar_vision.rs:134-143 creates five gauges (depth, temperature, visibility, ambient_light, bioluminescence) but never calls gauge.update(value) to set them from the UnderwaterRoom's already-computed fields (self.depth, self.temperature_c, self.visibility_m, self.ambient_light, self.bioluminescence). Since Gauge::new initializes value: 0.0 (src/gauge.rs:24), all gauges will display 0.0 when a player runs look in any underwater room. The Room::look method (src/room.rs:79-81) iterates over gauges and calls gauge.display(), which uses self.value, so a 50m-deep room would show depth: 0.00m, temperature: 0.00°C, etc.
| pub fn to_holodeck_room(&self, id: &str, name: &str) -> Room { | |
| let mut room = Room::new(id, name, &self.generate_description()); | |
| room.data_source = DataSource::Sim; | |
| room.add_gauge(Gauge::new("depth", "m", 0.0, 100.0)); | |
| room.add_gauge(Gauge::new("temperature", "°C", -5.0, 40.0)); | |
| room.add_gauge(Gauge::new("visibility", "m", 0.0, 50.0)); | |
| room.add_gauge(Gauge::new("ambient_light", "%", 0.0, 1.0)); | |
| room.add_gauge(Gauge::new("bioluminescence", "", 0.0, 1.0)); | |
| room | |
| } | |
| pub fn to_holodeck_room(&self, id: &str, name: &str) -> Room { | |
| let mut room = Room::new(id, name, &self.generate_description()); | |
| room.data_source = DataSource::Sim; | |
| let mut g_depth = Gauge::new("depth", "m", 0.0, 100.0); | |
| g_depth.update(self.depth); | |
| room.add_gauge(g_depth); | |
| let mut g_temp = Gauge::new("temperature", "°C", -5.0, 40.0); | |
| g_temp.update(self.temperature_c); | |
| room.add_gauge(g_temp); | |
| let mut g_vis = Gauge::new("visibility", "m", 0.0, 50.0); | |
| g_vis.update(self.visibility_m); | |
| room.add_gauge(g_vis); | |
| let mut g_light = Gauge::new("ambient_light", "%", 0.0, 1.0); | |
| g_light.update(self.ambient_light); | |
| room.add_gauge(g_light); | |
| let mut g_bio = Gauge::new("bioluminescence", "", 0.0, 1.0); | |
| g_bio.update(if self.bioluminescence { 1.0 } else { 0.0 }); | |
| room.add_gauge(g_bio); | |
| room | |
| } |
Was this helpful? React with 👍 or 👎 to provide feedback.
Update Cargo.toml description to match GitHub, add 🦐 fleet badge to README.