diff --git a/crates/ghostlight/src/lens.rs b/crates/ghostlight/src/lens.rs index ae2ae48..abe63b0 100644 --- a/crates/ghostlight/src/lens.rs +++ b/crates/ghostlight/src/lens.rs @@ -163,6 +163,16 @@ impl LensWeights { pub(crate) fn draws(&self) -> bool { self.0.values().any(|weight| *weight > 0) } + + /// Every stock lens weighs the same in both sets. A lens a map does not + /// name weighs zero, so `{charter: 3}` and `{patina: 0, charter: 3}` are + /// one set spelled two ways: they draw identically and neither replaces + /// the other. + pub(crate) fn weighs_the_same_as(&self, other: &LensWeights) -> bool { + Lens::ALL + .into_iter() + .all(|lens| self.get(lens) == other.get(lens)) + } } /// The draw's whole input: the world and the session's fixed identity. The diff --git a/crates/ghostlight/src/lib.rs b/crates/ghostlight/src/lib.rs index 98f458d..3c22493 100644 --- a/crates/ghostlight/src/lib.rs +++ b/crates/ghostlight/src/lib.rs @@ -680,10 +680,10 @@ pub enum CommandBody { }, /// Replaces the world's whole lens weight set. Owner only, in any phase, /// under genesis admission: a set that never draws is refused, and a zero - /// weight is admitted and never draws. A set equal to the current one - /// changes nothing canonical and is refused with `NoCanonicalChange` - /// after admission, so nothing commits. A session that already drew - /// keeps its recorded lens. + /// weight is admitted and never draws. A set that weighs every lens as + /// the current one does, however its map is spelled, changes nothing + /// canonical and is refused with `NoCanonicalChange` after admission, so + /// nothing commits. A session that already drew keeps its recorded lens. SetLensWeights { weights: LensWeights, }, @@ -1686,7 +1686,7 @@ fn reduce(state: &WorldState, command: &CommandEnvelope) -> Result