|
|
|
|
@ -14,7 +14,6 @@ impl Plugin for ClientPlugin { |
|
|
|
|
app.add_plugins(super::ProtocolPlugin); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
app.add_observer(on_connecting); |
|
|
|
|
app.add_observer(on_connected); |
|
|
|
|
app.add_observer(on_disconnected); |
|
|
|
|
|
|
|
|
|
@ -35,14 +34,6 @@ fn autoconnect_host_client(event: On<Add, server::Started>, mut commands: Comman |
|
|
|
|
.trigger(|entity| Connect { entity }); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn on_connecting(event: On<Add, Connecting>, clients: Query<(), With<Client>>) { |
|
|
|
|
let client = event.entity; |
|
|
|
|
if !clients.contains(client) { |
|
|
|
|
return; // Not a client we started. (server-side?)
|
|
|
|
|
}; |
|
|
|
|
info!("Client '{client}' connecting ..."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
fn on_connected(event: On<Add, Connected>, clients: Query<(), With<Client>>) { |
|
|
|
|
let client = event.entity; |
|
|
|
|
if !clients.contains(client) { |
|
|
|
|
|