Skip to content
This repository was archived by the owner on Nov 22, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f539c9a
Bump dependencies
alice-i-cecile Mar 8, 2023
f5c9dc9
Yeet stages
alice-i-cecile Mar 8, 2023
930a2ec
Windows as entities
alice-i-cecile Mar 8, 2023
a08050b
More errors
alice-i-cecile Mar 8, 2023
7841f51
.label -> .in_set
alice-i-cecile Mar 8, 2023
b5efcfc
Visibility enum
alice-i-cecile Mar 8, 2023
c67c53e
Bump bevy_screen_diagnostics
alice-i-cecile Mar 8, 2023
ddc35d4
More visibility
alice-i-cecile Mar 8, 2023
39c70bd
Bump hexx
alice-i-cecile Mar 8, 2023
31fbb90
More fixes
alice-i-cecile Mar 8, 2023
4425514
More simple fixes
alice-i-cecile Mar 8, 2023
27e52bf
Windows as entities again
alice-i-cecile Mar 8, 2023
47ba173
Typo
alice-i-cecile Mar 8, 2023
a258783
Bump dep in binary crate
alice-i-cecile Mar 8, 2023
cefdca9
Use git dependency of hexx
alice-i-cecile Mar 8, 2023
3ff4d3a
Mutable window as entity...
alice-i-cecile Mar 8, 2023
f0939c9
Add setup_ui again...
alice-i-cecile Mar 8, 2023
97394bd
Window descriptor
alice-i-cecile Mar 8, 2023
1ba80b3
Update Cargo.toml
alice-i-cecile Mar 8, 2023
39af852
Only generate the map once...
alice-i-cecile Mar 8, 2023
60c77bb
Bump version of debug_tools used
alice-i-cecile Mar 8, 2023
c8461a3
Fix bevy_inspector_egui issue
alice-i-cecile Mar 8, 2023
b47fa58
Formatting for cargo-deny
alice-i-cecile Mar 9, 2023
d8da8bc
Update deny.toml duplicates
alice-i-cecile Mar 9, 2023
43fd1e1
Tweak deny.toml
alice-i-cecile Mar 9, 2023
2a51a01
Just warn on multiple versions
alice-i-cecile Mar 9, 2023
96bd989
Warn about unmantained deps
alice-i-cecile Mar 9, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,381 changes: 643 additions & 738 deletions Cargo.lock

Large diffs are not rendered by default.

47 changes: 8 additions & 39 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,9 @@
db-path = "~/.cargo/advisory-db"
db-urls = ["https://github.com/rustsec/advisory-db"]
vulnerability = "deny"
unmaintained = "deny"
unmaintained = "warn"
yanked = "deny"
notice = "deny"
ignore = [
"RUSTSEC-2020-0056", # from cpal v0.14.1 - unmaintained - https://github.com/koute/stdweb/issues/403
]

[licenses]
unlicensed = "deny"
Expand All @@ -36,49 +33,21 @@ exceptions = [
default = "deny"

[bans]
multiple-versions = "deny"
multiple-versions = "warn"
# TODO: Change back to "deny"
# This currently doesn't work with git dependencies (even if the hash is fixed)
# See <https://github.com/Leafwing-Studios/Emergence/issues/193>
wildcards = "warn"
highlight = "all"
# Certain crates/versions that will be skipped when doing duplicate detection.
skip = [
{ name = "ndk-sys", version = "0.3" }, # from rodio v0.16.0
{ name = "ndk", version = "0.6" }, # from rodio v0.16.0
{ name = "raw-window-handle", version = "0.4" }, # from winit v0.27.4
{ name = "nix", version = "0.23" }, # from cpal v0.14.1
{ name = "rustc_version", version = "0.2" }, # from postcard v1.0.2
{ name = "semver", version = "0.9" }, # from postcard v1.0.2
{ name = "windows_aarch64_msvc", version = "0.36" }, # from notify v5.0.0
{ name = "windows_i686_gnu", version = "0.36" }, # from notify v5.0.0
{ name = "windows_i686_msvc", version = "0.36" }, # from notify v5.0.0
{ name = "windows_x86_64_gnu", version = "0.36" }, # from notify v5.0.0
{ name = "windows_x86_64_msvc", version = "0.36" }, # from notify v5.0.0
{ name = "windows-sys", version = "0.36" }, # from notify v5.0.0
{ name = "windows-sys", version = "0.45" }, # from parking_lot_core 0.9.7
{ name = "windows", version = "0.37" }, # from rodio v0.16.0
{ name = "windows_aarch64_msvc", version = "0.37" }, # from rodio v0.16.0
{ name = "windows_i686_gnu", version = "0.37" }, # from rodio v0.16.0
{ name = "windows_i686_msvc", version = "0.37" }, # from rodio v0.16.0
{ name = "windows_x86_64_gnu", version = "0.37" }, # from rodio v0.16.0
{ name = "windows_x86_64_msvc", version = "0.37" }, # from rodio v0.16.0
{ name = "jni", version = "0.19.0" }, # from rodio v0.16.0
{ name = "concurrent-queue", version = "1.2.4" }, # from bevy_tasks v0.9.1
{ name = "ahash", version = "0.7.6" }, # from bevy_utils v0.9.1
# The bevy_egui ones are mostly caused by the arboard dependency being outdated
# See <https://github.com/Leafwing-Studios/Emergence/issues/194>
{ name = "num-rational", version = "0.4.1" }, # from bevy_egui v0.18.0
{ name = "png", version = "0.16.8" }, # from bevy_egui v0.18.0
{ name = "nix", version = "0.22.3" }, # from bevy_egui v0.18.0
{ name = "miniz_oxide", version = "0.3.7" }, # from bevy_egui v0.18.0
{ name = "miniz_oxide", version = "0.4.4" }, # from bevy_egui v0.18.0
{ name = "image", version = "0.23.14" }, # from bevy_egui v0.18.0
]

[sources]
unknown-registry = "deny"
unknown-git = "deny"
allow-registry = ["https://github.com/rust-lang/crates.io-index"]
# If you add something here please also add a comment explaining why it's necessary :)
allow-git = []
allow-git = [
# hexx: waiting on a release for Bevy 0.10
"https://github.com/ManevilleF/hexx",
# bevy_mod_picking: waiting on PR merge plus release for Bevy 0.10
"https://github.com/soerenmeier/bevy_mod_raycast"
]
2 changes: 1 addition & 1 deletion emergence_game/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
bevy = "0.9"
bevy = "0.10"
emergence_lib = { path = "../emergence_lib", version = "0.1.0" }
7 changes: 3 additions & 4 deletions emergence_game/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ use emergence_lib::simulation::generation::GenerationConfig;
fn main() {
App::new()
.add_plugins(DefaultPlugins.set(WindowPlugin {
window: WindowDescriptor {
primary_window: Some(Window {
title: "Emergence".to_string(),
// choose `AutoNoVsync` as it is more widely supported than `Immediate`
present_mode: PresentMode::AutoNoVsync,
..Default::default()
},
..default()
}),
..Default::default()
}))
.add_plugin(emergence_lib::simulation::SimulationPlugin {
Expand Down
14 changes: 7 additions & 7 deletions emergence_lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ edition = "2021"
debug_tools = ['dep:debug_tools']

[dependencies]
bevy = "0.9"
bevy = "0.10"
rand = "0.8"
noisy_bevy = "0.2"
leafwing-input-manager = "0.7"
noisy_bevy = "0.3"
leafwing-input-manager = "0.9"
emergence_macros = { path = "../emergence_macros", version = "0.6" }
indexmap = "1.9"
debug_tools = { path = "../tools/debug_tools", optional = true }
petitset = "0.2"
serde = "1.0.152"
leafwing_abilities = "0.3.0"
leafwing_abilities = "0.4.0"
derive_more = "0.99.17"
hexx = "0.4"
bevy_mod_raycast = "0.7.0"
hexx = {git = "https://github.com/ManevilleF/hexx", commit = "83d6a515c0afc6e91715f7f611cd40d7d6b20a58"}
bevy_mod_raycast = { git = "https://github.com/soerenmeier/bevy_mod_raycast", branch="bevy-0.10"}
itertools = "0.10.5"
bevy_screen_diagnostics = "0.1.1"
bevy_screen_diagnostics = "0.2"
18 changes: 7 additions & 11 deletions emergence_lib/src/asset_management/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ pub struct AssetManagementPlugin;
impl Plugin for AssetManagementPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<TerrainHandles>()
.add_state(AssetState::Loading)
.add_state::<AssetState>()
.add_asset_collection::<StructureHandles>()
.add_asset_collection::<UnitHandles>();
}
}

/// Tracks the progress of asset loading.
#[derive(Default, Clone, PartialEq, Eq, Debug, Hash)]
#[derive(States, Default, Clone, PartialEq, Eq, Debug, Hash)]
pub enum AssetState {
#[default]
/// Assets still need to be loaded.
Expand Down Expand Up @@ -83,10 +83,10 @@ impl AssetsToLoad {
/// A system that moves into [`AssetState::Ready`] when all assets are loaded.
fn transition_when_complete(
assets_to_load: Res<AssetsToLoad>,
mut asset_state: ResMut<State<AssetState>>,
mut asset_state: ResMut<NextState<AssetState>>,
) {
if assets_to_load.set.is_empty() {
asset_state.set(AssetState::Ready).unwrap();
asset_state.set(AssetState::Ready);
}
}
}
Expand All @@ -111,20 +111,16 @@ impl AssetCollectionExt for App {
assets_to_load.insert::<T>();
} else {
// Only called for the first asset collection added.
self.add_system_set(
SystemSet::on_update(AssetState::Loading)
//
.with_system(AssetsToLoad::transition_when_complete),
self.add_system(
AssetsToLoad::transition_when_complete.run_if(in_state(AssetState::Loading)),
);
self.init_resource::<AssetsToLoad>();
}

// Store the asset collection as a resource
self.init_resource::<T>();
// Poll each asset collection
self.add_system_set(
SystemSet::on_update(AssetState::Loading).with_system(AssetsToLoad::check_loaded::<T>),
);
self.add_system(AssetsToLoad::check_loaded::<T>.run_if(in_state(AssetState::Loading)));

self
}
Expand Down
6 changes: 2 additions & 4 deletions emergence_lib/src/graphics/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ pub struct GraphicsPlugin;
impl Plugin for GraphicsPlugin {
fn build(&self, app: &mut App) {
app.add_plugin(LightingPlugin)
.add_system_set(
SystemSet::on_update(AssetState::Ready).with_system(units::display_held_item),
)
.add_system_to_stage(CoreStage::PostUpdate, inherit_materials)
.add_system(units::display_held_item.run_if(in_state(AssetState::Ready)))
.add_system(inherit_materials.in_base_set(CoreSet::PostUpdate))
.add_system(selection::display_tile_interactions.after(InteractionSystem::SelectTiles));
}
}
Expand Down
2 changes: 1 addition & 1 deletion emergence_lib/src/player_interaction/abilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl Plugin for AbilitiesPlugin {
.insert_resource(IntentAbility::default_input_map())
.add_system(
use_ability
.label(InteractionSystem::UseAbilities)
.in_set(InteractionSystem::UseAbilities)
// If we don't have enough intent, zoning should be applied first to reduce the risk of an error message.
.after(InteractionSystem::ApplyZoning),
);
Expand Down
4 changes: 2 additions & 2 deletions emergence_lib/src/player_interaction/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ pub(super) struct CameraPlugin;

impl Plugin for CameraPlugin {
fn build(&self, app: &mut App) {
app.add_startup_system_to_stage(StartupStage::Startup, setup_camera)
app.add_startup_system(setup_camera)
.add_system(mousewheel_zoom.before(zoom))
.add_system(zoom)
.add_system(drag_camera.before(set_camera_inclination))
.add_system(set_camera_inclination.before(InteractionSystem::MoveCamera))
.add_system(rotate_camera.before(InteractionSystem::MoveCamera))
.add_system(translate_camera.before(InteractionSystem::MoveCamera))
.add_system(move_camera_to_goal.label(InteractionSystem::MoveCamera));
.add_system(move_camera_to_goal.in_set(InteractionSystem::MoveCamera));
}
}

Expand Down
6 changes: 3 additions & 3 deletions emergence_lib/src/player_interaction/clipboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,18 @@ impl Plugin for ClipboardPlugin {
.add_system(clear_clipboard.before(InteractionSystem::SelectTiles))
.add_system(
copy_selection
.label(InteractionSystem::SetClipboard)
.in_set(InteractionSystem::SetClipboard)
.after(InteractionSystem::ComputeCursorPos)
.after(InteractionSystem::SelectTiles),
)
.add_system(
rotate_selection
.label(InteractionSystem::SetClipboard)
.in_set(InteractionSystem::SetClipboard)
.after(copy_selection),
)
.add_system(
display_selection
.label(InteractionSystem::ManagePreviews)
.in_set(InteractionSystem::ManagePreviews)
.after(InteractionSystem::SetClipboard),
);
}
Expand Down
21 changes: 11 additions & 10 deletions emergence_lib/src/player_interaction/cursor.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! Keep track of the mouse cursor in world space, and convert it into a tile position, if
//! available.
use bevy::prelude::*;
use bevy::{prelude::*, window::PrimaryWindow};
use bevy_mod_raycast::{DefaultRaycastingPlugin, RaycastMethod, RaycastSource, RaycastSystem};
use leafwing_input_manager::prelude::ActionState;

Expand All @@ -22,14 +22,15 @@ impl Plugin for CursorPlugin {
.add_plugin(DefaultRaycastingPlugin::<Id<Structure>>::default())
.add_plugin(DefaultRaycastingPlugin::<Id<Unit>>::default())
.add_plugin(DefaultRaycastingPlugin::<Ghost>::default())
.add_system_to_stage(
CoreStage::First,
update_raycast_with_cursor.before(RaycastSystem::BuildRays::<Terrain>),
.add_system(
update_raycast_with_cursor
.before(RaycastSystem::BuildRays::<Terrain>)
.in_base_set(CoreSet::First),
)
.add_system_to_stage(CoreStage::PreUpdate, move_cursor_manually)
.add_system(move_cursor_manually.in_base_set(CoreSet::PreUpdate))
.add_system(
update_cursor_pos
.label(InteractionSystem::ComputeCursorPos)
.in_set(InteractionSystem::ComputeCursorPos)
.after(InteractionSystem::MoveCamera),
);
}
Expand Down Expand Up @@ -172,13 +173,13 @@ fn update_cursor_pos(
/// Moves the cursor on the screen, based on gamepad or keyboard inputs
fn move_cursor_manually(
actions: Res<ActionState<PlayerAction>>,
mut windows: ResMut<Windows>,
mut window_query: Query<(Entity, &mut Window), With<PrimaryWindow>>,
mut cursor_moved_events: EventWriter<CursorMoved>,
) {
/// Controls the sensitivity of cursor movement
const CURSOR_SPEED: f32 = 2.0;

if let Some(primary_window) = windows.get_primary_mut() {
if let Ok((primary_window_entity, mut primary_window)) = window_query.get_single_mut() {
let maybe_cursor_pos = primary_window.cursor_position();

if let Some(old_cursor_pos) = maybe_cursor_pos {
Expand All @@ -187,9 +188,9 @@ fn move_cursor_manually(

if delta != Vec2::ZERO {
let new_cursor_pos = old_cursor_pos + delta;
primary_window.set_cursor_position(new_cursor_pos);
primary_window.set_cursor_position(Some(new_cursor_pos));
cursor_moved_events.send(CursorMoved {
id: primary_window.id(),
window: primary_window_entity,
position: new_cursor_pos,
});
}
Expand Down
7 changes: 2 additions & 5 deletions emergence_lib/src/player_interaction/intent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@

use std::ops::{Div, Mul};

use bevy::{
prelude::{info, App, IntoSystemDescriptor, Plugin, Res, ResMut, Resource},
time::Time,
};
use bevy::{prelude::*, time::Time};
use derive_more::{Add, AddAssign, Sub, SubAssign};
use leafwing_abilities::{pool::MaxPoolLessThanZero, prelude::Pool};

Expand All @@ -23,7 +20,7 @@ impl Plugin for IntentPlugin {
app.init_resource::<IntentPool>()
.add_system(
regenerate_intent
.label(InteractionSystem::ReplenishIntent)
.in_set(InteractionSystem::ReplenishIntent)
.before(InteractionSystem::ApplyZoning)
.before(InteractionSystem::UseAbilities),
)
Expand Down
2 changes: 1 addition & 1 deletion emergence_lib/src/player_interaction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl Plugin for InteractionPlugin {
}

/// Public system sets for player interaction, used for system ordering and config
#[derive(SystemLabel, Clone, PartialEq, Eq, Hash, Debug)]
#[derive(SystemSet, Clone, PartialEq, Eq, Hash, Debug)]
pub(crate) enum InteractionSystem {
/// Moves the camera
MoveCamera,
Expand Down
5 changes: 2 additions & 3 deletions emergence_lib/src/player_interaction/selection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ impl Plugin for SelectionPlugin {
.init_resource::<HoveredTiles>()
.add_system(
set_selection
.label(InteractionSystem::SelectTiles)
.in_set(InteractionSystem::SelectTiles)
.after(InteractionSystem::ComputeCursorPos)
.before(InteractionSystem::HoverDetails),
)
.add_system(
get_details
.pipe(clear_details_on_error)
.label(InteractionSystem::HoverDetails)
.in_set(InteractionSystem::HoverDetails)
.after(InteractionSystem::SelectTiles),
)
.add_system(update_selection_radius);
Expand Down Expand Up @@ -822,7 +822,6 @@ Construction materials: {input_inventory}

/// Details for organisms
mod organism_details {
use bevy::ecs::prelude::*;
use bevy::ecs::query::WorldQuery;

use crate::organisms::energy::EnergyPool;
Expand Down
4 changes: 2 additions & 2 deletions emergence_lib/src/player_interaction/zoning.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ impl Plugin for ZoningPlugin {
fn build(&self, app: &mut App) {
app.add_system(
set_zoning
.label(InteractionSystem::ApplyZoning)
.in_set(InteractionSystem::ApplyZoning)
.after(InteractionSystem::SelectTiles)
.after(InteractionSystem::SetClipboard),
)
.add_system(
generate_ghosts_from_zoning
.label(InteractionSystem::ManagePreviews)
.in_set(InteractionSystem::ManagePreviews)
.after(InteractionSystem::ApplyZoning),
);
}
Expand Down
12 changes: 5 additions & 7 deletions emergence_lib/src/signals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ pub(crate) struct SignalsPlugin;

impl Plugin for SignalsPlugin {
fn build(&self, app: &mut App) {
app.init_resource::<Signals>()
.add_system_to_stage(CoreStage::PreUpdate, emit_signals.before(diffuse_signals))
.add_system_to_stage(
CoreStage::PreUpdate,
diffuse_signals.before(degrade_signals),
)
.add_system_to_stage(CoreStage::PreUpdate, degrade_signals);
app.init_resource::<Signals>().add_systems(
(emit_signals, diffuse_signals, degrade_signals)
.chain()
.in_base_set(CoreSet::PreUpdate),
);
}
}

Expand Down
Loading