From d7c78cd1bd3e0e1a321a2a053b1efb0b0d1b0e66 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Sun, 23 Aug 2026 12:10:02 +0200 Subject: [PATCH] Remove player-authored noise from world news --- crates/ghostlight-dungeon/src/surface.rs | 63 ++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/crates/ghostlight-dungeon/src/surface.rs b/crates/ghostlight-dungeon/src/surface.rs index 465d4e5..31b906c 100644 --- a/crates/ghostlight-dungeon/src/surface.rs +++ b/crates/ghostlight-dungeon/src/surface.rs @@ -105,6 +105,11 @@ pub fn player_surface_for_actor( .iter() .rev() .filter(|event| !reported_event_ids.contains(&event.id)) + .filter(|event| { + event.kind != "reaction_wave" + && event.kind != "group_travel" + && !event.actor_ids.iter().any(|actor_id| actor_id == viewer_actor_id) + }) .filter(|event| { player_profile.is_some_and(|profile| { crate::scheduler::subject_perceives_event( @@ -633,6 +638,64 @@ mod tests { assert!(!encoded.contains("SECRET_REMOTE_EVENT")); } + #[test] + fn player_surface_news_omits_the_viewers_own_turn_and_travel_noise() { + let mut campaign = crate::resolution::tests::campaign(1, 1); + campaign.events.extend([ + crate::domain::Event { + id: "event:own-activity".into(), + at: Utc::now(), + kind: "actor_activity".into(), + summary: "PLAYER_PRIVATE_ACTIVITY_SUMMARY".into(), + actor_ids: vec!["player".into()], + institution_ids: vec![], + gestalt_ids: vec![], + location_ids: vec!["center".into()], + public_channels: vec![], + }, + crate::domain::Event { + id: "event:reaction".into(), + at: Utc::now(), + kind: "reaction_wave".into(), + summary: "PLAYER_SPEECH_DUPLICATE".into(), + actor_ids: vec!["faction-0000".into()], + institution_ids: vec![], + gestalt_ids: vec![], + location_ids: vec!["center".into()], + public_channels: vec![], + }, + crate::domain::Event { + id: "event:travel".into(), + at: Utc::now(), + kind: "group_travel".into(), + summary: "PLAYER_TRAVEL_DUPLICATE".into(), + actor_ids: vec!["player".into()], + institution_ids: vec![], + gestalt_ids: vec![], + location_ids: vec!["center".into()], + public_channels: vec![], + }, + crate::domain::Event { + id: "event:other".into(), + at: Utc::now(), + kind: "institution_action".into(), + summary: "The local watch reinforces the gate.".into(), + actor_ids: vec![], + institution_ids: vec!["faction-0000".into()], + gestalt_ids: vec![], + location_ids: vec!["center".into()], + public_channels: vec![], + }, + ]); + + let encoded = serde_json::to_string(&player_surface(&campaign, &[])).unwrap(); + + assert!(!encoded.contains("PLAYER_PRIVATE_ACTIVITY_SUMMARY")); + assert!(!encoded.contains("PLAYER_SPEECH_DUPLICATE")); + assert!(!encoded.contains("PLAYER_TRAVEL_DUPLICATE")); + assert!(encoded.contains("The local watch reinforces the gate.")); + } + #[test] fn player_surface_offers_only_local_population_fission_targets() { let mut campaign = crate::resolution::tests::campaign(1, 1);