MONKEY (reviewfix-a): capture camera area folded into update_current_area

A separate system added 10 unordered pairs to Update (schedule ambiguity
ceiling test). Same behaviour; the recapture is identical.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pkuzic
2026-09-26 03:01:01 +01:00
co-authored by Claude Opus 5.5
parent ac9a1ef390
commit 5b1de75cf7
2 changed files with 19 additions and 16 deletions
+1 -2
View File
@@ -446,8 +446,7 @@ impl Plugin for TerrainPlugin {
update_current_area
.after(crate::wmo_portal::WmoPvsSet)
.in_set(AreaAuthoritySet),
)
.add_systems(Update, queries::update_capture_camera_area.in_set(AreaAuthoritySet));
);
}
}
@@ -21,21 +21,15 @@ pub struct CurrentArea(pub Option<u32>);
#[derive(Resource, Default, PartialEq, Eq)]
pub struct CaptureCameraArea(pub Option<u32>);
/// MONKEY (reviewfix-a): see [`CaptureCameraArea`].
pub(super) fn update_capture_camera_area(
mut out: ResMut<CaptureCameraArea>,
focus: Res<crate::terrain_stream::ViewFocus>,
streamer: Res<TerrainStreamer>,
adt_tiles: Res<Assets<AdtTile>>,
camera: Query<&GlobalTransform, With<crate::view::WorldCamera>>,
mut capture: Local<Option<bool>>,
/// MONKEY (reviewfix-a): see [`CaptureCameraArea`]; a helper of [`update_current_area`] (one
/// system, so the schedule gains no new unordered pairs).
fn capture_camera_area(
out: &mut CaptureCameraArea,
streamer: &TerrainStreamer,
adt_tiles: &Assets<AdtTile>,
eye: Option<Vec3>,
) {
if !*capture.get_or_insert_with(|| std::env::var_os("WOW_CAPTURE").is_some())
|| focus.body_pos().is_some()
{
return;
}
let Some(eye) = camera.iter().next().map(GlobalTransform::translation) else {
let Some(eye) = eye else {
return;
};
let wow = bevy_to_wow(eye);
@@ -155,8 +149,18 @@ pub(super) fn update_current_area(
adt_tiles: Res<Assets<AdtTile>>,
interior: Res<crate::wmo_portal::CurrentAreaInterior>,
wmo_areas: Option<Res<crate::wmo_portal::WmoAreas>>,
// MONKEY (reviewfix-a): the capture-only camera area (absent in unit-test worlds).
capture_area: Option<ResMut<CaptureCameraArea>>,
camera: Query<&GlobalTransform, With<crate::view::WorldCamera>>,
mut capture: Local<Option<bool>>,
) {
let Some(wow) = focus.body_pos() else {
if let Some(mut out) = capture_area {
if *capture.get_or_insert_with(|| std::env::var_os("WOW_CAPTURE").is_some()) {
let eye = camera.iter().next().map(GlobalTransform::translation);
capture_camera_area(&mut out, &streamer, &adt_tiles, eye);
}
}
// No avatar: the area dies with the character session, or the next login reads this
// character's zone. `body_pos()` is `None` at both glue screens; a recoverable disconnect
// keeps the body, and the area with it.