- Engine creates GossipBridge and returns it via NetworkingStarted event - NetworkingManager forwards incoming gossip → GossipBridge.push_incoming() - NetworkingManager polls GossipBridge.try_recv_outgoing() → broadcasts via iroh - Bevy inserts GossipBridge resource when networking starts - Added Debug impl for GossipBridge Fixes gossip layer connectivity between iroh network and Bevy sync systems. References: #131, #132 Signed-off-by: Sienna Meridian Satterwhite <sienna@r3t.io>
72 lines
1.3 KiB
Rust
72 lines
1.3 KiB
Rust
//! Events emitted from the Core Engine to Bevy
|
|
|
|
use crate::networking::{NodeId, SessionId, VectorClock};
|
|
use bevy::prelude::*;
|
|
use uuid::Uuid;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub enum EngineEvent {
|
|
// Networking status
|
|
NetworkingStarted {
|
|
session_id: SessionId,
|
|
node_id: NodeId,
|
|
bridge: crate::networking::GossipBridge,
|
|
},
|
|
NetworkingFailed {
|
|
error: String,
|
|
},
|
|
NetworkingStopped,
|
|
SessionJoined {
|
|
session_id: SessionId,
|
|
},
|
|
SessionLeft,
|
|
|
|
// Peer events
|
|
PeerJoined {
|
|
node_id: NodeId,
|
|
},
|
|
PeerLeft {
|
|
node_id: NodeId,
|
|
},
|
|
|
|
// CRDT sync events
|
|
EntitySpawned {
|
|
entity_id: Uuid,
|
|
position: Vec3,
|
|
rotation: Quat,
|
|
version: VectorClock,
|
|
},
|
|
EntityUpdated {
|
|
entity_id: Uuid,
|
|
position: Vec3,
|
|
rotation: Quat,
|
|
version: VectorClock,
|
|
},
|
|
EntityDeleted {
|
|
entity_id: Uuid,
|
|
version: VectorClock,
|
|
},
|
|
|
|
// Lock events
|
|
LockAcquired {
|
|
entity_id: Uuid,
|
|
holder: NodeId,
|
|
},
|
|
LockReleased {
|
|
entity_id: Uuid,
|
|
},
|
|
LockDenied {
|
|
entity_id: Uuid,
|
|
current_holder: NodeId,
|
|
},
|
|
LockExpired {
|
|
entity_id: Uuid,
|
|
},
|
|
|
|
// Clock events
|
|
ClockTicked {
|
|
sequence: u64,
|
|
clock: VectorClock,
|
|
},
|
|
}
|