Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

Commit 7d3911c

Browse files
authored
feat(bevy): Update to bevy 0.16 (#116)
* feat(bevy): Update to bevy 0.12.1 * update tests * fix imports for trace feature
1 parent d9181ee commit 7d3911c

File tree

13 files changed

+35
-41
lines changed

13 files changed

+35
-41
lines changed

Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "big-brain"
3-
version = "0.22.0"
3+
version = "0.23.0"
44
authors = ["Kat Marchán <[email protected]>"]
55
edition = "2021"
66
description = "Rusty Utility AI library"
@@ -15,11 +15,11 @@ homepage = "https://github.com/zkat/big-brain"
1515
[workspace]
1616

1717
[dependencies]
18-
bevy = { version = "0.15.0", default-features = false }
19-
big-brain-derive = { version = "=0.22.0", path = "./derive" }
18+
bevy = { version = "0.16.0", default-features = false, features = ["bevy_log"] }
19+
big-brain-derive = { version = "=0.23.0", path = "./derive" }
2020

2121
[dev-dependencies]
22-
bevy = { version = "0.15.0", default-features = true }
22+
bevy = { version = "0.16.0", default-features = true }
2323
rand = { version = "0.8.5", features = ["small_rng"] }
2424

2525
[features]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ fn main() {
129129

130130
#### bevy version and MSRV
131131

132-
The current version of `big-brain` is compatible with `bevy` 0.15.0.
132+
The current version of `big-brain` is compatible with `bevy` 0.16.0.
133133

134134
The Minimum Supported Rust Version for `big-brain` should be considered to
135135
be the same as `bevy`'s, which as of the time of this writing was "the

derive/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "big-brain-derive"
3-
version = "0.22.0"
3+
version = "0.23.0"
44
authors = ["Kat Marchán <[email protected]>"]
55
description = "Procedural macros to simplify implementation of Big Brain traits"
66
documentation = "https://docs.rs/big-brain-derive"

examples/concurrent.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
77
use bevy::log::LogPlugin;
88
use bevy::prelude::*;
9-
use bevy::utils::tracing::debug;
109
use big_brain::prelude::*;
1110
use rand::rngs::SmallRng;
1211
use rand::{Rng, SeedableRng};

examples/custom_measure.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! This example demonstrates how to build a custom measure and use that
22
//! in a Thinker.
33
4+
use bevy::ecs::component::Mutable;
45
use bevy::log::LogPlugin;
56
use bevy::prelude::*;
6-
use bevy::utils::tracing::debug;
77
use big_brain::prelude::*;
88
use big_brain::scorers::MeasuredScorer;
99

@@ -81,7 +81,7 @@ pub struct EatWaffles;
8181

8282
fn eat_thing_action<
8383
TActionMarker: std::fmt::Debug + Component,
84-
TActorMarker: Component + EatFood,
84+
TActorMarker: Component<Mutability = Mutable> + EatFood,
8585
>(
8686
time: Res<Time>,
8787
mut items: Query<&mut TActorMarker>,

examples/farming_sim.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -483,6 +483,7 @@ fn init_entities(
483483
commands.insert_resource(AmbientLight {
484484
color: Color::WHITE,
485485
brightness: 700.0,
486+
..default()
486487
});
487488

488489
commands.spawn((

examples/one_off.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use bevy::log::LogPlugin;
22
use bevy::prelude::*;
3-
use bevy::utils::tracing::{debug, trace};
43
use big_brain::prelude::*;
54

65
#[derive(Clone, Component, Debug, ActionBuilder)]

examples/sequence.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
99
use bevy::log::LogPlugin;
1010
use bevy::prelude::*;
11-
use bevy::utils::tracing::{debug, trace};
1211
use big_brain::prelude::*;
1312

1413
/// First, we make a simple Position component.

examples/thirst.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use bevy::log::LogPlugin;
22
use bevy::prelude::*;
3-
use bevy::utils::tracing::{debug, trace};
43
use big_brain::prelude::*;
54

65
// First, we define a "Thirst" component and associated system. This is NOT

src/actions.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
use std::sync::Arc;
44

55
use bevy::prelude::*;
6-
#[cfg(feature = "trace")]
7-
use bevy::utils::tracing::trace;
86

97
use crate::thinker::{Action, ActionSpan, Actor};
108

@@ -287,8 +285,8 @@ pub fn steps_system(
287285
let step_state = step_state.clone();
288286
let mut seq_state = states.get_mut(seq_ent).expect("idk");
289287
*seq_state = step_state;
290-
if let Some(ent) = cmd.get_entity(steps_action.active_ent.entity()) {
291-
ent.despawn_recursive();
288+
if let Ok(mut ent) = cmd.get_entity(steps_action.active_ent.entity()) {
289+
ent.despawn();
292290
}
293291
}
294292
Success if steps_action.active_step == steps_action.steps.len() - 1 => {
@@ -298,16 +296,16 @@ pub fn steps_system(
298296
let step_state = step_state.clone();
299297
let mut seq_state = states.get_mut(seq_ent).expect("idk");
300298
*seq_state = step_state;
301-
if let Some(ent) = cmd.get_entity(steps_action.active_ent.entity()) {
302-
ent.despawn_recursive();
299+
if let Ok(mut ent) = cmd.get_entity(steps_action.active_ent.entity()) {
300+
ent.despawn();
303301
}
304302
}
305303
Success => {
306304
#[cfg(feature = "trace")]
307305
trace!("Step succeeded, but there's more steps. Spawning next action.");
308306
// Deactivate current step and go to the next step
309-
if let Some(ent) = cmd.get_entity(steps_action.active_ent.entity()) {
310-
ent.despawn_recursive();
307+
if let Ok(mut ent) = cmd.get_entity(steps_action.active_ent.entity()) {
308+
ent.despawn();
311309
}
312310

313311
steps_action.active_step += 1;

0 commit comments

Comments
 (0)