Expand description
Bounded next-frame messages shared by native gameplay scripts.
Sending writes to a pending buffer. SignalBus::begin_frame publishes that
buffer before script callbacks, so delivery is independent of script ordering.
Every receiver may read the same event; reads do not consume messages. Process
one-shot reactions in Script::update, since fixed steps share the same inbox.
Signals are runtime-only and are omitted from scene JSON/snapshots.
use kvas_engine::signals::SignalBus;
let mut bus = SignalBus::with_capacity(16);
bus.send("door.open", serde_json::json!({"key": 3}), None, None).unwrap();
assert!(bus.incoming().is_empty());
bus.begin_frame();
assert_eq!(bus.channel("door.open").count(), 1);
bus.begin_frame();
assert!(bus.incoming().is_empty());Structs§
- Signal
- One immutable delivered message, with a sequence unique within its bus.
- Signal
Bus - Double-buffered message service owned by a
crate::scene::Scene. Each buffer is limited independently, so at most twicecapacity()events are retained. Payload sizes are caller-owned; no background/global state exists.
Enums§
- Signal
Error - A message was rejected without changing either buffer or consuming a sequence.