feat(simulation): add NPC name masking with role labels and color index

Server-side infrastructure for information asymmetry in dialogue.
NPCs display role labels (Worker, Supervisor, Patron) instead of
real names until the player explicitly learns them via KG lookup.
NpcColorIndex (stable_id % 8) persists across name reveal.

ConversationEvent and DialogueResponseEvent carry display names +
color indices on the wire with serde(default) for compat.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-21 13:42:59 +01:00
co-authored by Claude Opus 4.6
parent 82e58559ba
commit 28e7e6d9ad
12 changed files with 446 additions and 63 deletions
+13 -13
View File
@@ -86,13 +86,13 @@ pub struct MoodState {
/// the distinction matters for behavior but not for line selection.
pub fn mood_to_content_mood(mood: NpcMood) -> ContentMood {
match mood {
NpcMood::Neutral => ContentMood::Comfortable,
NpcMood::Anxious => ContentMood::Worried,
NpcMood::Frustrated => ContentMood::Conflicted,
NpcMood::Neutral => ContentMood::Content,
NpcMood::Anxious => ContentMood::Anxious,
NpcMood::Frustrated => ContentMood::Frustrated,
NpcMood::Content => ContentMood::Relieved,
NpcMood::Suspicious => ContentMood::Suspicious,
NpcMood::Warm => ContentMood::Fond,
NpcMood::Hostile => ContentMood::Concerned,
NpcMood::Warm => ContentMood::Warm,
NpcMood::Hostile => ContentMood::Hostile,
NpcMood::Focused => ContentMood::Focused,
}
}
@@ -425,13 +425,13 @@ mod tests {
}
#[test]
fn mood_mapping_anxious_is_worried() {
assert_eq!(mood_to_content_mood(NpcMood::Anxious), ContentMood::Worried);
fn mood_mapping_anxious_is_anxious() {
assert_eq!(mood_to_content_mood(NpcMood::Anxious), ContentMood::Anxious);
}
#[test]
fn mood_mapping_warm_is_fond() {
assert_eq!(mood_to_content_mood(NpcMood::Warm), ContentMood::Fond);
fn mood_mapping_warm_is_warm() {
assert_eq!(mood_to_content_mood(NpcMood::Warm), ContentMood::Warm);
}
#[test]
@@ -480,7 +480,7 @@ mod tests {
assert_eq!(mood_state.mood, NpcMood::Hostile);
let current_mood = world.get::<CurrentMood>(npc).unwrap();
assert_eq!(current_mood.0, ContentMood::Concerned);
assert_eq!(current_mood.0, ContentMood::Hostile);
}
#[test]
@@ -602,7 +602,7 @@ mod tests {
Npc,
ActiveSim,
MoodState::default(),
CurrentMood::default(), // Starts at Comfortable
CurrentMood::default(), // Starts at Content
ToleranceThreshold {
current_stress: 70,
threshold: 100, // → Anxious (70% of 100)
@@ -615,8 +615,8 @@ mod tests {
schedule.run(&mut world);
let current_mood = world.get::<CurrentMood>(npc).unwrap();
// Anxious maps to Worried
assert_eq!(current_mood.0, ContentMood::Worried);
// Anxious maps to Anxious
assert_eq!(current_mood.0, ContentMood::Anxious);
}
#[test]