Persona wake: the open floor has one form gate and one speaker gate, and its once-per-line and tagged-line cases are pinned
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
64e61dd20e
commit
de720eacef
2 changed files with 16 additions and 3 deletions
|
|
@ -542,7 +542,7 @@ pub(crate) fn wakes(who: &Addressee, delivery: &ChatDelivery, speaker: Speaker,
|
||||||
}
|
}
|
||||||
let addressed = is_for(who, delivery);
|
let addressed = is_for(who, delivery);
|
||||||
if speaker.human() {
|
if speaker.human() {
|
||||||
let wakes = addressed || facts.own_room || facts.in_exchange || (speaker == Speaker::Member && facts.open_floor);
|
let wakes = addressed || facts.own_room || facts.in_exchange || facts.open_floor;
|
||||||
return wakes.then_some(if addressed { WakeCause::AddressedByHuman } else { WakeCause::Human });
|
return wakes.then_some(if addressed { WakeCause::AddressedByHuman } else { WakeCause::Human });
|
||||||
}
|
}
|
||||||
let explicit = delivery.mentions.iter().any(|id| id == who.matrix_id()) || matches!(delivery.basis, Some(Basis::Tag | Basis::Reply));
|
let explicit = delivery.mentions.iter().any(|id| id == who.matrix_id()) || matches!(delivery.basis, Some(Basis::Tag | Basis::Reply));
|
||||||
|
|
@ -563,9 +563,8 @@ pub(crate) struct Hearer<'a> {
|
||||||
/// (`tempo::pick`) among the hearers whose floor is open, so the poll and the simulator choose the same one. None when the
|
/// (`tempo::pick`) among the hearers whose floor is open, so the poll and the simulator choose the same one. None when the
|
||||||
/// line is not open or no hearer is eligible.
|
/// line is not open or no hearer is eligible.
|
||||||
pub(crate) fn floor_to(hearers: &[Hearer], speaker: Speaker, beat_s: u32) -> Option<usize> {
|
pub(crate) fn floor_to(hearers: &[Hearer], speaker: Speaker, beat_s: u32) -> Option<usize> {
|
||||||
let line = &hearers.first()?.delivery;
|
hearers.first()?;
|
||||||
let open = speaker == Speaker::Member
|
let open = speaker == Speaker::Member
|
||||||
&& line.form == Form::Message
|
|
||||||
&& !hearers.iter().any(|hearer| hearer.delivery.is_direct || !hearer.delivery.mentions.is_empty() || is_for(hearer.addressee, &hearer.delivery));
|
&& !hearers.iter().any(|hearer| hearer.delivery.is_direct || !hearer.delivery.mentions.is_empty() || is_for(hearer.addressee, &hearer.delivery));
|
||||||
if !open {
|
if !open {
|
||||||
return None;
|
return None;
|
||||||
|
|
|
||||||
|
|
@ -880,6 +880,20 @@ mod wake_rule {
|
||||||
assert_eq!(rig.poll(), Outcome::Polled { launched: vec![Slug("bob".into())] }, "unless the line addresses her");
|
assert_eq!(rig.poll(), Outcome::Polled { launched: vec![Slug("bob".into())] }, "unless the line addresses her");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn every_open_line_a_mind_took_in_one_wake_is_taken_and_a_line_tagging_anyone_is_not_open() {
|
||||||
|
let rig = quiet_rig();
|
||||||
|
said_in_general(&rig, general(1, "@newcomer:chat", "hello everyone!"));
|
||||||
|
said_in_general(&rig, general(2, "@other:chat", "hello, I am new too"));
|
||||||
|
assert_eq!(rig.poll(), Outcome::Polled { launched: vec![Slug("ann".into())] });
|
||||||
|
rig.end_unit(ANN);
|
||||||
|
rig.advance(1);
|
||||||
|
assert_eq!(rig.poll(), Outcome::Polled { launched: vec![] }, "her one turn took both lines: Bob is not picked for the second");
|
||||||
|
let rig = quiet_rig();
|
||||||
|
said_in_general(&rig, ChatDelivery { mentions: vec!["@alice:chat".into()], ..general(3, "@newcomer:chat", "hello alice") });
|
||||||
|
assert_eq!(rig.poll(), Outcome::Polled { launched: vec![] }, "a line that tags a person is not the floor's");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_minds_own_line_a_notice_an_edit_a_tag_or_an_operator_opens_no_floor() {
|
fn a_minds_own_line_a_notice_an_edit_a_tag_or_an_operator_opens_no_floor() {
|
||||||
for (line, why) in [
|
for (line, why) in [
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue