Skip to content

Commit

Permalink
updates for bevy 0.14
Browse files Browse the repository at this point in the history
  • Loading branch information
its-danny committed Nov 16, 2024
1 parent 5d77876 commit 6b42d54
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 12 deletions.
7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ license = "MIT OR Apache-2.0"
keywords = ["gamedev", "bevy", "networking", "telnet", "mud"]

[dependencies]
bevy = { version = "0.12", default-features = false }
bevy = { version = "0.14", default-features = false }
crossbeam-channel = "0.5"
dashmap = "5.5"
thiserror = "1.0"
dashmap = "6.1"
thiserror = "2.0"
tokio = { version = "1.33", features = ["io-util", "net", "rt-multi-thread"] }
uuid = { version = "1.11.0", features = ["v4"] }

[dev-dependencies]
rusty-hook = "0.11"
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

| `bevy` | `bevy-nest` |
| :----: | :---------: |
| 0.14 | 0.4 |
| 0.12 | 0.3 |
| 0.11 | 0.2 |
| 0.10 | 0.1 |
Expand All @@ -21,7 +22,7 @@
Add `bevy-nest` to your `Cargo.toml`:

```toml
bevy-nest = "0.3"
bevy-nest = "0.4"
```

## Usage
Expand Down
4 changes: 2 additions & 2 deletions examples/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ fn main() {
.add_plugins((
LogPlugin::default(),
TaskPoolPlugin::default(),
TypeRegistrationPlugin::default(),
TimePlugin::default(),
TypeRegistrationPlugin,
TimePlugin,
ScheduleRunnerPlugin::run_loop(Duration::from_secs_f64(1.0 / 60.0)),
NestPlugin,
))
Expand Down
10 changes: 5 additions & 5 deletions src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl From<Payload> for Message {
/// use bevy_nest::prelude::*;
///
/// fn read_inbox(mut inbox: EventReader<Inbox>) {
/// for message in inbox.iter() {
/// for message in inbox.read() {
/// // ...
/// }
/// }
Expand All @@ -97,7 +97,7 @@ pub struct Inbox {
/// use bevy_nest::prelude::*;
///
/// fn ping_pong(mut inbox: EventReader<Inbox>, mut outbox: EventWriter<Outbox>) {
/// for message in inbox.iter() {
/// for message in inbox.read() {
/// if let Message::Text(content) = &message.content {
/// if content == "ping" {
/// // There are a few ways to send messages to the outbox:
Expand Down Expand Up @@ -132,22 +132,22 @@ impl OutboxWriterExt for EventWriter<'_, Outbox> {
self.send(Outbox {
to,
content: Message::Text(text.into()),
})
});
}

/// Sends a [`Message::Command`] to a client.
fn send_command(&mut self, to: ClientId, command: impl Into<Vec<u8>>) {
self.send(Outbox {
to,
content: Message::Command(command.into()),
})
});
}

/// Sends a [`Message::GMCP`] to a client.
fn send_gmcp(&mut self, to: ClientId, payload: Payload) {
self.send(Outbox {
to,
content: Message::GMCP(payload),
})
});
}
}
3 changes: 2 additions & 1 deletion src/server.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
use std::sync::Arc;

use bevy::{prelude::*, utils::Uuid};
use bevy::prelude::*;
use dashmap::DashMap;
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
net::{TcpListener, ToSocketAddrs},
runtime::{Builder, Runtime},
task::JoinHandle,
};
use uuid::Uuid;

use crate::{
channel::Channel,
Expand Down

0 comments on commit 6b42d54

Please sign in to comment.