Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
docs: update example
Browse files Browse the repository at this point in the history
  • Loading branch information
simbleau committed Jan 7, 2024
1 parent 24d66f5 commit e7a7b9b
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,10 @@ use protocol::MyPacket;
fn main() {
App::new()
.add_plugins(MinimalPlugins)
.add_plugins(SilkServerPlugin {
port: 3536,
tick_rate: 1.0, // run the networking SilkSchedule systems once a second
})
.add_plugins(SilkServerPlugin { port: 3536 })
.add_network_message::<MyPacket>()
.add_systems(
SilkSchedule,
Update,
|reader: NetworkReader<MyPacket>, writer: NetworkWriter<MyPacket>| {
for (peer_id, packet) in reader.read() {
if let MyPacket::Ping = packet {
Expand All @@ -84,7 +81,6 @@ fn main() {
}
}
}
.in_set(SilkSet::Update), // Optional: When to run your system
)
.run();
}
Expand All @@ -101,7 +97,7 @@ fn main() {
.add_plugins(SilkClientPlugin)
.add_network_message::<Chat>()
.add_systems(
SilkSchedule,
Update,
|reader: NetworkReader<MyPacket>| {
for (peer_id, packet) in reader.read() {
if let MyPacket::Pong = packet {
Expand Down

0 comments on commit e7a7b9b

Please sign in to comment.