Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
bevy_mod_picking changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alice-i-cecile committed Nov 21, 2023
1 parent d20b485 commit 75381df
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 12 deletions.
2 changes: 1 addition & 1 deletion emergence_lib/src/construction/ghosts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::terrain::terrain_manifest::TerrainManifest;
use crate::{self as emergence_lib, graphics::InheritedMaterial};
use bevy::prelude::*;
use bevy::utils::{Duration, HashMap};
use bevy_mod_raycast::RaycastMesh;
use bevy_mod_raycast::deferred::RaycastMesh;
use emergence_macros::IterableEnum;

use crate::{
Expand Down
2 changes: 1 addition & 1 deletion emergence_lib/src/player_interaction/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bevy::core_pipeline::tonemapping::Tonemapping;
use bevy::input::mouse::MouseMotion;
use bevy::input::mouse::MouseWheel;
use bevy::prelude::*;
use bevy_mod_raycast::RaycastSource;
use bevy_mod_raycast::deferred::RaycastSource;
use leafwing_input_manager::orientation::Rotation;
use leafwing_input_manager::prelude::ActionState;

Expand Down
13 changes: 6 additions & 7 deletions emergence_lib/src/player_interaction/picking.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
//! Keep track of the mouse cursor in world space, and convert it into a tile position, if
//! available.
use bevy::{prelude::*, window::PrimaryWindow};
use bevy_mod_raycast::{DefaultRaycastingPlugin, RaycastMethod, RaycastSource, RaycastSystem};
use bevy_mod_raycast::{
deferred::{RaycastMethod, RaycastSource, RaycastSystem},
DefaultRaycastingPlugin,
};
use leafwing_input_manager::prelude::ActionState;

use super::{InteractionSystem, PlayerAction};
Expand All @@ -13,12 +16,8 @@ pub(super) struct PickingPlugin;
impl Plugin for PickingPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<CursorPos>()
.add_plugins(DefaultRaycastingPlugin::<PickableVoxel>::default())
.add_plugins(DefaultRaycastingPlugin::<Unit>::default())
.add_systems(
First,
update_raycast_with_cursor.before(RaycastSystem::BuildRays::<PickableVoxel>),
)
.add_plugins(DefaultRaycastingPlugin)
.add_systems(First, update_raycast_with_cursor)
.add_systems(PreUpdate, move_cursor_manually)
.add_systems(
Update,
Expand Down
2 changes: 1 addition & 1 deletion emergence_lib/src/structures/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//! but they can also be used for defense, research, reproduction, storage and more exotic effects.
use bevy::{prelude::*, utils::HashSet};
use bevy_mod_raycast::RaycastMesh;
use bevy_mod_raycast::deferred::RaycastMesh;
use hexx::{shapes::hexagon, Hex};
use serde::{Deserialize, Serialize};

Expand Down
2 changes: 1 addition & 1 deletion emergence_lib/src/terrain/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Generating and representing terrain as game objects.
use bevy::prelude::*;
use bevy_mod_raycast::RaycastMesh;
use bevy_mod_raycast::deferred::RaycastMesh;

use crate::asset_management::manifest::plugin::ManifestPlugin;
use crate::asset_management::manifest::Id;
Expand Down
2 changes: 1 addition & 1 deletion emergence_lib/src/units/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use crate::{
simulation::SimulationSet,
};
use bevy::prelude::*;
use bevy_mod_raycast::RaycastMesh;
use bevy_mod_raycast::deferred::RaycastMesh;
use rand::{distributions::WeightedIndex, prelude::Distribution, rngs::ThreadRng, Rng};
use serde::{Deserialize, Serialize};

Expand Down

0 comments on commit 75381df

Please sign in to comment.