Initial port to Bevy 0.15.

This commit is contained in:
Nolan Darilek 2025-01-03 14:19:57 -05:00
parent f6c34057aa
commit 380506b75c
7 changed files with 31 additions and 27 deletions

View File

@ -14,7 +14,7 @@ speech_dispatcher_0_10 = ["bevy_tts/speech_dispatcher_0_10"]
speech_dispatcher_0_11 = ["bevy_tts/speech_dispatcher_0_11"]
[dependencies.bevy]
version = "0.14"
version = "0.15"
default-features = false
features = [
"android_shared_stdcxx",
@ -48,12 +48,12 @@ features = [
]
[dependencies]
avian2d = "0.1"
bevy_synthizer = "0.8"
bevy_tts = { version = "0.9", default-features = false, features = ["tolk"] }
avian2d = "0.2"
bevy_synthizer = "0.9"
bevy_tts = { version = "0.10", default-features = false, features = ["tolk"] }
coord_2d = "0.3"
here_be_dragons = { version = "0.3", features = ["serde"] }
leafwing-input-manager = "0.15"
leafwing-input-manager = "0.16"
maze_generator = "2"
once_cell = "1"
pathfinding = "4"

View File

@ -333,7 +333,7 @@ where
&shape,
exploring,
0.,
SpatialQueryFilter::default(),
&default(),
|entity| {
if explorable.contains(entity) {
commands.entity(entity).insert(ExplorationFocused);

View File

@ -73,7 +73,7 @@ impl ITileType for Tile {
#[derive(Bundle, Default)]
pub struct PortalBundle {
pub transform: TransformBundle,
pub transform: Transform,
pub portal: Portal,
pub mappable: Mappable,
}
@ -83,12 +83,12 @@ pub struct MapBundle<D: 'static + Clone + Default + Send + Sync> {
pub map: Map<D>,
pub spawn_colliders: SpawnColliders,
pub spawn_portals: SpawnPortals,
pub transform: TransformBundle,
pub transform: Transform,
}
#[derive(Bundle, Clone, Debug)]
pub struct TileBundle {
pub transform: TransformBundle,
pub transform: Transform,
pub collider: Collider,
pub rigid_body: RigidBody,
pub map_obstruction: MapObstruction,
@ -117,7 +117,7 @@ impl TileBundle {
#[derive(Bundle, Clone, Debug)]
pub struct ZoneBundle {
pub collider: Collider,
pub transform: TransformBundle,
pub transform: Transform,
pub zone: Zone,
pub sensor: Sensor,
}
@ -239,7 +239,7 @@ fn spawn_colliders<D: 'static + Clone + Default + Send + Sync>(
if tile.blocks_visibility() {
commands.entity(id).insert(Visible::opaque());
}
commands.entity(map_entity).push_children(&[id]);
commands.entity(map_entity).add_children(&[id]);
}
}
}

View File

@ -227,9 +227,12 @@ fn controls(
transform.translation.truncate(),
transform.yaw().as_radians(),
dir,
pair.length(),
true,
SpatialQueryFilter::from_excluded_entities(&sensors),
&ShapeCastConfig {
max_distance: pair.length(),
ignore_origin_penetration: true,
..default()
},
&SpatialQueryFilter::from_excluded_entities(&sensors),
|hit| {
if hit.entity != entity {
can_translate = false;
@ -255,7 +258,7 @@ fn controls(
// velocity.angvel =
// actions.value(&NavigationAction::SetAngularVelocity);
transform.rotation *= Quat::from_rotation_z(
actions.value(&NavigationAction::SetAngularVelocity) * time.delta_seconds(),
actions.value(&NavigationAction::SetAngularVelocity) * time.delta_secs(),
);
}
}

View File

@ -139,7 +139,7 @@ fn calculate_path(
collider,
check,
transform.yaw().as_radians(),
SpatialQueryFilter::from_excluded_entities(&sensors),
&SpatialQueryFilter::from_excluded_entities(&sensors),
);
for entity in &hits {
if obstructions.contains(*entity) {
@ -245,9 +245,12 @@ fn negotiate_path(
start,
global_transform.yaw().as_radians(),
Dir2::new_unchecked(direction.normalize()),
time.delta_seconds(),
true,
SpatialQueryFilter::from_excluded_entities(&sensors),
&ShapeCastConfig {
max_distance: time.delta_secs(),
ignore_origin_penetration: true,
..default()
},
&SpatialQueryFilter::from_excluded_entities(&sensors),
|hit| {
if obstructions.contains(hit.entity) {
hits.push(hit.entity);
@ -261,7 +264,7 @@ fn negotiate_path(
next.y = next.y.trunc();
transform.translation = next.extend(0.);
} else {
let delta = direction * time.delta_seconds();
let delta = direction * time.delta_secs();
navigation_actions.set_axis_pair(&NavigationAction::Translate, delta);
}
if rotation_speed.is_some() {

View File

@ -39,9 +39,7 @@ fn update(
);
commands
.entity(sound_entity)
.insert(TransformBundle::from_transform(
Transform::from_translation(sound_translation),
));
.insert(Transform::from_translation(sound_translation));
}
} else if closest == ClosestPoints::Intersecting && sound_transform.is_some() {
commands
@ -60,7 +58,7 @@ fn removed(
) {
for entity in removed.read() {
if transforms.get(entity).is_ok() {
commands.entity(entity).insert(TransformBundle::default());
commands.entity(entity).insert(Transform::default());
}
}
}

View File

@ -87,7 +87,7 @@ impl Viewshed {
dir,
dir.distance(*start),
true,
default(),
&default(),
&|entity| {
if *e != entity && entities.contains(e) {
// println!("{entities:?} contains {e}");
@ -161,7 +161,7 @@ impl OpacityMap {
&shape,
shape_pos,
0.,
default(),
&default(),
|entity| {
if let Ok((_, _, _, visible)) = visible.get(entity) {
coord_entities.insert(entity);
@ -451,6 +451,6 @@ impl<MapData: 'static + Clone + Default + Send + Sync> Plugin for VisibilityPlug
),
)
.add_systems(FixedPostUpdate, (viewshed_removed, remove_visible))
.observe(log_visible);
.add_observer(log_visible);
}
}