diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c5c95eee8..676ad8667 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -79,7 +79,7 @@ When the complexity grows, split the system and use events for inter-system communication. -* Label struct names end with `Label` (for example `CameraLabel`). Event struct +* SystemSet enum names end with `Set` (for example `CameraSet`). Event struct names end with `Event` (for example `DoubleClickEvent`). ### Crate Structure @@ -189,9 +189,9 @@ Topologically sorted crates: * [/utils](/utils) — various utilities (e.g. small Python scripts) intended for contributors. -### Bevy Schedule Stages +### Bevy Schedule -See de_core::stages::GameStage. +See de_core::baseset::GameSet. ### Coordinate Systems diff --git a/Cargo.lock b/Cargo.lock index 59bf7cb6f..0d164ad1d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -18,6 +18,59 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" +[[package]] +name = "accesskit" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "704d532b1cd3d912bb37499c55a81ac748cc1afa737eedd100ba441acdd47d38" + +[[package]] +name = "accesskit_consumer" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48ba8b23cfca3944012ee2e5c71c02077a400e034c720eed6bd927cb6b4d1fd9" +dependencies = [ + "accesskit", +] + +[[package]] +name = "accesskit_macos" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc50af17818440f580a894536c4c5a95ff9e4bad59f19ee68757ca959d001813" +dependencies = [ + "accesskit", + "accesskit_consumer", + "objc2", + "once_cell", +] + +[[package]] +name = "accesskit_windows" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaf5b3c3828397ee832ba4a72fb1a4ace10f781e31885f774cbd531014059115" +dependencies = [ + "accesskit", + "accesskit_consumer", + "arrayvec", + "once_cell", + "paste", + "windows 0.44.0", +] + +[[package]] +name = "accesskit_winit" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eb880d83a5502edd311bdb3af1cf7113b250c9c2d92fbdd05342c7b9f38bf51" +dependencies = [ + "accesskit", + "accesskit_macos", + "accesskit_windows", + "winit", +] + [[package]] name = "actix-codec" version = "0.5.0" @@ -66,7 +119,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "rand", - "sha1 0.10.5", + "sha1", "smallvec", "tokio", "tokio-util", @@ -214,6 +267,15 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "addr2line" +version = "0.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" +dependencies = [ + "gimli", +] + [[package]] name = "adler" version = "1.0.2" @@ -269,14 +331,14 @@ dependencies = [ [[package]] name = "alsa" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5915f52fe2cf65e83924d037b6c5290b7cee097c6b5c8700746e6168a343fd6b" +checksum = "8512c9117059663fb5606788fbca3619e2a91dac0e3fe516242eab1fa6be5e44" dependencies = [ "alsa-sys", "bitflags", "libc", - "nix 0.23.2", + "nix 0.24.3", ] [[package]] @@ -290,23 +352,35 @@ dependencies = [ ] [[package]] -name = "android_log-sys" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e" - -[[package]] -name = "android_logger" -version = "0.11.3" +name = "android-activity" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8619b80c242aa7bd638b5c7ddd952addeecb71f69c75e33f1d47b2804f8f883a" +checksum = "7c77a0045eda8b888c76ea473c2b0515ba6f471d318f8927c5c72240937035a6" dependencies = [ - "android_log-sys", - "env_logger", + "android-properties", + "bitflags", + "cc", + "jni-sys", + "libc", "log", - "once_cell", + "ndk", + "ndk-context", + "ndk-sys", + "num_enum", ] +[[package]] +name = "android-properties" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" + +[[package]] +name = "android_log-sys" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85965b6739a430150bdd138e2374a98af0c3ee0d030b3bb7fc3bddff58d0102e" + [[package]] name = "android_system_properties" version = "0.1.5" @@ -368,7 +442,7 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf46fee83e5ccffc220104713af3292ff9bc7c64c7de289f66dae8e38d826833" dependencies = [ - "concurrent-queue 2.1.0", + "concurrent-queue", "event-listener", "futures-core", ] @@ -394,7 +468,7 @@ checksum = "17adb73da160dfb475c183343c8cccd80721ea5a605d3eb57125f0a7b7a92d0b" dependencies = [ "async-lock", "async-task", - "concurrent-queue 2.1.0", + "concurrent-queue", "fastrand", "futures-lite", "slab", @@ -423,7 +497,7 @@ checksum = "8c374dda1ed3e7d8f0d9ba58715f924862c63eae6849c92d3a18e7fbde9e2794" dependencies = [ "async-lock", "autocfg", - "concurrent-queue 2.1.0", + "concurrent-queue", "futures-lite", "libc", "log", @@ -500,7 +574,7 @@ dependencies = [ "filetime", "libc", "pin-project", - "redox_syscall", + "redox_syscall 0.2.16", "xattr", ] @@ -552,10 +626,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" [[package]] -name = "base-x" -version = "0.2.11" +name = "backtrace" +version = "0.3.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cbbc9d0964165b47557570cce6c952866c2678457aca742aafc9fb771d30270" +checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] [[package]] name = "base64" @@ -577,18 +660,30 @@ checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" [[package]] name = "bevy" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dae99b246505811f5bc19d2de1e406ec5d2816b421d58fa223779eb576f472c9" +checksum = "cc88fece4660d68690585668f1a4e18e6dcbab160b08f337b498a96ccde91cfe" dependencies = [ "bevy_internal", ] +[[package]] +name = "bevy_a11y" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a10b25cf04971b9d68271aa54e4601c673509db6edaf1f5359dd91fb3e84cc27" +dependencies = [ + "accesskit", + "bevy_app", + "bevy_derive", + "bevy_ecs", +] + [[package]] name = "bevy_animation" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d43b8073f299eb60ce9e1d60fa293b348590dd57aca8321d6859d9e7aa57d2da" +checksum = "1aabb803571785797c84e106ed63427eaf2cb12832a591923707896ee000bde8" dependencies = [ "bevy_app", "bevy_asset", @@ -604,9 +699,9 @@ dependencies = [ [[package]] name = "bevy_app" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "536e4d0018347478545ed8b6cb6e57b9279ee984868e81b7c0e78e0fb3222e42" +checksum = "960c6e444dc6a25dd51a2196f04872ae9e2e876802b66c391104849ec9225e38" dependencies = [ "bevy_derive", "bevy_ecs", @@ -619,9 +714,9 @@ dependencies = [ [[package]] name = "bevy_asset" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db1bb550168304df69c867c09125e1aae7ff51cf21575396e1598bf293442c4" +checksum = "adea538a3d166c8609621994972c31be591c96f931f160f96e74697d8c24ba45" dependencies = [ "anyhow", "bevy_app", @@ -631,11 +726,11 @@ dependencies = [ "bevy_reflect", "bevy_tasks", "bevy_utils", + "bevy_winit", "crossbeam-channel", "downcast-rs", "fastrand", "js-sys", - "ndk-glue", "notify", "parking_lot 0.12.1", "serde", @@ -647,25 +742,28 @@ dependencies = [ [[package]] name = "bevy_audio" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29a05efc6c23bef37520e44029943c65b7e8a4fe4f5e54cb3f96e63ce0b3d361" +checksum = "0841e98276000dc06e2cf7593ee20b16b84da3bc7faa7b549938cb982b33b0e1" dependencies = [ "anyhow", "bevy_app", "bevy_asset", "bevy_ecs", + "bevy_math", "bevy_reflect", + "bevy_transform", "bevy_utils", + "oboe", "parking_lot 0.12.1", "rodio", ] [[package]] name = "bevy_core" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96299aceb3c8362cb4aa39ff81c7ef758a5f4e768d16b5046a91628eff114ac0" +checksum = "ed29797fa386c6969fa1e4ef9e194a27f89ddb2fa78751fe46838495d374f90f" dependencies = [ "bevy_app", "bevy_ecs", @@ -678,9 +776,9 @@ dependencies = [ [[package]] name = "bevy_core_pipeline" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc128a9860aadf16fb343ae427f2768986fd91dce64d945455acda9759c48014" +checksum = "3129d308df70dee3c46b6bb64e54d2552e7106fd3185d75732ad5e739a830fee" dependencies = [ "bevy_app", "bevy_asset", @@ -698,9 +796,9 @@ dependencies = [ [[package]] name = "bevy_derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7baf73c58d41c353c6fd08e6764a2e7420c9f19e8227b391c50981db6d0282a6" +checksum = "cdf11701c01bf4dc7a3fac9f4547f3643d3db4cc1682af40c8c86e2f8734b617" dependencies = [ "bevy_macro_utils", "quote", @@ -709,9 +807,9 @@ dependencies = [ [[package]] name = "bevy_diagnostic" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63bf96ec7980fa25b77ff6c72dfafada477936c0dab76c1edf6c028c0e5fe0e4" +checksum = "576508ffe7ad5124781edd352b79bdc79ffbb6e2f26bad6f722774f7c9fd16c9" dependencies = [ "bevy_app", "bevy_core", @@ -719,13 +817,14 @@ dependencies = [ "bevy_log", "bevy_time", "bevy_utils", + "sysinfo", ] [[package]] name = "bevy_ecs" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4c071d7c6bc9801253485e05d0c257284150de755391902746837ba21c0cf74" +checksum = "fdc5b19451128091e8507c9247888359ca0bfa895e7f6ca749ccc55c5463bef6" dependencies = [ "async-channel", "bevy_ecs_macros", @@ -736,16 +835,16 @@ dependencies = [ "downcast-rs", "event-listener", "fixedbitset", - "fxhash", + "rustc-hash", "serde", "thread_local", ] [[package]] name = "bevy_ecs_macros" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c15bd45438eeb681ad74f2d205bb07a5699f98f9524462a30ec764afab2742ce" +checksum = "b1e79757319533bde006a4f30c268223ec6426371297182925932075ccfdae30" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -755,9 +854,9 @@ dependencies = [ [[package]] name = "bevy_encase_derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "962b6bb0d30e92ec2e6c29837acce9e55b920733a634e7c3c5fd5a514bea7a24" +checksum = "723d4838d1f88955f348294c0a9d067307f2437725400b0776e9677154914f14" dependencies = [ "bevy_macro_utils", "encase_derive_impl", @@ -765,9 +864,9 @@ dependencies = [ [[package]] name = "bevy_gilrs" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4af552dad82f854b2fae24f36a389fd8ee99d65fe86ae876e854e70d53ff16d9" +checksum = "905e547d213e368f997d08f140f4e893923c7dce4760bf0fb63401232262fa79" dependencies = [ "bevy_app", "bevy_ecs", @@ -778,9 +877,9 @@ dependencies = [ [[package]] name = "bevy_gltf" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e853e346ba412354e02292c7aa5b9a9dccdfa748e273b1b7ebf8f6a172f89712" +checksum = "bb2994d7e47c36bfe36710c4a26d3f36dd8641bfaa2c5d4d0581e001942aab6f" dependencies = [ "anyhow", "base64 0.13.1", @@ -807,9 +906,9 @@ dependencies = [ [[package]] name = "bevy_hierarchy" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd6d50c48c6e1bcb5e08a768b765323292bb3bf3a439b992754c57ffb85b23a" +checksum = "ccd246c862fcaeef3a769f47c6297139f971db0c8fdd6188fe9419ee8873b7e8" dependencies = [ "bevy_app", "bevy_core", @@ -822,9 +921,9 @@ dependencies = [ [[package]] name = "bevy_input" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3378b5171284f4c4c0e8307081718a9fe458f846444616bd82d69110dcabca51" +checksum = "6c809b3df62e1fcbdc6744233ae6c95a67d2cc7e518db43ab81f417d5875ba3b" dependencies = [ "bevy_app", "bevy_ecs", @@ -836,10 +935,11 @@ dependencies = [ [[package]] name = "bevy_internal" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c46014b7e885b1311de06b6039e448454a4db55b8d35464798ba88faa186e11" +checksum = "0a065c7ac81cd7cf3f1b8f15c4a93db5f07274ddaaec145ba7d0393be0c9c413" dependencies = [ + "bevy_a11y", "bevy_animation", "bevy_app", "bevy_asset", @@ -869,14 +969,13 @@ dependencies = [ "bevy_utils", "bevy_window", "bevy_winit", - "ndk-glue", ] [[package]] name = "bevy_log" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c480bac54cf4ae76edc3ae9ae3fa7c5e1b385e7f2111ef5ec3fd00cf3a7998b" +checksum = "47dcb09ec71145c80d88a84181cc1449d30f23c571bdd58c59c10eece82dfaa5" dependencies = [ "android_log-sys", "bevy_app", @@ -890,39 +989,39 @@ dependencies = [ [[package]] name = "bevy_macro_utils" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "022bb69196deeea691b6997414af85bbd7f2b34a8914c4aa7a7ff4dfa44f7677" +checksum = "f24ca3363292f1435641fbafd5c24ce362137dd7d69bee56dcaaa2bc1d512ffe" dependencies = [ "quote", "syn", - "toml", + "toml_edit", ] [[package]] name = "bevy_math" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d434c77ab766c806ed9062ef8a7285b3b02b47df51f188d4496199c3ac062eaf" +checksum = "5e45e46c2ac0a92db3ae622f2ed690928fe2612e7c9470a46d0ed4c2c77e2e95" dependencies = [ - "glam 0.22.0", + "glam", "serde", ] [[package]] name = "bevy_mikktspace" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbfb5908d33fd613069be516180b8f138aaaf6e41c36b1fd98c6c29c00c24a13" +checksum = "aaa0358a79823e6f0069b910d90b615d02dad08279b5856d3d1e401472b6379a" dependencies = [ - "glam 0.22.0", + "glam", ] [[package]] name = "bevy_pbr" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "310b1f260a475d81445623e138e1b7245759a42310bc1f84b550a3f4ff8763bf" +checksum = "90230c526ee7257229c1db0fc4aafaa947ea806bb4b0674785930ea59d0cc7f8" dependencies = [ "bevy_app", "bevy_asset", @@ -942,15 +1041,15 @@ dependencies = [ [[package]] name = "bevy_ptr" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ec44f7655039546bc5d34d98de877083473f3e9b2b81d560c528d6d74d3eff4" +checksum = "a96c24da064370917b92c2a84527e6a73b620c50ac5ef8b1af8c04ccf5256a7c" [[package]] name = "bevy_reflect" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6deae303a7f69dc243b2fa35b5e193cc920229f448942080c8eb2dbd9de6d37a" +checksum = "ab880e0eed9df5c99ce1a2f89edc11cdef1bc78413719b29e9ad7e3bc27f4c20" dependencies = [ "bevy_math", "bevy_ptr", @@ -958,7 +1057,7 @@ dependencies = [ "bevy_utils", "downcast-rs", "erased-serde", - "glam 0.22.0", + "glam", "once_cell", "parking_lot 0.12.1", "serde", @@ -968,9 +1067,9 @@ dependencies = [ [[package]] name = "bevy_reflect_derive" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bf4cb9cd5acb4193f890f36cb63679f1502e2de025e66a63b194b8b133d018" +checksum = "3b361b8671bdffe93978270dd770b03b48560c3127fdf9003f98111fb806bb11" dependencies = [ "bevy_macro_utils", "bit-set", @@ -982,11 +1081,12 @@ dependencies = [ [[package]] name = "bevy_render" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e3282a8f8779d2aced93207fbed73f740937c6c2bd27bd84f0799b081c7fca5" +checksum = "52e352868ab1a9ad9fbaa6ff025505e685781ad1790377b2d038afeb9df18214" dependencies = [ "anyhow", + "async-channel", "bevy_app", "bevy_asset", "bevy_core", @@ -999,6 +1099,7 @@ dependencies = [ "bevy_mikktspace", "bevy_reflect", "bevy_render_macros", + "bevy_tasks", "bevy_time", "bevy_transform", "bevy_utils", @@ -1008,25 +1109,27 @@ dependencies = [ "downcast-rs", "encase", "futures-lite", - "hex", "hexasphere", "image", + "ktx2", "naga", "once_cell", "parking_lot 0.12.1", "regex", + "ruzstd", "serde", "smallvec", "thiserror", "thread_local", "wgpu", + "wgpu-hal", ] [[package]] name = "bevy_render_macros" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7acae697776ac05bea523e1725cf2660c91c53abe72c66782ea1e1b9eedb572" +checksum = "570b1d0f38439c5ac8ab75572804c9979b9caa372c49bd00803f60a22a3e1328" dependencies = [ "bevy_macro_utils", "proc-macro2", @@ -1036,9 +1139,9 @@ dependencies = [ [[package]] name = "bevy_scene" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea9c66a628c833d53bae54fe94cbc0d3f12c29e9d2e6c3f2356d45ad57db0c8c" +checksum = "3995f756e482e964e0244a5d388e757f272d1dcdc02136730b1c45f4d5eeb516" dependencies = [ "anyhow", "bevy_app", @@ -1058,9 +1161,9 @@ dependencies = [ [[package]] name = "bevy_sprite" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ec01c7db7f698d95bcb70708527c3ae6bcdc78fc247abe74f935cae8f0a1145" +checksum = "14aa41c9480b76d7b3c3f1ed89f95c9d6e2a39d3c3367ca82c122d853ac0463e" dependencies = [ "bevy_app", "bevy_asset", @@ -1083,14 +1186,14 @@ dependencies = [ [[package]] name = "bevy_tasks" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "680b16b53df9c9f24681dd95f4d772d83760bd19adf8bca00f358a3aad997853" +checksum = "3e368e4177fe70d695d5cb67fb7480fa262de79948d9b883a21788b9abf5a85a" dependencies = [ "async-channel", "async-executor", "async-task", - "concurrent-queue 1.2.4", + "concurrent-queue", "futures-lite", "once_cell", "wasm-bindgen-futures", @@ -1098,9 +1201,9 @@ dependencies = [ [[package]] name = "bevy_text" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60c74c1bdaabde7db28f6728aa13bc7b1d744a2201b2bbfd83d2224404c57f5c" +checksum = "33fc934d7cbadbb6dac11547dfb805d3e6b3f0b40f6e66e437fe4b3c7581cc5c" dependencies = [ "ab_glyph", "anyhow", @@ -1121,22 +1224,23 @@ dependencies = [ [[package]] name = "bevy_time" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5c38a6d3ea929c7f81e6adf5a6c62cf7e8c40f5106c2174d6057e9d8ea624d" +checksum = "d2f2863cfc08fa38909e047a1bbc2dd71d0836057ed0840c69ace9dff3e0c298" dependencies = [ "bevy_app", "bevy_ecs", "bevy_reflect", "bevy_utils", "crossbeam-channel", + "thiserror", ] [[package]] name = "bevy_transform" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba13c57a040b89767191a6f6d720a635b7792793628bfa41a9e38b7026484aec" +checksum = "de9cda3df545ac889b4f6b702109e51d29d7b4b6f402f2bb9b4d1d9f9c382b63" dependencies = [ "bevy_app", "bevy_ecs", @@ -1147,10 +1251,11 @@ dependencies = [ [[package]] name = "bevy_ui" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60e82ace6156f11fcdf2319102ff8fb8367b82d1e32b7d05d387a1963602f965" +checksum = "dc341d652ba20fac0170a46eff8310829a862f4e52db06164dc6200706768934" dependencies = [ + "bevy_a11y", "bevy_app", "bevy_asset", "bevy_core_pipeline", @@ -1176,23 +1281,37 @@ dependencies = [ [[package]] name = "bevy_utils" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16750aae52cd35bd7b60eb61cee883420b250e11b4a290b8d44b2b2941795739" +checksum = "04d90ce493910ad9af3b4220ea6864c7d1472761086a98230ecac59c8d547e95" dependencies = [ "ahash 0.7.6", + "bevy_utils_proc_macros", "getrandom", "hashbrown", "instant", + "petgraph", + "thiserror", "tracing", "uuid", ] +[[package]] +name = "bevy_utils_proc_macros" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62a42e465c446800c57a5bf65b64f4fa1c1f3a74efc2a64a2a001e4a4f548a2e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "bevy_window" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a44d3f3bd54a2261f4f57f614bf7bccc8d2832761493c0cd7dab81d98cc151e" +checksum = "da8a2c523302ad64768991a7474c6010c76b9eb78323309ef3911521887fd108" dependencies = [ "bevy_app", "bevy_ecs", @@ -1200,24 +1319,29 @@ dependencies = [ "bevy_math", "bevy_reflect", "bevy_utils", - "raw-window-handle 0.5.1", + "raw-window-handle", ] [[package]] name = "bevy_winit" -version = "0.9.1" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7b7e647ecd0b3577468da37767dcdd7c26ca9f80da0060b2ec4c77336b6d2e1" +checksum = "8eb6eb9b9790c1ad925d900a3f315abf15b11fb56c6464747a96560e559e1a9c" dependencies = [ + "accesskit_winit", "approx", + "bevy_a11y", "bevy_app", + "bevy_derive", "bevy_ecs", + "bevy_hierarchy", "bevy_input", "bevy_math", "bevy_utils", "bevy_window", "crossbeam-channel", - "raw-window-handle 0.5.1", + "once_cell", + "raw-window-handle", "wasm-bindgen", "web-sys", "winit", @@ -1279,6 +1403,25 @@ dependencies = [ "generic-array", ] +[[package]] +name = "block-sys" +version = "0.1.0-beta.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" +dependencies = [ + "objc-sys", +] + +[[package]] +name = "block2" +version = "0.2.0-alpha.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" +dependencies = [ + "block-sys", + "objc2-encode", +] + [[package]] name = "blocking" version = "1.3.0" @@ -1361,12 +1504,6 @@ dependencies = [ "bytes", ] -[[package]] -name = "cache-padded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1db59621ec70f09c5e9b597b220c7a2b43611f4710dc03ceb8748637775692c" - [[package]] name = "cast" version = "0.3.0" @@ -1505,37 +1642,6 @@ dependencies = [ "os_str_bytes", ] -[[package]] -name = "cocoa" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f425db7937052c684daec3bd6375c8abe2d146dca4b8b143d6db777c39138f3a" -dependencies = [ - "bitflags", - "block", - "cocoa-foundation", - "core-foundation", - "core-graphics", - "foreign-types", - "libc", - "objc", -] - -[[package]] -name = "cocoa-foundation" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ade49b65d560ca58c403a479bb396592b155c0185eada742ee323d1d68d6318" -dependencies = [ - "bitflags", - "block", - "core-foundation", - "core-graphics-types", - "foreign-types", - "libc", - "objc", -] - [[package]] name = "codespan-reporting" version = "0.11.1" @@ -1552,6 +1658,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" +[[package]] +name = "com-rs" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" + [[package]] name = "combine" version = "4.6.6" @@ -1562,15 +1674,6 @@ dependencies = [ "memchr", ] -[[package]] -name = "concurrent-queue" -version = "1.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af4780a44ab5696ea9e28294517f1fffb421a83a25af521333c838635509db9c" -dependencies = [ - "cache-padded", -] - [[package]] name = "concurrent-queue" version = "2.1.0" @@ -1619,10 +1722,16 @@ version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.3", "libc", ] +[[package]] +name = "core-foundation-sys" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7ca8a5221364ef15ce201e8ed2f609fc312682a8f4e0e3d4aa5879764e0fa3b" + [[package]] name = "core-foundation-sys" version = "0.8.3" @@ -1656,11 +1765,12 @@ dependencies = [ [[package]] name = "coreaudio-rs" -version = "0.10.0" +version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11894b20ebfe1ff903cbdc52259693389eea03b94918a2def2c30c3bf227ad88" +checksum = "cb17e2d1795b1996419648915df94bc7103c28f7b48062d7acf4652fc371b2ff" dependencies = [ "bitflags", + "core-foundation-sys 0.6.2", "coreaudio-sys", ] @@ -1675,27 +1785,28 @@ dependencies = [ [[package]] name = "cpal" -version = "0.14.2" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f342c1b63e185e9953584ff2199726bf53850d96610a310e3aca09e9405a2d0b" +checksum = "d34fa7b20adf588f73f094cd9b1d944977c686e37a2759ea217ab174f017e10a" dependencies = [ "alsa", - "core-foundation-sys", + "core-foundation-sys 0.8.3", "coreaudio-rs", - "jni", + "dasp_sample", + "jni 0.19.0", "js-sys", "libc", "mach", - "ndk 0.7.0", + "ndk", "ndk-context", "oboe", "once_cell", "parking_lot 0.12.1", - "stdweb", "thiserror", "wasm-bindgen", + "wasm-bindgen-futures", "web-sys", - "windows 0.37.0", + "windows 0.44.0", ] [[package]] @@ -1803,7 +1914,7 @@ dependencies = [ "autocfg", "cfg-if", "crossbeam-utils", - "memoffset 0.8.0", + "memoffset", "scopeguard", ] @@ -1846,17 +1957,11 @@ dependencies = [ "syn", ] -[[package]] -name = "cty" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" - [[package]] name = "d3d12" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "827914e1f53b1e0e025ecd3d967a7836b7bcb54520f90e21ef8df7b4d88a2759" +checksum = "d8f0de2f5a8e7bd4a9eec0e3c781992a4ce1724f68aec7d7a3715344de8b39da" dependencies = [ "bitflags", "libloading", @@ -1864,39 +1969,10 @@ dependencies = [ ] [[package]] -name = "darling" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a01d95850c592940db9b8194bc39f4bc0e89dee5c4265e4b1807c34a9aba453c" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.13.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "859d65a907b6852c9361e3185c862aae7fafd2887876799fa55f5f99dc40d610" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.13.4" +name = "dasp_sample" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c972679f83bdf9c42bd905396b6c3588a843a17f0f16dfcfa3e2c5d57441835" -dependencies = [ - "darling_core", - "quote", - "syn", -] +checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" [[package]] name = "de_behaviour" @@ -1906,8 +1982,7 @@ dependencies = [ "de_core", "de_objects", "de_pathing", - "glam 0.22.0", - "iyes_loopless", + "glam", "parry3d", ] @@ -1921,7 +1996,6 @@ dependencies = [ "de_map", "de_terrain", "de_uom", - "iyes_loopless", "parry3d", ] @@ -1937,8 +2011,7 @@ dependencies = [ "de_signs", "de_spawner", "de_terrain", - "glam 0.22.0", - "iyes_loopless", + "glam", "parry3d", ] @@ -1954,7 +2027,6 @@ dependencies = [ "de_uom", "dirs", "futures-lite", - "iyes_loopless", "iyes_progress", "serde", "serde_yaml", @@ -1981,8 +2053,7 @@ dependencies = [ "de_spawner", "de_terrain", "enum-map", - "glam 0.22.0", - "iyes_loopless", + "glam", "parry2d", "parry3d", ] @@ -1993,8 +2064,7 @@ version = "0.1.0-dev" dependencies = [ "bevy", "enum-map", - "glam 0.22.0", - "iyes_loopless", + "glam", "iyes_progress", "nalgebra", "parry2d", @@ -2024,7 +2094,6 @@ dependencies = [ "de_signs", "de_spawner", "de_terrain", - "iyes_loopless", ] [[package]] @@ -2033,7 +2102,6 @@ version = "0.1.0-dev" dependencies = [ "bevy", "de_core", - "iyes_loopless", ] [[package]] @@ -2045,8 +2113,7 @@ dependencies = [ "criterion", "de_core", "de_objects", - "glam 0.22.0", - "iyes_loopless", + "glam", "nalgebra", "parry2d", "parry3d", @@ -2063,7 +2130,6 @@ dependencies = [ "de_spawner", "de_terrain", "futures-lite", - "iyes_loopless", "iyes_progress", ] @@ -2101,7 +2167,6 @@ dependencies = [ "de_core", "de_lobby_model", "futures-lite", - "iyes_loopless", "iyes_progress", "reqwest", "serde", @@ -2127,7 +2192,7 @@ dependencies = [ "bevy", "de_core", "enum-map", - "glam 0.22.0", + "glam", "parry2d", "serde", "serde_json", @@ -2148,7 +2213,6 @@ dependencies = [ "de_lobby_model", "de_map", "futures-lite", - "iyes_loopless", "thiserror", ] @@ -2162,8 +2226,7 @@ dependencies = [ "de_map", "de_objects", "de_pathing", - "glam 0.22.0", - "iyes_loopless", + "glam", "parry2d", "parry3d", ] @@ -2176,8 +2239,7 @@ dependencies = [ "bevy", "de_core", "enum-map", - "glam 0.22.0", - "iyes_loopless", + "glam", "iyes_progress", "parry2d", "parry3d", @@ -2197,8 +2259,7 @@ dependencies = [ "de_map", "de_objects", "futures-lite", - "glam 0.22.0", - "iyes_loopless", + "glam", "nalgebra", "ntest", "parry2d", @@ -2216,8 +2277,7 @@ dependencies = [ "de_core", "de_objects", "de_terrain", - "glam 0.22.0", - "iyes_loopless", + "glam", ] [[package]] @@ -2231,7 +2291,6 @@ dependencies = [ "de_map", "de_objects", "de_terrain", - "iyes_loopless", "parry2d", "parry3d", ] @@ -2245,9 +2304,8 @@ dependencies = [ "de_core", "de_map", "de_objects", - "glam 0.22.0", + "glam", "itertools", - "iyes_loopless", "iyes_progress", "parry3d", ] @@ -2259,7 +2317,7 @@ dependencies = [ "async-std", "clap 4.1.8", "de_map", - "glam 0.22.0", + "glam", "gltf", "parry3d", ] @@ -2281,7 +2339,7 @@ dependencies = [ "convert_case", "proc-macro2", "quote", - "rustc_version 0.4.0", + "rustc_version", "syn", ] @@ -2316,12 +2374,6 @@ dependencies = [ "winapi", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - [[package]] name = "dispatch" version = "0.2.0" @@ -2348,30 +2400,30 @@ checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "encase" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48ec50086547d597b5c871a78399ec04a14828a6a5c445a61ed4687c540edec6" +checksum = "e6591f13a63571c4821802eb5b10fd1155b1290bce87086440003841c8c3909b" dependencies = [ "const_panic", "encase_derive", - "glam 0.22.0", + "glam", "thiserror", ] [[package]] name = "encase_derive" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dda93e9714c7683c474f49a461a2ae329471d2bda43c4302d41c6d8339579e92" +checksum = "4f1da6deed1f8b6f5909616ffa695f63a5de54d6a0f084fa715c70c8ed3abac9" dependencies = [ "encase_derive_impl", ] [[package]] name = "encase_derive_impl" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec27b639e942eb0297513b81cc6d87c50f6c77dc8c37af00a39ed5db3b9657ee" +checksum = "ae489d58959f3c4cdd1250866a05acfb341469affe4fced71aff3ba228be1693" dependencies = [ "proc-macro2", "quote", @@ -2482,7 +2534,7 @@ checksum = "8a3de6e8d11b22ff9edc6d916f890800597d60f8b2da1caf2955c274638d6412" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "windows-sys 0.45.0", ] @@ -2716,20 +2768,20 @@ dependencies = [ ] [[package]] -name = "glam" -version = "0.22.0" +name = "gimli" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12f597d56c1bd55a811a1be189459e8fad2bbc272616375602443bdfb37fa774" -dependencies = [ - "bytemuck", - "serde", -] +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "glam" version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e4afd9ad95555081e109fe1d21f2a30c691b5f0919c67dfa690a2e1eb6bd51c" +dependencies = [ + "bytemuck", + "serde", +] [[package]] name = "glob" @@ -2751,9 +2803,9 @@ dependencies = [ [[package]] name = "glow" -version = "0.11.2" +version = "0.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8bd5877156a19b8ac83a29b2306fe20537429d318f3ff0a1a2119f8d9c61919" +checksum = "4e007a07a24de5ecae94160f141029e9a347282cfe25d1d58d85d845cf3130f1" dependencies = [ "js-sys", "slotmap", @@ -2830,13 +2882,26 @@ dependencies = [ ] [[package]] -name = "gpu-descriptor" -version = "0.2.3" +name = "gpu-allocator" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" +checksum = "ce95f9e2e11c2c6fadfce42b5af60005db06576f231f5c92550fdded43c423e8" dependencies = [ - "bitflags", - "gpu-descriptor-types", + "backtrace", + "log", + "thiserror", + "winapi", + "windows 0.44.0", +] + +[[package]] +name = "gpu-descriptor" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b0c02e1ba0bdb14e965058ca34e09c020f8e507a760df1121728e0aef68d57a" +dependencies = [ + "bitflags", + "gpu-descriptor-types", "hashbrown", ] @@ -2893,17 +2958,6 @@ dependencies = [ "byteorder", ] -[[package]] -name = "hash32-derive" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59d2aba832b60be25c1b169146b27c64115470981b128ed84c8db18c1b03c6ff" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "hashbrown" version = "0.12.3" @@ -2923,6 +2977,21 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "hassle-rs" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90601c6189668c7345fc53842cb3f3a3d872203d523be1b3cb44a36a3e62fb85" +dependencies = [ + "bitflags", + "com-rs", + "libc", + "libloading", + "thiserror", + "widestring", + "winapi", +] + [[package]] name = "heapless" version = "0.7.16" @@ -2931,7 +3000,7 @@ checksum = "db04bc24a18b9ea980628ecf00e6c0264f3c1426dac36c00cb49b6fbad8b0743" dependencies = [ "atomic-polyfill", "hash32", - "rustc_version 0.4.0", + "rustc_version", "spin 0.9.5", "stable_deref_trait", ] @@ -2981,7 +3050,7 @@ version = "8.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd41d443f978bfa380a6dad58b62a08c43bcb960631f13e9d015b911eaf73588" dependencies = [ - "glam 0.23.0", + "glam", "once_cell", ] @@ -3077,12 +3146,6 @@ dependencies = [ "tokio-native-tls", ] -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - [[package]] name = "idna" version = "0.3.0" @@ -3163,7 +3226,7 @@ version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7789f7f3c9686f96164f5109d69152de759e76e284f736bd57661c6df5091919" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.3", "mach", ] @@ -3211,33 +3274,33 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] -name = "iyes_loopless" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c47fd2cbdb1d7f295c25e6bfccfd78a84b6eef3055bc9f01b34ae861721b01ee" +name = "iyes_progress" +version = "0.8.0" +source = "git+https://github.com/NiklasEi/iyes_progress?rev=ab493dba453505cda451c7cc3b3ca0db233e4005#ab493dba453505cda451c7cc3b3ca0db233e4005" dependencies = [ "bevy_app", "bevy_ecs", - "bevy_time", - "bevy_utils", ] [[package]] -name = "iyes_progress" -version = "0.7.1" +name = "jni" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266c468795c5af070ab4c5fa01aca792a8f01f511e76feb9bea3878a1dbee144" +checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" dependencies = [ - "bevy_app", - "bevy_ecs", - "iyes_loopless", + "cesu8", + "combine", + "jni-sys", + "log", + "thiserror", + "walkdir", ] [[package]] name = "jni" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" +checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c" dependencies = [ "cesu8", "combine", @@ -3331,6 +3394,15 @@ dependencies = [ "libc", ] +[[package]] +name = "ktx2" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87d65e08a9ec02e409d27a0139eaa6b9756b4d81fe7cde71f6941a83730ce838" +dependencies = [ + "bitflags", +] + [[package]] name = "kv-log-macro" version = "1.0.7" @@ -3498,15 +3570,6 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - [[package]] name = "memoffset" version = "0.8.0" @@ -3565,9 +3628,9 @@ dependencies = [ [[package]] name = "naga" -version = "0.10.0" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "262d2840e72dbe250e8cf2f522d080988dfca624c4112c096238a4845f591707" +checksum = "5eafe22a23b797c9bc227c6c896419b26b5bb88fa903417a3adaed08778850d5" dependencies = [ "bit-set", "bitflags", @@ -3592,7 +3655,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d68d47bba83f9e2006d117a9a33af1524e655516b8919caac694427a6fb1e511" dependencies = [ "approx", - "glam 0.22.0", + "glam", "matrixmultiply", "nalgebra-macros", "num-complex", @@ -3631,19 +3694,6 @@ dependencies = [ "tempfile", ] -[[package]] -name = "ndk" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2032c77e030ddee34a6787a64166008da93f6a352b629261d0fee232b8742dd4" -dependencies = [ - "bitflags", - "jni-sys", - "ndk-sys 0.3.0", - "num_enum", - "thiserror", -] - [[package]] name = "ndk" version = "0.7.0" @@ -3652,9 +3702,9 @@ checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" dependencies = [ "bitflags", "jni-sys", - "ndk-sys 0.4.1+23.1.7779620", + "ndk-sys", "num_enum", - "raw-window-handle 0.5.1", + "raw-window-handle", "thiserror", ] @@ -3664,45 +3714,6 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" -[[package]] -name = "ndk-glue" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0434fabdd2c15e0aab768ca31d5b7b333717f03cf02037d5a0a3ff3c278ed67f" -dependencies = [ - "android_logger", - "libc", - "log", - "ndk 0.7.0", - "ndk-context", - "ndk-macro", - "ndk-sys 0.4.1+23.1.7779620", - "once_cell", - "parking_lot 0.12.1", -] - -[[package]] -name = "ndk-macro" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df7ac00c4672f9d5aece54ee3347520b7e20f158656c7db2e6de01902eb7a6c" -dependencies = [ - "darling", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "ndk-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e5a6ae77c8ee183dcbbba6150e2e6b9f3f4196a7666c02a715a95692ec1fa97" -dependencies = [ - "jni-sys", -] - [[package]] name = "ndk-sys" version = "0.4.1+23.1.7779620" @@ -3714,15 +3725,13 @@ dependencies = [ [[package]] name = "nix" -version = "0.23.2" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3790c00a0150112de0f4cd161e3d7fc4b2d8a5542ffc35f099a2562aecb35c" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags", - "cc", "cfg-if", "libc", - "memoffset 0.6.5", ] [[package]] @@ -3765,6 +3774,15 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "ntapi" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc51db7b362b205941f71232e56c625156eb9a929f8cf74a428fd5bc094a4afc" +dependencies = [ + "winapi", +] + [[package]] name = "ntest" version = "0.9.0" @@ -3911,6 +3929,32 @@ dependencies = [ "objc_exception", ] +[[package]] +name = "objc-sys" +version = "0.2.0-beta.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" + +[[package]] +name = "objc2" +version = "0.3.0-beta.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe31e5425d3d0b89a15982c024392815da40689aceb34bad364d58732bcfd649" +dependencies = [ + "block2", + "objc-sys", + "objc2-encode", +] + +[[package]] +name = "objc2-encode" +version = "2.0.0-pre.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" +dependencies = [ + "objc-sys", +] + [[package]] name = "objc_exception" version = "0.1.2" @@ -3920,14 +3964,23 @@ dependencies = [ "cc", ] +[[package]] +name = "object" +version = "0.30.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" +dependencies = [ + "memchr", +] + [[package]] name = "oboe" -version = "0.4.6" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f63c358b4fa0fbcfefd7c8be5cfc39c08ce2389f5325687e7762a48d30a5c1" +checksum = "8868cc237ee02e2d9618539a23a8d228b9bb3fc2e7a5b11eed3831de77c395d0" dependencies = [ - "jni", - "ndk 0.6.0", + "jni 0.20.0", + "ndk", "ndk-context", "num-derive", "num-traits", @@ -3936,9 +3989,9 @@ dependencies = [ [[package]] name = "oboe-sys" -version = "0.4.5" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3370abb7372ed744232c12954d920d1a40f1c4686de9e79e800021ef492294bd" +checksum = "7f44155e7fb718d3cfddcf70690b2b51ac4412f347cd9e4fbe511abe9cd7b5f2" dependencies = [ "cc", ] @@ -4015,6 +4068,18 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978aa494585d3ca4ad74929863093e87cac9790d81fe7aba2b3dc2890643a0fc" +[[package]] +name = "orbclient" +version = "0.3.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "974465c5e83cf9df05c1e4137b271d29035c902e39e5ad4c1939837e22160af8" +dependencies = [ + "cfg-if", + "redox_syscall 0.2.16", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "os_str_bytes" version = "6.4.1" @@ -4072,7 +4137,7 @@ dependencies = [ "cfg-if", "instant", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "winapi", ] @@ -4085,7 +4150,7 @@ checksum = "9069cbb9f99e3a5083476ccb29ceb1de18b9118cafa53e90c9551235de2b9521" dependencies = [ "cfg-if", "libc", - "redox_syscall", + "redox_syscall 0.2.16", "smallvec", "windows-sys 0.45.0", ] @@ -4279,7 +4344,7 @@ dependencies = [ "autocfg", "bitflags", "cfg-if", - "concurrent-queue 2.1.0", + "concurrent-queue", "libc", "log", "pin-project-lite", @@ -4401,15 +4466,6 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" -[[package]] -name = "raw-window-handle" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b800beb9b6e7d2df1fe337c9e3d04e3af22a124460fb4c30fcc22c9117cefb41" -dependencies = [ - "cty", -] - [[package]] name = "raw-window-handle" version = "0.5.1" @@ -4459,6 +4515,15 @@ dependencies = [ "bitflags", ] +[[package]] +name = "redox_syscall" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb02a9aee8e8c7ad8d86890f1e16b49e0bbbffc9961ff3788c31d57c98bcbf03" +dependencies = [ + "bitflags", +] + [[package]] name = "redox_users" version = "0.4.3" @@ -4466,7 +4531,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" dependencies = [ "getrandom", - "redox_syscall", + "redox_syscall 0.2.16", "thiserror", ] @@ -4562,9 +4627,9 @@ checksum = "e5864e7ef1a6b7bcf1d6ca3f655e65e724ed3b52546a0d0a663c991522f552ea" [[package]] name = "rodio" -version = "0.16.0" +version = "0.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb10b653d5ec0e9411a2e7d46e2c7f4046fd87d35b9955bd73ba4108d69072b5" +checksum = "bdf1d4dea18dff2e9eb6dca123724f8b60ef44ad74a9ad283cdfe025df7e73fa" dependencies = [ "cpal", "lewton", @@ -4593,19 +4658,16 @@ dependencies = [ ] [[package]] -name = "rustc-hash" -version = "1.1.0" +name = "rustc-demangle" +version = "0.1.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" [[package]] -name = "rustc_version" -version = "0.2.3" +name = "rustc-hash" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver 0.9.0", -] +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" [[package]] name = "rustc_version" @@ -4613,7 +4675,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.16", + "semver", ] [[package]] @@ -4651,6 +4713,16 @@ dependencies = [ "base64 0.21.0", ] +[[package]] +name = "ruzstd" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cada0ef59efa6a5f4dc5e491f93d9f31e3fc7758df421ff1de8a706338e1100" +dependencies = [ + "byteorder", + "twox-hash", +] + [[package]] name = "ryu" version = "1.0.13" @@ -4714,7 +4786,7 @@ checksum = "a332be01508d814fed64bf28f798a146d73792121129962fdf335bb3c49a4254" dependencies = [ "bitflags", "core-foundation", - "core-foundation-sys", + "core-foundation-sys 0.8.3", "libc", "security-framework-sys", ] @@ -4725,31 +4797,16 @@ version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31c9bb296072e961fcbd8853511dd39c2d8be2deb1e17c6860b1d30732b323b4" dependencies = [ - "core-foundation-sys", + "core-foundation-sys 0.8.3", "libc", ] -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - [[package]] name = "semver" version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a" -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - [[package]] name = "serde" version = "1.0.154" @@ -4806,15 +4863,6 @@ dependencies = [ "unsafe-libyaml", ] -[[package]] -name = "sha1" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1da05c97445caa12d05e848c4a4fcbbea29e748ac28f7e80e9b010392063770" -dependencies = [ - "sha1_smol", -] - [[package]] name = "sha1" version = "0.10.5" @@ -4826,12 +4874,6 @@ dependencies = [ "digest", ] -[[package]] -name = "sha1_smol" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae1a47186c03a32177042e55dbc5fd5aee900b8e0069a8d70fba96a9375cd012" - [[package]] name = "sha2" version = "0.10.6" @@ -5095,55 +5137,6 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version 0.2.3", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2", - "quote", - "serde", - "serde_derive", - "serde_json", - "sha1 0.6.1", - "syn", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - [[package]] name = "stringprep" version = "0.1.2" @@ -5183,17 +5176,29 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "sysinfo" +version = "0.28.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e847e2de7a137c8c2cede5095872dbb00f4f9bf34d061347e36b43322acd56" +dependencies = [ + "cfg-if", + "core-foundation-sys 0.8.3", + "libc", + "ntapi", + "once_cell", + "winapi", +] + [[package]] name = "taffy" -version = "0.1.0" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec27dea659b100d489dffa57cf0efc6d7bfefb119af817b92cc14006c0b214e3" +checksum = "e38edd8e57ffadcbdaf4c60c8738a8938318b4c4d3d281ae369033b80e5efa75" dependencies = [ "arrayvec", - "hash32", - "hash32-derive", "num-traits", - "typenum", + "slotmap", ] [[package]] @@ -5204,7 +5209,7 @@ checksum = "af18f7ae1acd354b992402e9ec5864359d693cd8a79dcbef59f76891701c1e95" dependencies = [ "cfg-if", "fastrand", - "redox_syscall", + "redox_syscall 0.2.16", "rustix", "windows-sys 0.42.0", ] @@ -5371,15 +5376,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "toml" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4f7f0dd8d50a853a531c426359045b1998f04219d88799810762cd4ad314234" -dependencies = [ - "serde", -] - [[package]] name = "toml_datetime" version = "0.6.1" @@ -5489,6 +5485,16 @@ version = "0.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0609f771ad9c6155384897e1df4d948e692667cc0588548b68eb44d052b27633" +[[package]] +name = "twox-hash" +version = "1.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" +dependencies = [ + "cfg-if", + "static_assertions", +] + [[package]] name = "typenum" version = "1.16.0" @@ -5713,6 +5719,17 @@ version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +[[package]] +name = "wayland-scanner" +version = "0.29.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" +dependencies = [ + "proc-macro2", + "quote", + "xml-rs", +] + [[package]] name = "web-sys" version = "0.3.61" @@ -5744,16 +5761,18 @@ dependencies = [ [[package]] name = "wgpu" -version = "0.14.2" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81f643110d228fd62a60c5ed2ab56c4d5b3704520bd50561174ec4ec74932937" +checksum = "d745a1b6d91d85c33defbb29f0eee0450e1d2614d987e14bf6baf26009d132d7" dependencies = [ "arrayvec", + "cfg-if", "js-sys", "log", "naga", "parking_lot 0.12.1", - "raw-window-handle 0.5.1", + "profiling", + "raw-window-handle", "smallvec", "static_assertions", "wasm-bindgen", @@ -5766,21 +5785,20 @@ dependencies = [ [[package]] name = "wgpu-core" -version = "0.14.2" +version = "0.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6000d1284ef8eec6076fd5544a73125fd7eb9b635f18dceeb829d826f41724ca" +checksum = "7131408d940e335792645a98f03639573b0480e9e2e7cddbbab74f7c6d9f3fff" dependencies = [ "arrayvec", "bit-vec", "bitflags", - "cfg_aliases", "codespan-reporting", "fxhash", "log", "naga", "parking_lot 0.12.1", "profiling", - "raw-window-handle 0.5.1", + "raw-window-handle", "smallvec", "thiserror", "web-sys", @@ -5790,9 +5808,9 @@ dependencies = [ [[package]] name = "wgpu-hal" -version = "0.14.1" +version = "0.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc320a61acb26be4f549c9b1b53405c10a223fbfea363ec39474c32c348d12f" +checksum = "7762ae7fcc06943c1b5d4987ab0194e82aaba7767fbfb75d3458844c5b82cc45" dependencies = [ "android_system_properties", "arrayvec", @@ -5806,9 +5824,12 @@ dependencies = [ "fxhash", "glow", "gpu-alloc", + "gpu-allocator", "gpu-descriptor", + "hassle-rs", "js-sys", "khronos-egl", + "libc", "libloading", "log", "metal", @@ -5817,7 +5838,7 @@ dependencies = [ "parking_lot 0.12.1", "profiling", "range-alloc", - "raw-window-handle 0.5.1", + "raw-window-handle", "renderdoc-sys", "smallvec", "thiserror", @@ -5829,11 +5850,13 @@ dependencies = [ [[package]] name = "wgpu-types" -version = "0.14.1" +version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb6b28ef22cac17b9109b25b3bf8c9a103eeb293d7c5f78653979b09140375f6" +checksum = "32444e121b0bd00cb02c0de32fde457a9491bd44e03e7a5db6df9b1da2f6f110" dependencies = [ "bitflags", + "js-sys", + "web-sys", ] [[package]] @@ -5846,6 +5869,12 @@ dependencies = [ "safe_arch", ] +[[package]] +name = "widestring" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" + [[package]] name = "winapi" version = "0.3.9" @@ -5879,43 +5908,50 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows" -version = "0.37.0" +version = "0.43.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57b543186b344cc61c85b5aab0d2e3adf4e0f99bc076eff9aa5927bcc0b8a647" +checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244" dependencies = [ - "windows_aarch64_msvc 0.37.0", - "windows_i686_gnu 0.37.0", - "windows_i686_msvc 0.37.0", - "windows_x86_64_gnu 0.37.0", - "windows_x86_64_msvc 0.37.0", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", ] [[package]] name = "windows" -version = "0.43.0" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244" +checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows-implement", + "windows-interface", + "windows-targets", ] [[package]] -name = "windows-sys" -version = "0.36.1" +name = "windows-implement" +version = "0.44.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce87ca8e3417b02dc2a8a22769306658670ec92d78f1bd420d6310a67c245c6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.44.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea04155a16a59f9eab786fe12a4a450e75cdb175f9e0d80da1e17db09f55b8d2" +checksum = "853f69a591ecd4f810d29f17e902d40e349fb05b0b11fff63b08b826bfe39c7f" dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -5925,12 +5961,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows_x86_64_msvc", ] [[package]] @@ -5949,12 +5985,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" dependencies = [ "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_msvc", + "windows_x86_64_gnu", "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", + "windows_x86_64_msvc", ] [[package]] @@ -5963,72 +5999,24 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2623277cb2d1c216ba3b578c0f3cf9cdebeddb6e66b1b218bb33596ea7769c3a" - [[package]] name = "windows_aarch64_msvc" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_gnu" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3925fd0b0b804730d44d4b6278c50f9699703ec49bcd628020f46f4ba07d9e1" - [[package]] name = "windows_i686_gnu" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_i686_msvc" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce907ac74fe331b524c1298683efbf598bb031bc84d5e274db2083696d07c57c" - [[package]] name = "windows_i686_msvc" version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2babfba0828f2e6b32457d5341427dcbb577ceef556273229959ac23a10af33d" - [[package]] name = "windows_x86_64_gnu" version = "0.42.1" @@ -6041,18 +6029,6 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.37.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4dd6dc7df2d84cf7b33822ed5b86318fb1781948e9663bacd047fc9dd52259d" - [[package]] name = "windows_x86_64_msvc" version = "0.42.1" @@ -6061,12 +6037,13 @@ checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" [[package]] name = "winit" -version = "0.27.5" +version = "0.28.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb796d6fbd86b2fd896c9471e6f04d39d750076ebe5680a3958f00f5ab97657c" +checksum = "9d38e7dc904dda347b54dbec3b2d4bf534794f4fb4e6df0be91a264f4f2ed1cf" dependencies = [ + "android-activity", "bitflags", - "cocoa", + "cfg_aliases", "core-foundation", "core-graphics", "dispatch", @@ -6074,17 +6051,17 @@ dependencies = [ "libc", "log", "mio", - "ndk 0.7.0", - "ndk-glue", - "objc", + "ndk", + "objc2", "once_cell", - "parking_lot 0.12.1", + "orbclient", "percent-encoding", - "raw-window-handle 0.4.3", - "raw-window-handle 0.5.1", + "raw-window-handle", + "redox_syscall 0.3.4", "wasm-bindgen", + "wayland-scanner", "web-sys", - "windows-sys 0.36.1", + "windows-sys 0.45.0", "x11-dl", ] @@ -6132,6 +6109,12 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a67300977d3dc3f8034dae89778f502b6ba20b269527b3223ba59c0cf393bb8a" +[[package]] +name = "xml-rs" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2d7d3948613f75c98fd9328cfdcc45acc4d360655289d0a7d4ec931392200a3" + [[package]] name = "zstd" version = "0.12.3+zstd.1.5.2" diff --git a/Cargo.toml b/Cargo.toml index c6d908eec..a63651841 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -48,7 +48,6 @@ de_terrain.workspace = true # Other bevy.workspace = true -iyes_loopless.workspace = true [workspace] members = ["crates/*"] @@ -94,18 +93,18 @@ approx = "0.5.1" async-compat = "0.2.1" async-std = "1.11" async-tar = "0.4.2" -bevy = "0.9" +bevy = "0.10" clap = { version = "4.0", features = ["derive"] } criterion = "0.4" dirs = "4.0.0" enum-map = "2.3.0" futures-lite = "1.11" -glam = "0.22" +glam = "0.23" gltf = "1.0" itertools = "0.10.5" -iyes_loopless = "0.9.1" -iyes_progress = { version = "0.7.1", features = [ "iyes_loopless" ] } -nalgebra = { version = "0.32.2", features = ["convert-glam022"] } +# TODO: use a released version +iyes_progress = { git = "https://github.com/NiklasEi/iyes_progress", rev = "ab493dba453505cda451c7cc3b3ca0db233e4005" } +nalgebra = { version = "0.32.2", features = ["convert-glam023"] } ntest = "0.9.0" parry2d = "0.13.1" parry3d = "0.13.1" diff --git a/assets/shaders/bar.wgsl b/assets/shaders/bar.wgsl index f93ce0ccc..d63e66625 100644 --- a/assets/shaders/bar.wgsl +++ b/assets/shaders/bar.wgsl @@ -2,8 +2,8 @@ #import bevy_pbr::mesh_bindings #import bevy_pbr::mesh_functions -let BACKGROUND_COLOR = vec4(0., 0., 0., 0.75); -let FOREGROUND_COLOR = vec4(0.6, 1., 0.6, 0.75); +const BACKGROUND_COLOR = vec4(0., 0., 0., 0.75); +const FOREGROUND_COLOR = vec4(0.6, 1., 0.6, 0.75); @group(1) @binding(0) var value: f32; diff --git a/assets/shaders/terrain.wgsl b/assets/shaders/terrain.wgsl index 538a4ac45..cc4352cd8 100644 --- a/assets/shaders/terrain.wgsl +++ b/assets/shaders/terrain.wgsl @@ -5,15 +5,17 @@ #import bevy_pbr::utils #import bevy_pbr::clustered_forward #import bevy_pbr::lighting +#import bevy_pbr::pbr_ambient #import bevy_pbr::shadows +#import bevy_pbr::fog #import bevy_pbr::pbr_functions // How large (in meters) is a texture. -let TEXTURE_SIZE = 16.; -let SHAPE_COLOR = vec4(1., 1., 1., 0.75); -let SHAPE_THICKNESS = 0.15; +const TEXTURE_SIZE = 16.; +const SHAPE_COLOR = vec4(1., 1., 1., 0.75); +const SHAPE_THICKNESS = 0.15; // Keep thie array lenght in sync with /crates/terrain/src/shader.rs. -let MAX_KD_TREE_SIZE = 127u; +const MAX_KD_TREE_SIZE = 127u; struct KdTreeNode { @align(16) location: vec2, @@ -179,11 +181,18 @@ fn fragment(in: FragmentInput) -> @location(0) vec4 { in.world_tangent, #endif #endif +#ifdef VERTEX_UVS in.uv, +#endif ); pbr_input.V = calculate_view(in.world_position, pbr_input.is_orthographic); - var output_color = tone_mapping(pbr(pbr_input)); + var output_color = pbr(pbr_input); + +#ifdef TONEMAP_IN_SHADER + output_color = tone_mapping(output_color); +#endif + output_color = draw_circles(output_color, in.uv); return output_color; } diff --git a/assets/shaders/trail.wgsl b/assets/shaders/trail.wgsl index 0b9c1aacd..ada22b8bc 100644 --- a/assets/shaders/trail.wgsl +++ b/assets/shaders/trail.wgsl @@ -1,6 +1,6 @@ #import bevy_pbr::mesh_view_bindings -let COLOR = vec4(1., 0.85, 0.1, 0.7); +const COLOR = vec4(1., 0.85, 0.1, 0.7); @group(1) @binding(0) var start_time: f32; diff --git a/crates/behaviour/Cargo.toml b/crates/behaviour/Cargo.toml index f7537d320..6dcc91ad0 100644 --- a/crates/behaviour/Cargo.toml +++ b/crates/behaviour/Cargo.toml @@ -19,6 +19,5 @@ de_pathing.workspace = true # Other bevy.workspace = true -iyes_loopless.workspace = true glam.workspace = true parry3d.workspace = true diff --git a/crates/behaviour/src/chase.rs b/crates/behaviour/src/chase.rs index a014678a4..337dafdc5 100644 --- a/crates/behaviour/src/chase.rs +++ b/crates/behaviour/src/chase.rs @@ -1,28 +1,28 @@ use bevy::prelude::*; -use de_core::{gamestate::GameState, projection::ToFlat, stages::GameStage}; +use de_core::{baseset::GameSet, gamestate::GameState, projection::ToFlat}; use de_pathing::{PathQueryProps, PathTarget, UpdateEntityPath}; -use iyes_loopless::prelude::*; pub(crate) struct ChasePlugin; impl Plugin for ChasePlugin { fn build(&self, app: &mut App) { app.add_event::() - .add_system_to_stage( - GameStage::PreUpdate, + .add_system( handle_chase_events - .run_in_state(GameState::Playing) - .label(ChaseLabel::ChaseTargetEvent), + .in_base_set(GameSet::PreUpdate) + .run_if(in_state(GameState::Playing)) + .in_set(ChaseSet::ChaseTargetEvent), ) - .add_system_set_to_stage( - GameStage::Update, - SystemSet::new().with_system(chase.run_in_state(GameState::Playing)), + .add_system( + chase + .in_base_set(GameSet::Update) + .run_if(in_state(GameState::Playing)), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub enum ChaseLabel { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub enum ChaseSet { ChaseTargetEvent, } diff --git a/crates/behaviour/src/lib.rs b/crates/behaviour/src/lib.rs index 83f07d11f..1a8321c4b 100644 --- a/crates/behaviour/src/lib.rs +++ b/crates/behaviour/src/lib.rs @@ -2,7 +2,7 @@ use bevy::{app::PluginGroupBuilder, prelude::PluginGroup}; use chase::ChasePlugin; -pub use chase::{ChaseLabel, ChaseTarget, ChaseTargetComponent, ChaseTargetEvent}; +pub use chase::{ChaseSet, ChaseTarget, ChaseTargetComponent, ChaseTargetEvent}; mod chase; diff --git a/crates/camera/Cargo.toml b/crates/camera/Cargo.toml index 345d0d9cf..ea4e1ae46 100644 --- a/crates/camera/Cargo.toml +++ b/crates/camera/Cargo.toml @@ -21,5 +21,4 @@ de_terrain.workspace = true # Other bevy.workspace = true -iyes_loopless.workspace = true parry3d.workspace = true diff --git a/crates/camera/src/camera.rs b/crates/camera/src/camera.rs index aafcd1b75..c4ff6de3d 100644 --- a/crates/camera/src/camera.rs +++ b/crates/camera/src/camera.rs @@ -3,13 +3,12 @@ use std::f32::consts::FRAC_PI_2; use bevy::prelude::*; use de_conf::{CameraConf, Configuration}; use de_core::{ - cleanup::DespawnOnGameExit, events::ResendEventPlugin, gamestate::GameState, - projection::ToAltitude, stages::GameStage, state::AppState, + baseset::GameSet, cleanup::DespawnOnGameExit, events::ResendEventPlugin, gamestate::GameState, + projection::ToAltitude, state::AppState, }; use de_map::size::MapBounds; use de_terrain::{TerrainCollider, MAX_ELEVATION}; use de_uom::{InverseSecond, Metre, Quantity, Radian, Second}; -use iyes_loopless::prelude::*; use parry3d::{math::Vector, query::Ray}; /// Camera moves horizontally at speed `distance * CAMERA_HORIZONTAL_SPEED`. @@ -46,84 +45,84 @@ impl Plugin for CameraPlugin { .add_plugin(ResendEventPlugin::::default()) .add_event::() .add_event::() - .add_enter_system(AppState::InGame, setup) - .add_exit_system(AppState::InGame, cleanup) - .add_system_to_stage( - GameStage::PreMovement, + .add_system(setup.in_schedule(OnEnter(AppState::InGame))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) + .add_system( update_focus - .run_in_state(GameState::Playing) - .label(InternalCameraLabel::UpdateFocus), + .in_base_set(GameSet::PreMovement) + .run_if(in_state(GameState::Playing)) + .in_set(InternalCameraSet::UpdateFocus), ) - .add_system_to_stage( - GameStage::Input, + .add_system( handle_horizontal_events - .run_in_state(GameState::Playing) - .label(CameraLabel::MoveHorizontallEvent), + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(CameraSet::MoveHorizontallEvent), ) - .add_system_to_stage( - GameStage::Input, + .add_system( handle_zoom_events - .run_in_state(GameState::Playing) - .label(CameraLabel::ZoomEvent), + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(CameraSet::ZoomEvent), ) - .add_system_to_stage( - GameStage::Input, + .add_system( handle_rotate_events - .run_in_state(GameState::Playing) - .label(CameraLabel::RotateEvent), + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(CameraSet::RotateEvent), ) - .add_system_to_stage( - GameStage::Input, + .add_system( handle_tilt_events - .run_in_state(GameState::Playing) - .label(CameraLabel::TiltEvent), + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(CameraSet::TiltEvent), ) - .add_system_to_stage( - GameStage::PreMovement, + .add_system( process_move_focus_events - .run_in_state(GameState::Playing) - .label(InternalCameraLabel::MoveFocus) - .after(InternalCameraLabel::UpdateFocus), + .in_base_set(GameSet::PreMovement) + .run_if(in_state(GameState::Playing)) + .in_set(InternalCameraSet::MoveFocus) + .after(InternalCameraSet::UpdateFocus), ) - .add_system_to_stage( - GameStage::PreMovement, + .add_system( update_translation_handler - .run_in_state(GameState::Playing) - .after(InternalCameraLabel::MoveFocus), + .in_base_set(GameSet::PreMovement) + .run_if(in_state(GameState::Playing)) + .after(InternalCameraSet::MoveFocus), ) - .add_system_to_stage( - GameStage::Movement, - zoom.run_in_state(GameState::Playing) - .label(InternalCameraLabel::Zoom), + .add_system( + zoom.in_base_set(GameSet::Movement) + .run_if(in_state(GameState::Playing)) + .in_set(InternalCameraSet::Zoom), ) - .add_system_to_stage( - GameStage::Movement, + .add_system( pivot - .run_in_state(GameState::Playing) - .label(InternalCameraLabel::Pivot), + .in_base_set(GameSet::Movement) + .run_if(in_state(GameState::Playing)) + .in_set(InternalCameraSet::Pivot), ) - .add_system_to_stage( - GameStage::Movement, + .add_system( move_horizontaly - .run_in_state(GameState::Playing) + .in_base_set(GameSet::Movement) + .run_if(in_state(GameState::Playing)) // Zooming changes camera focus point so do it // after other types of camera movement. - .after(InternalCameraLabel::Zoom) - .after(InternalCameraLabel::Pivot), + .after(InternalCameraSet::Zoom) + .after(InternalCameraSet::Pivot), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub enum CameraLabel { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub enum CameraSet { MoveHorizontallEvent, RotateEvent, TiltEvent, ZoomEvent, } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -enum InternalCameraLabel { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +enum InternalCameraSet { UpdateFocus, Zoom, Pivot, diff --git a/crates/camera/src/distance.rs b/crates/camera/src/distance.rs index 5e754119c..edd261356 100644 --- a/crates/camera/src/distance.rs +++ b/crates/camera/src/distance.rs @@ -1,31 +1,35 @@ use bevy::prelude::*; use de_core::{ + baseset::GameSet, objects::{MovableSolid, StaticSolid}, - stages::GameStage, state::AppState, }; -use iyes_loopless::prelude::*; pub(crate) struct DistancePlugin; impl Plugin for DistancePlugin { fn build(&self, app: &mut App) { - app.add_system_set_to_stage( - GameStage::PostUpdate, - SystemSet::new() - .with_system(init::.run_in_state(AppState::InGame)) - .with_system(init::.run_in_state(AppState::InGame)) - .with_system( - update - .run_in_state(AppState::InGame) - .label(DistanceLabels::Update), - ), + app.add_system( + init:: + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(AppState::InGame)), + ) + .add_system( + init:: + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(AppState::InGame)), + ) + .add_system( + update + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(AppState::InGame)) + .in_set(DistanceSet::Update), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub enum DistanceLabels { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub enum DistanceSet { Update, } diff --git a/crates/camera/src/lib.rs b/crates/camera/src/lib.rs index 69219cd31..14b35cc97 100644 --- a/crates/camera/src/lib.rs +++ b/crates/camera/src/lib.rs @@ -1,11 +1,11 @@ use bevy::{app::PluginGroupBuilder, prelude::*}; use camera::CameraPlugin; pub use camera::{ - CameraLabel, MoveCameraHorizontallyEvent, MoveFocusEvent, RotateCameraEvent, TiltCameraEvent, + CameraSet, MoveCameraHorizontallyEvent, MoveFocusEvent, RotateCameraEvent, TiltCameraEvent, ZoomCameraEvent, }; use distance::DistancePlugin; -pub use distance::{CameraDistance, DistanceLabels}; +pub use distance::{CameraDistance, DistanceSet}; mod camera; mod distance; diff --git a/crates/combat/Cargo.toml b/crates/combat/Cargo.toml index 97dfd7f83..4115a9954 100644 --- a/crates/combat/Cargo.toml +++ b/crates/combat/Cargo.toml @@ -23,6 +23,5 @@ de_signs.workspace = true # Other bevy.workspace = true -iyes_loopless.workspace = true glam.workspace = true parry3d.workspace = true diff --git a/crates/combat/src/attack.rs b/crates/combat/src/attack.rs index bc1a62a2b..14333acac 100644 --- a/crates/combat/src/attack.rs +++ b/crates/combat/src/attack.rs @@ -1,14 +1,13 @@ use std::{cmp::Ordering, collections::BinaryHeap}; use bevy::prelude::*; -use de_behaviour::{ChaseLabel, ChaseTarget, ChaseTargetComponent, ChaseTargetEvent}; -use de_core::{gamestate::GameState, objects::ObjectType, stages::GameStage}; +use de_behaviour::{ChaseSet, ChaseTarget, ChaseTargetComponent, ChaseTargetEvent}; +use de_core::{baseset::GameSet, gamestate::GameState, objects::ObjectType}; use de_objects::{ColliderCache, LaserCannon, ObjectCache}; -use iyes_loopless::prelude::*; use parry3d::query::Ray; use crate::laser::LaserFireEvent; -use crate::{sightline::LineOfSight, AttackingLabels}; +use crate::{sightline::LineOfSight, AttackingSet}; /// Multiple of cannon range. The attacking entities will try to stay as close /// or further from attacked targets. @@ -22,26 +21,24 @@ pub(crate) struct AttackPlugin; impl Plugin for AttackPlugin { fn build(&self, app: &mut App) { app.add_event::() - .add_system_to_stage( - GameStage::PreUpdate, + .add_system( attack - .run_in_state(GameState::Playing) - .before(ChaseLabel::ChaseTargetEvent), + .in_base_set(GameSet::PreUpdate) + .run_if(in_state(GameState::Playing)) + .before(ChaseSet::ChaseTargetEvent), ) - .add_system_set_to_stage( - GameStage::Update, - SystemSet::new() - .with_system( - update - .run_in_state(GameState::Playing) - .label(AttackingLabels::Update), - ) - .with_system( - aim_and_fire - .run_in_state(GameState::Playing) - .after(AttackingLabels::Update) - .before(AttackingLabels::Fire), - ), + .add_system( + update + .in_base_set(GameSet::Update) + .run_if(in_state(GameState::Playing)) + .in_set(AttackingSet::Update), + ) + .add_system( + aim_and_fire + .in_base_set(GameSet::Update) + .run_if(in_state(GameState::Playing)) + .after(AttackingSet::Update) + .before(AttackingSet::Fire), ); } } diff --git a/crates/combat/src/laser.rs b/crates/combat/src/laser.rs index 1f6a6f196..44949d007 100644 --- a/crates/combat/src/laser.rs +++ b/crates/combat/src/laser.rs @@ -1,22 +1,21 @@ use bevy::prelude::*; -use de_core::{gamestate::GameState, stages::GameStage}; +use de_core::{baseset::GameSet, gamestate::GameState}; use de_objects::Health; use de_signs::UpdateBarValueEvent; -use de_spawner::SpawnerLabels; -use iyes_loopless::prelude::*; +use de_spawner::SpawnerSet; use parry3d::query::Ray; -use crate::{sightline::LineOfSight, trail::TrailEvent, AttackingLabels}; +use crate::{sightline::LineOfSight, trail::TrailEvent, AttackingSet}; pub(crate) struct LaserPlugin; impl Plugin for LaserPlugin { fn build(&self, app: &mut App) { - app.add_event::().add_system_to_stage( - GameStage::Update, - fire.run_in_state(GameState::Playing) - .label(AttackingLabels::Fire) - .before(SpawnerLabels::Destroyer), + app.add_event::().add_system( + fire.in_base_set(GameSet::Update) + .run_if(in_state(GameState::Playing)) + .in_set(AttackingSet::Fire) + .before(SpawnerSet::Destroyer), ); } } diff --git a/crates/combat/src/lib.rs b/crates/combat/src/lib.rs index b430cae59..41f88c9e2 100644 --- a/crates/combat/src/lib.rs +++ b/crates/combat/src/lib.rs @@ -2,7 +2,7 @@ pub use attack::AttackEvent; use attack::AttackPlugin; use bevy::{ app::PluginGroupBuilder, - prelude::{PluginGroup, SystemLabel}, + prelude::{PluginGroup, SystemSet}, }; use laser::LaserPlugin; use trail::TrailPlugin; @@ -23,8 +23,8 @@ impl PluginGroup for CombatPluginGroup { } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -enum AttackingLabels { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +enum AttackingSet { Update, Fire, } diff --git a/crates/combat/src/trail.rs b/crates/combat/src/trail.rs index a5aad5086..6df36f0bf 100644 --- a/crates/combat/src/trail.rs +++ b/crates/combat/src/trail.rs @@ -12,9 +12,8 @@ use bevy::{ }, }; use de_core::{ - cleanup::DespawnOnGameExit, gamestate::GameState, stages::GameStage, state::AppState, + baseset::GameSet, cleanup::DespawnOnGameExit, gamestate::GameState, state::AppState, }; -use iyes_loopless::prelude::*; use parry3d::query::Ray; const TRAIL_LIFESPAN: Duration = Duration::from_millis(500); @@ -26,13 +25,17 @@ impl Plugin for TrailPlugin { fn build(&self, app: &mut App) { app.add_plugin(MaterialPlugin::::default()) .add_event::() - .add_enter_system(AppState::InGame, setup) - .add_exit_system(AppState::InGame, cleanup) - .add_system_set_to_stage( - GameStage::PostUpdate, - SystemSet::new() - .with_system(spawn.run_in_state(GameState::Playing)) - .with_system(update.run_in_state(GameState::Playing)), + .add_system(setup.in_schedule(OnEnter(AppState::InGame))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) + .add_system( + spawn + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(GameState::Playing)), + ) + .add_system( + update + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(GameState::Playing)), ); } } diff --git a/crates/conf/Cargo.toml b/crates/conf/Cargo.toml index 2e8b29e11..13c6542ae 100644 --- a/crates/conf/Cargo.toml +++ b/crates/conf/Cargo.toml @@ -23,7 +23,6 @@ async-std.workspace = true bevy.workspace = true dirs.workspace = true futures-lite.workspace = true -iyes_loopless.workspace = true iyes_progress.workspace = true serde.workspace = true serde_yaml.workspace = true diff --git a/crates/conf/src/plugin.rs b/crates/conf/src/plugin.rs index c98636ccc..e43d478f6 100644 --- a/crates/conf/src/plugin.rs +++ b/crates/conf/src/plugin.rs @@ -7,7 +7,6 @@ use bevy::{ use de_core::{log_full_error, state::AppState}; use de_gui::ToastEvent; use futures_lite::future; -use iyes_loopless::prelude::*; use iyes_progress::prelude::*; use crate::{io::load_conf, Configuration}; @@ -16,12 +15,12 @@ pub(super) struct ConfPlugin; impl Plugin for ConfPlugin { fn build(&self, app: &mut App) { - app.add_enter_system(AppState::AppLoading, start_loading) - .add_exit_system(AppState::AppLoading, cleanup) + app.add_system(start_loading.in_schedule(OnEnter(AppState::AppLoading))) + .add_system(cleanup.in_schedule(OnExit(AppState::AppLoading))) .add_system( poll_conf .track_progress() - .run_in_state(AppState::AppLoading), + .run_if(in_state(AppState::AppLoading)), ); } } @@ -65,11 +64,11 @@ fn poll_conf( commands.insert_resource(configuration); true.into() } - Err(error) => { + Err(err) => { toasts.send(ToastEvent::new(format!( - "Configuration loading failed: {error}" + "Configuration loading failed: {err}" ))); - let error: &dyn Error = error.as_ref(); + let error: &dyn Error = err.as_ref(); log_full_error!(error); commands.init_resource::(); diff --git a/crates/controller/Cargo.toml b/crates/controller/Cargo.toml index 360ece6f1..abd143ee2 100644 --- a/crates/controller/Cargo.toml +++ b/crates/controller/Cargo.toml @@ -32,6 +32,5 @@ ahash.workspace = true bevy.workspace = true enum-map.workspace = true glam.workspace = true -iyes_loopless.workspace = true parry2d.workspace = true parry3d.workspace = true diff --git a/crates/controller/src/commands/executor.rs b/crates/controller/src/commands/executor.rs index 68450f436..b820e7bd9 100644 --- a/crates/controller/src/commands/executor.rs +++ b/crates/controller/src/commands/executor.rs @@ -1,10 +1,9 @@ use bevy::prelude::*; use de_behaviour::ChaseTargetEvent; use de_combat::AttackEvent; -use de_core::{gamestate::GameState, objects::MovableSolid, stages::GameStage}; +use de_core::{baseset::GameSet, gamestate::GameState, objects::MovableSolid}; use de_pathing::{PathQueryProps, PathTarget, UpdateEntityPath}; use glam::Vec2; -use iyes_loopless::prelude::*; use crate::selection::Selected; @@ -14,25 +13,23 @@ impl Plugin for ExecutorPlugin { fn build(&self, app: &mut App) { app.add_event::() .add_event::() - .add_system_set_to_stage( - GameStage::Input, - SystemSet::new() - .with_system( - send_selected_system - .run_in_state(GameState::Playing) - .label(CommandsLabel::SendSelected), - ) - .with_system( - attack_system - .run_in_state(GameState::Playing) - .label(CommandsLabel::Attack), - ), + .add_system( + send_selected_system + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(CommandsSet::SendSelected), + ) + .add_system( + attack_system + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(CommandsSet::Attack), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub(crate) enum CommandsLabel { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub(crate) enum CommandsSet { SendSelected, Attack, } diff --git a/crates/controller/src/commands/handlers.rs b/crates/controller/src/commands/handlers.rs index 8aaa9af36..951450cc6 100644 --- a/crates/controller/src/commands/handlers.rs +++ b/crates/controller/src/commands/handlers.rs @@ -8,34 +8,34 @@ use bevy::{ ButtonState, }, prelude::*, + window::PrimaryWindow, }; use de_camera::{ - CameraLabel, MoveCameraHorizontallyEvent, RotateCameraEvent, TiltCameraEvent, ZoomCameraEvent, + CameraSet, MoveCameraHorizontallyEvent, RotateCameraEvent, TiltCameraEvent, ZoomCameraEvent, }; use de_conf::Configuration; use de_core::{ + baseset::GameSet, gamestate::GameState, gconfig::GameConfig, objects::{BuildingType, ObjectType, Playable, PLAYER_MAX_BUILDINGS}, player::Player, projection::ToFlat, screengeom::ScreenRect, - stages::GameStage, }; use de_spawner::{Draft, ObjectCounter}; use enum_map::enum_map; -use iyes_loopless::prelude::*; -use super::{keyboard::KeyCondition, CommandsLabel, GroupAttackEvent, SendSelectedEvent}; +use super::{keyboard::KeyCondition, CommandsSet, GroupAttackEvent, SendSelectedEvent}; use crate::{ - draft::{DiscardDraftsEvent, DraftLabels, NewDraftEvent, SpawnDraftsEvent}, - hud::{GameMenuLabel, ToggleGameMenu, UpdateSelectionBoxEvent}, + draft::{DiscardDraftsEvent, DraftSet, NewDraftEvent, SpawnDraftsEvent}, + hud::{GameMenuSet, ToggleGameMenu, UpdateSelectionBoxEvent}, mouse::{ - DragUpdateType, MouseClicked, MouseDoubleClicked, MouseDragged, MouseLabels, Pointer, - PointerLabels, + DragUpdateType, MouseClicked, MouseDoubleClicked, MouseDragged, MouseSet, Pointer, + PointerSet, }, selection::{ - AreaSelectLabels, SelectEvent, SelectInRectEvent, Selected, SelectionLabels, SelectionMode, + AreaSelectSet, SelectEvent, SelectInRectEvent, Selected, SelectionMode, SelectionSet, }, }; @@ -46,117 +46,125 @@ const MOVE_MARGIN: f32 = 2.; pub(super) struct HandlersPlugin; impl HandlersPlugin { - fn place_draft_systems() -> SystemSet { + fn add_place_draft_systems(app: &mut App) { let key_map = enum_map! { BuildingType::Base => KeyCode::B, BuildingType::PowerHub => KeyCode::P, }; - key_map - .iter() - .fold(SystemSet::new(), |systems, (building_type, &key)| { - systems.with_system( - place_draft(building_type) - .run_in_state(GameState::Playing) - .run_if(KeyCondition::single(key).build()) - .before(DraftLabels::New) - .after(PointerLabels::Update), - ) - }) + + for (building_type, &key) in key_map.iter() { + app.add_system( + place_draft(building_type) + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .run_if(KeyCondition::single(key).build()) + .before(DraftSet::New) + .after(PointerSet::Update), + ); + } } } impl Plugin for HandlersPlugin { fn build(&self, app: &mut App) { - app.add_system_set_to_stage( - GameStage::Input, - SystemSet::new() - .with_system( - right_click_handler - .run_in_state(GameState::Playing) - .run_if(on_click(MouseButton::Right)) - .after(PointerLabels::Update) - .after(MouseLabels::Buttons) - .before(CommandsLabel::SendSelected) - .before(CommandsLabel::Attack), - ) - .with_system( - left_click_handler - .run_in_state(GameState::Playing) - .run_if(on_click(MouseButton::Left)) - .label(HandlersLabel::LeftClick) - .before(SelectionLabels::Update) - .before(DraftLabels::Spawn) - .after(PointerLabels::Update) - .after(MouseLabels::Buttons), - ) - .with_system( - double_click_handler - .run_in_state(GameState::Playing) - .run_if(on_double_click(MouseButton::Left)) - .before(SelectionLabels::Update) - .before(DraftLabels::Spawn) - .after(PointerLabels::Update) - .after(MouseLabels::Buttons) - .after(HandlersLabel::LeftClick), - ) - .with_system( - move_camera_arrows_system - .run_in_state(GameState::Playing) - .before(CameraLabel::MoveHorizontallEvent), - ) - .with_system( - move_camera_mouse_system - .run_in_state(GameState::Playing) - .before(CameraLabel::MoveHorizontallEvent), - ) - .with_system( - zoom_camera - .run_in_state(GameState::Playing) - .before(CameraLabel::ZoomEvent), - ) - .with_system( - pivot_camera - .run_in_state(GameState::Playing) - .before(CameraLabel::RotateEvent) - .before(CameraLabel::TiltEvent), - ) - .with_system( - handle_escape - .run_in_state(GameState::Playing) - .run_if(KeyCondition::single(KeyCode::Escape).build()) - .before(GameMenuLabel::Toggle) - .before(DraftLabels::Discard), - ) - .with_system( - select_all - .run_in_state(GameState::Playing) - .run_if(KeyCondition::single(KeyCode::A).with_ctrl().build()) - .before(SelectionLabels::Update), - ) - .with_system( - select_all_visible - .run_in_state(GameState::Playing) - .run_if( - KeyCondition::single(KeyCode::A) - .with_ctrl() - .with_shift() - .build(), - ) - .before(AreaSelectLabels::SelectInArea), + app.add_system( + right_click_handler + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .run_if(on_click(MouseButton::Right)) + .after(PointerSet::Update) + .after(MouseSet::Buttons) + .before(CommandsSet::SendSelected) + .before(CommandsSet::Attack), + ) + .add_system( + left_click_handler + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .run_if(on_click(MouseButton::Left)) + .in_set(HandlersSet::LeftClick) + .before(SelectionSet::Update) + .before(DraftSet::Spawn) + .after(PointerSet::Update) + .after(MouseSet::Buttons), + ) + .add_system( + double_click_handler + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .run_if(on_double_click(MouseButton::Left)) + .before(SelectionSet::Update) + .before(DraftSet::Spawn) + .after(PointerSet::Update) + .after(MouseSet::Buttons) + .after(HandlersSet::LeftClick), + ) + .add_system( + move_camera_arrows_system + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .before(CameraSet::MoveHorizontallEvent), + ) + .add_system( + move_camera_mouse_system + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .before(CameraSet::MoveHorizontallEvent), + ) + .add_system( + zoom_camera + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .before(CameraSet::ZoomEvent), + ) + .add_system( + pivot_camera + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .before(CameraSet::RotateEvent) + .before(CameraSet::TiltEvent), + ) + .add_system( + handle_escape + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .run_if(KeyCondition::single(KeyCode::Escape).build()) + .before(GameMenuSet::Toggle) + .before(DraftSet::Discard), + ) + .add_system( + select_all + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .run_if(KeyCondition::single(KeyCode::A).with_ctrl().build()) + .before(SelectionSet::Update), + ) + .add_system( + select_all_visible + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .run_if( + KeyCondition::single(KeyCode::A) + .with_ctrl() + .with_shift() + .build(), ) - .with_system( - update_drags - .run_in_state(GameState::Playing) - .before(AreaSelectLabels::SelectInArea) - .after(MouseLabels::Buttons), - ), + .before(AreaSelectSet::SelectInArea), ) - .add_system_set_to_stage(GameStage::Input, Self::place_draft_systems()); + .add_system( + update_drags + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .before(AreaSelectSet::SelectInArea) + .after(MouseSet::Buttons), + ); + + Self::add_place_draft_systems(app); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub(crate) enum HandlersLabel { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub(crate) enum HandlersSet { LeftClick, } @@ -255,11 +263,11 @@ fn move_camera_arrows_system( } fn move_camera_mouse_system( - windows: Res, + window_query: Query<&Window, With>, mut was_moving: Local, mut move_events: EventWriter, ) { - let window = windows.get_primary().unwrap(); + let window = window_query.single(); let Some(cursor) = window.cursor_position() else { if *was_moving { *was_moving = false; diff --git a/crates/controller/src/commands/mod.rs b/crates/controller/src/commands/mod.rs index b0c543ce9..252163d44 100644 --- a/crates/controller/src/commands/mod.rs +++ b/crates/controller/src/commands/mod.rs @@ -2,7 +2,7 @@ //! actions. use bevy::prelude::*; -pub(crate) use executor::{CommandsLabel, GroupAttackEvent, SendSelectedEvent}; +pub(crate) use executor::{CommandsSet, GroupAttackEvent, SendSelectedEvent}; use self::{executor::ExecutorPlugin, handlers::HandlersPlugin}; diff --git a/crates/controller/src/draft.rs b/crates/controller/src/draft.rs index 64e321328..6c19250df 100644 --- a/crates/controller/src/draft.rs +++ b/crates/controller/src/draft.rs @@ -1,16 +1,15 @@ use bevy::prelude::*; use de_core::{ + baseset::GameSet, cleanup::DespawnOnGameExit, gamestate::GameState, gconfig::GameConfig, objects::{BuildingType, ObjectType}, - stages::GameStage, state::AppState, }; use de_spawner::{Draft, DraftBundle, SpawnBundle}; -use iyes_loopless::prelude::*; -use crate::mouse::{Pointer, PointerLabels}; +use crate::mouse::{Pointer, PointerSet}; pub(crate) struct DraftPlugin; @@ -19,35 +18,35 @@ impl Plugin for DraftPlugin { app.add_event::() .add_event::() .add_event::() - .add_system_set_to_stage( - GameStage::Input, - SystemSet::new() - .with_system( - spawn - .run_in_state(AppState::InGame) - .label(DraftLabels::Spawn), - ) - .with_system( - new_drafts - .run_in_state(AppState::InGame) - .label(DraftLabels::New), - ) - .with_system( - discard_drafts - .run_in_state(AppState::InGame) - .label(DraftLabels::Discard), - ) - .with_system( - move_drafts - .run_in_state(GameState::Playing) - .after(PointerLabels::Update), - ), + .add_system( + spawn + .in_base_set(GameSet::Input) + .run_if(in_state(AppState::InGame)) + .in_set(DraftSet::Spawn), + ) + .add_system( + new_drafts + .in_base_set(GameSet::Input) + .run_if(in_state(AppState::InGame)) + .in_set(DraftSet::New), + ) + .add_system( + discard_drafts + .in_base_set(GameSet::Input) + .run_if(in_state(AppState::InGame)) + .in_set(DraftSet::Discard), + ) + .add_system( + move_drafts + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .after(PointerSet::Update), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub(crate) enum DraftLabels { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub(crate) enum DraftSet { Spawn, New, Discard, diff --git a/crates/controller/src/hud/interaction.rs b/crates/controller/src/hud/interaction.rs index 4e650d8a0..e6f47ee0e 100644 --- a/crates/controller/src/hud/interaction.rs +++ b/crates/controller/src/hud/interaction.rs @@ -1,6 +1,7 @@ use bevy::{ ecs::{query::ReadOnlyWorldQuery, system::SystemParam}, prelude::*, + window::PrimaryWindow, }; use glam::Vec3Swizzles; @@ -28,7 +29,7 @@ where ), F, >, - windows: Res<'w, Windows>, + window_query: Query<'w, 's, &'static Window, With>, } impl<'w, 's, F> HudNodes<'w, 's, F> @@ -45,7 +46,7 @@ where /// The returned point is between (0, 0) (top-left corner) and (1, 1) /// (bottom-right corner). pub(crate) fn relative_position(&self, point: Vec2) -> Option { - let window = self.windows.get_primary().unwrap(); + let window = self.window_query.single(); // This is because screen y starts on bottom, GlobalTransform on top. let point = Vec2::new(point.x, window.height() - point.y); diff --git a/crates/controller/src/hud/menu.rs b/crates/controller/src/hud/menu.rs index c23519b33..7379c5a00 100644 --- a/crates/controller/src/hud/menu.rs +++ b/crates/controller/src/hud/menu.rs @@ -1,9 +1,8 @@ use core::fmt; use bevy::prelude::*; -use de_core::{gamestate::GameState, stages::GameStage, state::AppState}; +use de_core::{baseset::GameSet, gamestate::GameState, state::AppState}; use de_gui::{ButtonCommands, GuiCommands, OuterStyle}; -use iyes_loopless::prelude::*; use super::interaction::InteractionBlocker; @@ -12,23 +11,24 @@ pub(crate) struct MenuPlugin; impl Plugin for MenuPlugin { fn build(&self, app: &mut App) { app.add_event::() - .add_enter_system(GameState::Playing, setup) - .add_exit_system(GameState::Playing, cleanup) - .add_system_set_to_stage( - GameStage::Input, - SystemSet::new() - .with_system( - toggle_system - .run_in_state(GameState::Playing) - .label(GameMenuLabel::Toggle), - ) - .with_system(button_system.run_in_state(GameState::Playing)), + .add_system(setup.in_schedule(OnEnter(GameState::Playing))) + .add_system(cleanup.in_schedule(OnExit(GameState::Playing))) + .add_system( + toggle_system + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(GameMenuSet::Toggle), + ) + .add_system( + button_system + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub(crate) enum GameMenuLabel { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub(crate) enum GameMenuSet { Toggle, } @@ -61,7 +61,7 @@ fn setup(mut commands: GuiCommands) { justify_content: JustifyContent::Center, ..default() }, - visibility: Visibility::INVISIBLE, + visibility: Visibility::Hidden, z_index: ZIndex::Local(1000), ..default() }) @@ -119,17 +119,22 @@ fn toggle_system( if events.iter().count() % 2 == 0 { return; } - query.single_mut().toggle(); + + *query.single_mut() = if query.single() == Visibility::Hidden { + Visibility::Inherited + } else { + Visibility::Hidden + }; } fn button_system( - mut commands: Commands, + mut next_state: ResMut>, interactions: Query<(&Interaction, &ButtonAction), Changed>, ) { for (&interaction, &action) in interactions.iter() { if let Interaction::Clicked = interaction { match action { - ButtonAction::Quit => commands.insert_resource(NextState(AppState::InMenu)), + ButtonAction::Quit => next_state.set(AppState::InMenu), } } } diff --git a/crates/controller/src/hud/minimap/draw.rs b/crates/controller/src/hud/minimap/draw.rs index 6c9154e61..3ea34765e 100644 --- a/crates/controller/src/hud/minimap/draw.rs +++ b/crates/controller/src/hud/minimap/draw.rs @@ -13,7 +13,7 @@ pub(super) struct DrawingParam<'w, 's> { impl<'w, 's> DrawingParam<'w, 's> { pub(super) fn drawing(&mut self) -> Drawing { - let image = self.images.get_mut(&self.query.single().0).unwrap(); + let image = self.images.get_mut(&self.query.single().texture).unwrap(); let size = UVec2::new( image.texture_descriptor.size.width, image.texture_descriptor.size.height, diff --git a/crates/controller/src/hud/minimap/fill.rs b/crates/controller/src/hud/minimap/fill.rs index 9244dc99a..66ed5b0dc 100644 --- a/crates/controller/src/hud/minimap/fill.rs +++ b/crates/controller/src/hud/minimap/fill.rs @@ -1,14 +1,11 @@ -use std::marker::PhantomData; - use bevy::{ecs::system::SystemParam, prelude::*}; use de_core::{ - gamestate::GameState, gconfig::GameConfig, objects::ObjectType, player::Player, - projection::ToFlat, stages::GameStage, + baseset::GameSet, gamestate::GameState, gconfig::GameConfig, objects::ObjectType, + player::Player, projection::ToFlat, }; use de_map::size::MapBounds; use de_objects::{IchnographyCache, ObjectCache}; use de_terrain::TerrainCollider; -use iyes_loopless::prelude::*; use parry2d::{ bounding_volume::Aabb, math::Point, @@ -28,43 +25,40 @@ pub(super) struct FillPlugin; impl Plugin for FillPlugin { fn build(&self, app: &mut App) { - app.add_system_set_to_stage( - GameStage::PostMovement, - SystemSet::new() - .with_system( - clear_system - .run_in_state(GameState::Playing) - .label(FillLabel::Clear), - ) - .with_system( - draw_entities_system - .run_in_state(GameState::Playing) - .label(FillLabel::DrawEntities) - .after(FillLabel::Clear), - ) - .with_system( - draw_camera_system - .run_in_state(GameState::Playing) - .after(FillLabel::DrawEntities), - ), + app.add_system( + clear_system + .in_base_set(GameSet::PostMovement) + .run_if(in_state(GameState::Playing)) + .in_set(FillSet::Clear), + ) + .add_system( + draw_entities_system + .in_base_set(GameSet::PostMovement) + .run_if(in_state(GameState::Playing)) + .in_set(FillSet::DrawEntities) + .after(FillSet::Clear), + ) + .add_system( + draw_camera_system + .in_base_set(GameSet::PostMovement) + .run_if(in_state(GameState::Playing)) + .after(FillSet::DrawEntities), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -enum FillLabel { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +enum FillSet { Clear, DrawEntities, } #[derive(SystemParam)] -struct UiCoords<'w, 's> { +struct UiCoords<'w> { bounds: Res<'w, MapBounds>, - #[system_param(ignore)] - marker: PhantomData<&'s ()>, } -impl<'w, 's> UiCoords<'w, 's> { +impl<'w> UiCoords<'w> { /// Transforms 2D flat position (in meters from origin) to relative UI /// position (from 0 to 1 from top-right corner). fn flat_to_rel(&self, point: Vec2) -> Vec2 { @@ -110,7 +104,7 @@ fn draw_entities_system( struct CameraPoint<'w, 's> { ray: ScreenRay<'w, 's>, terrain: TerrainCollider<'w, 's>, - ui_coords: UiCoords<'w, 's>, + ui_coords: UiCoords<'w>, } impl<'w, 's> CameraPoint<'w, 's> { diff --git a/crates/controller/src/hud/minimap/interaction.rs b/crates/controller/src/hud/minimap/interaction.rs index 4210d542b..4fb0632ef 100644 --- a/crates/controller/src/hud/minimap/interaction.rs +++ b/crates/controller/src/hud/minimap/interaction.rs @@ -3,15 +3,15 @@ use std::fmt; use bevy::{ input::{mouse::MouseButtonInput, ButtonState}, prelude::*, + window::PrimaryWindow, }; use de_camera::MoveFocusEvent; -use de_core::{gamestate::GameState, stages::GameStage}; +use de_core::{baseset::GameSet, gamestate::GameState}; use de_map::size::MapBounds; -use iyes_loopless::prelude::*; use super::nodes::MinimapNode; use crate::{ - commands::{CommandsLabel, SendSelectedEvent}, + commands::{CommandsSet, SendSelectedEvent}, hud::HudNodes, }; @@ -20,31 +20,30 @@ pub(super) struct InteractionPlugin; impl Plugin for InteractionPlugin { fn build(&self, app: &mut App) { app.add_event::() - .add_system_set_to_stage( - GameStage::Input, - SystemSet::new() - .with_system( - click_handler - .run_in_state(GameState::Playing) - .label(InteractionLabel::ClickHandler), - ) - .with_system( - move_camera_system - .run_in_state(GameState::Playing) - .after(InteractionLabel::ClickHandler), - ) - .with_system( - send_units_system - .run_in_state(GameState::Playing) - .after(InteractionLabel::ClickHandler) - .before(CommandsLabel::SendSelected), - ), + .add_system( + click_handler + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(InteractionSet::ClickHandler), + ) + .add_system( + move_camera_system + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .after(InteractionSet::ClickHandler), + ) + .add_system( + send_units_system + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .after(InteractionSet::ClickHandler) + .before(CommandsSet::SendSelected), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -enum InteractionLabel { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +enum InteractionSet { ClickHandler, } @@ -76,13 +75,13 @@ impl fmt::Debug for MinimapClickEvent { } fn click_handler( - windows: Res, + window_query: Query<&Window, With>, mut input_events: EventReader, hud: HudNodes>, bounds: Res, mut click_events: EventWriter, ) { - let Some(cursor) = windows.get_primary().unwrap().cursor_position() else { return }; + let Some(cursor) = window_query.single().cursor_position() else { return }; for event in input_events.iter() { if event.state != ButtonState::Released { continue; diff --git a/crates/controller/src/hud/minimap/nodes.rs b/crates/controller/src/hud/minimap/nodes.rs index 2702e74c8..6dec59af4 100644 --- a/crates/controller/src/hud/minimap/nodes.rs +++ b/crates/controller/src/hud/minimap/nodes.rs @@ -1,12 +1,8 @@ use bevy::{ prelude::*, - render::{ - render_resource::{Extent3d, TextureDimension, TextureFormat}, - texture::TextureFormatPixelInfo, - }, + render::render_resource::{Extent3d, TextureDimension, TextureFormat}, }; -use de_core::{cleanup::DespawnOnGameExit, gamestate::GameState, stages::GameStage}; -use iyes_loopless::prelude::*; +use de_core::{baseset::GameSet, cleanup::DespawnOnGameExit, gamestate::GameState}; use crate::hud::{interaction::InteractionBlocker, HUD_COLOR}; @@ -14,10 +10,11 @@ pub(super) struct NodesPlugin; impl Plugin for NodesPlugin { fn build(&self, app: &mut App) { - app.add_enter_system(GameState::Playing, setup) - .add_system_to_stage( - GameStage::PreMovement, - update_resolution.run_in_state(GameState::Playing), + app.add_system(setup.in_schedule(OnEnter(GameState::Playing))) + .add_system( + update_resolution + .in_base_set(GameSet::PreMovement) + .run_if(in_state(GameState::Playing)), ); } } @@ -83,7 +80,7 @@ fn update_resolution( } let image = images.add(new_image(resolution)); - commands.entity(entity).insert(UiImage(image)); + commands.entity(entity).insert(UiImage::new(image)); } /// Creates a new minimap image. @@ -91,7 +88,6 @@ fn new_image(resolution: UVec2) -> Image { info!("Creating new minimap image with resolution {resolution:?}"); let format = TextureFormat::Rgba8UnormSrgb; - assert_eq!(format.pixel_size(), 4); let num_bytes = resolution.x as usize * resolution.y as usize * 4; let data = vec![255; num_bytes]; Image::new( diff --git a/crates/controller/src/hud/mod.rs b/crates/controller/src/hud/mod.rs index 0883cc6ac..2bc350108 100644 --- a/crates/controller/src/hud/mod.rs +++ b/crates/controller/src/hud/mod.rs @@ -7,7 +7,7 @@ mod panel; mod selection; pub(crate) use interaction::HudNodes; -pub(crate) use menu::{GameMenuLabel, ToggleGameMenu}; +pub(crate) use menu::{GameMenuSet, ToggleGameMenu}; pub(crate) use selection::UpdateSelectionBoxEvent; use self::{ diff --git a/crates/controller/src/hud/panel.rs b/crates/controller/src/hud/panel.rs index 2abacf71c..2370d140c 100644 --- a/crates/controller/src/hud/panel.rs +++ b/crates/controller/src/hud/panel.rs @@ -1,6 +1,5 @@ use bevy::prelude::*; use de_core::{cleanup::DespawnOnGameExit, gamestate::GameState}; -use iyes_loopless::prelude::*; use super::{interaction::InteractionBlocker, HUD_COLOR}; @@ -8,8 +7,8 @@ pub(crate) struct PanelPlugin; impl Plugin for PanelPlugin { fn build(&self, app: &mut App) { - app.add_enter_system(GameState::Playing, spawn_details) - .add_enter_system(GameState::Playing, spawn_action_bar); + app.add_system(spawn_details.in_schedule(OnEnter(GameState::Playing))) + .add_system(spawn_action_bar.in_schedule(OnEnter(GameState::Playing))); } } diff --git a/crates/controller/src/hud/selection.rs b/crates/controller/src/hud/selection.rs index 657b55d89..5b306e793 100644 --- a/crates/controller/src/hud/selection.rs +++ b/crates/controller/src/hud/selection.rs @@ -1,8 +1,7 @@ use bevy::prelude::*; use de_core::{ - cleanup::DespawnOnGameExit, gamestate::GameState, screengeom::ScreenRect, stages::GameStage, + baseset::GameSet, cleanup::DespawnOnGameExit, gamestate::GameState, screengeom::ScreenRect, }; -use iyes_loopless::prelude::*; const SELECTION_BOX_COLOR: Color = Color::rgba(0., 0.5, 0.8, 0.2); @@ -10,11 +9,11 @@ pub(crate) struct SelectionPlugin; impl Plugin for SelectionPlugin { fn build(&self, app: &mut App) { - app.add_event::() - .add_system_set_to_stage( - GameStage::PostUpdate, - SystemSet::new().with_system(process_events.run_in_state(GameState::Playing)), - ); + app.add_event::().add_system( + process_events + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(GameState::Playing)), + ); } } diff --git a/crates/controller/src/mouse/input.rs b/crates/controller/src/mouse/input.rs index aa1bc5435..2723efc0e 100644 --- a/crates/controller/src/mouse/input.rs +++ b/crates/controller/src/mouse/input.rs @@ -2,9 +2,9 @@ use ahash::AHashMap; use bevy::{ input::{mouse::MouseButtonInput, ButtonState}, prelude::*, + window::PrimaryWindow, }; -use de_core::{gamestate::GameState, screengeom::ScreenRect, stages::GameStage, state::AppState}; -use iyes_loopless::prelude::*; +use de_core::{baseset::GameSet, gamestate::GameState, screengeom::ScreenRect, state::AppState}; use crate::hud::HudNodes; @@ -18,40 +18,40 @@ impl Plugin for InputPlugin { app.add_event::() .add_event::() .add_event::() - .add_enter_system(AppState::InGame, setup) - .add_exit_system(AppState::InGame, cleanup) - .add_system_set_to_stage( - GameStage::Input, - SystemSet::new() - .with_system( - update_position - .run_in_state(GameState::Playing) - .label(MouseLabels::Position), - ) - .with_system( - update_drags - .run_in_state(GameState::Playing) - .label(MouseLabels::Drags) - .after(MouseLabels::Position), - ) - .with_system( - update_buttons - .run_in_state(GameState::Playing) - .label(MouseLabels::SingeButton) - .after(MouseLabels::Drags), - ) - .with_system( - check_double_click - .run_in_state(GameState::Playing) - .label(MouseLabels::Buttons) - .after(MouseLabels::SingeButton), - ), + .add_system(setup.in_schedule(OnEnter(AppState::InGame))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) + .add_system( + update_position + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(MouseSet::Position), + ) + .add_system( + update_drags + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(MouseSet::Drags) + .after(MouseSet::Position), + ) + .add_system( + update_buttons + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(MouseSet::SingeButton) + .after(MouseSet::Drags), + ) + .add_system( + check_double_click + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(MouseSet::Buttons) + .after(MouseSet::SingeButton), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub(crate) enum MouseLabels { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub(crate) enum MouseSet { Position, Drags, SingeButton, @@ -241,8 +241,12 @@ fn cleanup(mut commands: Commands) { commands.remove_resource::(); } -fn update_position(windows: Res, hud: HudNodes, mut mouse: ResMut) { - let window = windows.get_primary().unwrap(); +fn update_position( + window_query: Query<&Window, With>, + hud: HudNodes, + mut mouse: ResMut, +) { + let window = window_query.single(); let position = window .cursor_position() .filter(|&position| !hud.contains_point(position)) diff --git a/crates/controller/src/mouse/mod.rs b/crates/controller/src/mouse/mod.rs index b89bc350a..6370fd833 100644 --- a/crates/controller/src/mouse/mod.rs +++ b/crates/controller/src/mouse/mod.rs @@ -1,10 +1,10 @@ use bevy::prelude::*; use input::InputPlugin; pub(crate) use input::{ - DragUpdateType, MouseClicked, MouseDoubleClicked, MouseDragged, MouseLabels, MousePosition, + DragUpdateType, MouseClicked, MouseDoubleClicked, MouseDragged, MousePosition, MouseSet, }; use pointer::PointerPlugin; -pub(crate) use pointer::{Pointer, PointerLabels}; +pub(crate) use pointer::{Pointer, PointerSet}; mod input; mod pointer; diff --git a/crates/controller/src/mouse/pointer.rs b/crates/controller/src/mouse/pointer.rs index 11e6695f2..4d04a7472 100644 --- a/crates/controller/src/mouse/pointer.rs +++ b/crates/controller/src/mouse/pointer.rs @@ -1,13 +1,12 @@ use bevy::prelude::*; -use de_core::{gamestate::GameState, stages::GameStage, state::AppState}; +use de_core::{baseset::GameSet, gamestate::GameState, state::AppState}; use de_index::SpatialQuery; use de_signs::UpdateBarVisibilityEvent; use de_terrain::TerrainCollider; use glam::Vec3; -use iyes_loopless::prelude::*; use crate::{ - mouse::{MouseLabels, MousePosition}, + mouse::{MousePosition, MouseSet}, ray::ScreenRay, POINTER_BAR_ID, }; @@ -16,26 +15,26 @@ pub(super) struct PointerPlugin; impl Plugin for PointerPlugin { fn build(&self, app: &mut App) { - app.add_enter_system(AppState::InGame, setup) - .add_exit_system(AppState::InGame, cleanup) - .add_system_to_stage( - GameStage::Input, + app.add_system(setup.in_schedule(OnEnter(AppState::InGame))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) + .add_system( pointer_update_system - .run_in_state(GameState::Playing) - .label(PointerLabels::Update) - .after(MouseLabels::Position), + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(PointerSet::Update) + .after(MouseSet::Position), ) - .add_system_to_stage( - GameStage::Input, + .add_system( update_bar_visibility - .run_in_state(GameState::Playing) - .after(PointerLabels::Update), + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .after(PointerSet::Update), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub(crate) enum PointerLabels { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub(crate) enum PointerSet { Update, } diff --git a/crates/controller/src/selection/area.rs b/crates/controller/src/selection/area.rs index 6b4d27edd..0ac60f19c 100644 --- a/crates/controller/src/selection/area.rs +++ b/crates/controller/src/selection/area.rs @@ -1,38 +1,34 @@ use bevy::prelude::*; use de_core::{ + baseset::GameSet, frustum, gamestate::GameState, objects::{ObjectType, Playable}, screengeom::ScreenRect, - stages::GameStage, }; use de_objects::{ColliderCache, ObjectCache}; -use iyes_loopless::prelude::*; use crate::{ frustum::ScreenFrustum, - selection::{SelectEvent, SelectionLabels, SelectionMode}, + selection::{SelectEvent, SelectionMode, SelectionSet}, }; pub(super) struct AreaPlugin; impl Plugin for AreaPlugin { fn build(&self, app: &mut App) { - app.add_event::() - .add_system_set_to_stage( - GameStage::Input, - SystemSet::new().with_system( - select_in_area - .run_in_state(GameState::Playing) - .label(AreaSelectLabels::SelectInArea) - .before(SelectionLabels::Update), - ), - ); + app.add_event::().add_system( + select_in_area + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(AreaSelectSet::SelectInArea) + .before(SelectionSet::Update), + ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub(crate) enum AreaSelectLabels { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub(crate) enum AreaSelectSet { SelectInArea, } diff --git a/crates/controller/src/selection/bookkeeping.rs b/crates/controller/src/selection/bookkeeping.rs index 52467ce11..28a8b94c4 100644 --- a/crates/controller/src/selection/bookkeeping.rs +++ b/crates/controller/src/selection/bookkeeping.rs @@ -1,9 +1,8 @@ use ahash::AHashSet; use bevy::{ecs::system::SystemParam, prelude::*}; -use de_core::{gamestate::GameState, stages::GameStage}; +use de_core::{baseset::GameSet, gamestate::GameState}; use de_signs::UpdateBarVisibilityEvent; use de_terrain::CircleMarker; -use iyes_loopless::prelude::*; use crate::SELECTION_BAR_ID; @@ -11,17 +10,17 @@ pub(super) struct BookkeepingPlugin; impl Plugin for BookkeepingPlugin { fn build(&self, app: &mut App) { - app.add_event::().add_system_to_stage( - GameStage::Input, + app.add_event::().add_system( update_selection - .run_in_state(GameState::Playing) - .label(SelectionLabels::Update), + .in_base_set(GameSet::Input) + .run_if(in_state(GameState::Playing)) + .in_set(SelectionSet::Update), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub(crate) enum SelectionLabels { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub(crate) enum SelectionSet { Update, } @@ -77,7 +76,7 @@ struct SelectorBuilder<'w, 's> { commands: Commands<'w, 's>, selected: Query<'w, 's, Entity, With>, markers: Query<'w, 's, &'static mut CircleMarker>, - bars: EventWriter<'w, 's, UpdateBarVisibilityEvent>, + bars: EventWriter<'w, UpdateBarVisibilityEvent>, } impl<'w, 's> SelectorBuilder<'w, 's> { @@ -97,7 +96,7 @@ impl<'w, 's> SelectorBuilder<'w, 's> { struct Selector<'w, 's> { commands: Commands<'w, 's>, markers: Query<'w, 's, &'static mut CircleMarker>, - bars: EventWriter<'w, 's, UpdateBarVisibilityEvent>, + bars: EventWriter<'w, UpdateBarVisibilityEvent>, selected: AHashSet, to_select: AHashSet, to_deselect: AHashSet, diff --git a/crates/controller/src/selection/mod.rs b/crates/controller/src/selection/mod.rs index 5c3a5a9d5..a7cd98dfd 100644 --- a/crates/controller/src/selection/mod.rs +++ b/crates/controller/src/selection/mod.rs @@ -1,8 +1,8 @@ use area::AreaPlugin; -pub(crate) use area::{AreaSelectLabels, SelectInRectEvent}; +pub(crate) use area::{AreaSelectSet, SelectInRectEvent}; use bevy::prelude::*; use bookkeeping::BookkeepingPlugin; -pub(crate) use bookkeeping::{SelectEvent, Selected, SelectionLabels, SelectionMode}; +pub(crate) use bookkeeping::{SelectEvent, Selected, SelectionMode, SelectionSet}; mod area; mod bookkeeping; diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 97970a2cb..4305a4e41 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -14,7 +14,6 @@ categories.workspace = true [dependencies] serde.workspace = true bevy.workspace = true -iyes_loopless.workspace = true iyes_progress.workspace = true glam.workspace = true nalgebra.workspace = true diff --git a/crates/core/src/baseset.rs b/crates/core/src/baseset.rs new file mode 100644 index 000000000..d2d9d83b9 --- /dev/null +++ b/crates/core/src/baseset.rs @@ -0,0 +1,88 @@ +use bevy::prelude::*; + +pub struct GameSetsPlugin; + +impl Plugin for GameSetsPlugin { + fn build(&self, app: &mut App) { + app.edit_schedule(CoreSchedule::Main, |schedule| { + schedule.configure_sets( + ( + GameSet::Input, + GameSet::InputFlush, + GameSet::PreMovement, + GameSet::PreMovementFlush, + GameSet::Movement, + GameSet::MovementFlush, + GameSet::PostMovement, + GameSet::PostMovementFlush, + GameSet::PreUpdate, + GameSet::PreUpdateFlush, + GameSet::Update, + GameSet::UpdateFlush, + GameSet::PostUpdate, + GameSet::PostUpdateFlush, + ) + .chain(), + ); + + schedule.configure_sets((CoreSet::StateTransitions, GameSet::Input).chain()); + schedule.configure_sets( + ( + GameSet::InputFlush, + CoreSet::FixedUpdate, + GameSet::PreMovement, + ) + .chain(), + ); + schedule.configure_sets((GameSet::PostUpdateFlush, CoreSet::Update).chain()); + + schedule.add_system(apply_system_buffers.in_base_set(GameSet::InputFlush)); + schedule.add_system(apply_system_buffers.in_base_set(GameSet::PreMovementFlush)); + schedule.add_system(apply_system_buffers.in_base_set(GameSet::MovementFlush)); + schedule.add_system(apply_system_buffers.in_base_set(GameSet::PostMovementFlush)); + schedule.add_system(apply_system_buffers.in_base_set(GameSet::PreUpdateFlush)); + schedule.add_system(apply_system_buffers.in_base_set(GameSet::UpdateFlush)); + schedule.add_system(apply_system_buffers.in_base_set(GameSet::PostUpdateFlush)); + }); + } +} + +#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)] +#[system_set(base)] +pub enum GameSet { + /// All user input is handled during this stage. + Input, + InputFlush, + /// The game state is prepared for movement stage during this stage. The + /// preparation includes, among other things, global path finding & + /// planning related updates. + PreMovement, + PreMovementFlush, + /// All of "game active" entity movement (changes to [`bevy::prelude::Transform`]) + /// happens during this stage (an in no other stage). + /// + /// "Game active" entities are those which impact the game dynamics. For + /// example buildings, units or the terrain. Auxiliary entities, for + /// example building drafts, might be moved during other stages. + Movement, + MovementFlush, + /// This stage includes for example update to spatial index of movable + /// objects. + PostMovement, + PostMovementFlush, + /// This stage includes all necessary preparation for the game update, e.g. + /// insertion of components which need to be present during game update. + PreUpdate, + PreUpdateFlush, + /// Most of the (movement unrelated) game logic happens during this stage. + /// For example unit AI, attacking, object health updates and so on. + /// + /// This is the only stage during which "game active" entities are + /// (de)spawned. + Update, + UpdateFlush, + /// For example this stage includes update to spatial index necessary due + /// to (de)spawning of objects to the game. + PostUpdate, + PostUpdateFlush, +} diff --git a/crates/core/src/cleanup.rs b/crates/core/src/cleanup.rs index 17e115e64..dc83e1ca2 100644 --- a/crates/core/src/cleanup.rs +++ b/crates/core/src/cleanup.rs @@ -1,5 +1,4 @@ use bevy::prelude::*; -use iyes_loopless::prelude::*; use crate::state::AppState; @@ -7,7 +6,7 @@ pub(crate) struct CleanupPlugin; impl Plugin for CleanupPlugin { fn build(&self, app: &mut App) { - app.add_exit_system(AppState::InGame, cleanup); + app.add_system(cleanup.in_schedule(OnExit(AppState::InGame))); } } diff --git a/crates/core/src/events.rs b/crates/core/src/events.rs index e1e8ef69e..ae7dc7ad9 100644 --- a/crates/core/src/events.rs +++ b/crates/core/src/events.rs @@ -7,7 +7,6 @@ use bevy::{ }, prelude::*, }; -use iyes_loopless::prelude::*; use crate::gamestate::GameState; @@ -25,10 +24,10 @@ impl Default for ResendEventPlugin { impl Plugin for ResendEventPlugin { fn build(&self, app: &mut App) { - app.add_enter_system(GameState::Loading, setup::) - .add_system(enqueue_events::.run_in_state(GameState::Loading)) - .add_enter_system(GameState::Playing, resend_events::) - .add_enter_system(GameState::Playing, cleanup::); + app.add_system(setup::.in_schedule(OnEnter(GameState::Loading))) + .add_system(enqueue_events::.run_if(in_state(GameState::Loading))) + .add_system(resend_events::.in_schedule(OnEnter(GameState::Playing))) + .add_system(cleanup::.in_schedule(OnEnter(GameState::Playing))); } } diff --git a/crates/core/src/frustum.rs b/crates/core/src/frustum.rs index 7142bcfb3..0aa836431 100644 --- a/crates/core/src/frustum.rs +++ b/crates/core/src/frustum.rs @@ -29,5 +29,6 @@ pub fn intersects_bevy(frustum: &Frustum, transform: &GlobalTransform, aabb: &Aa radius: transform.radius_vec3a(aabb.half_extents), }; - frustum.intersects_sphere(&model_sphere, false) && frustum.intersects_obb(aabb, &model, false) + frustum.intersects_sphere(&model_sphere, false) + && frustum.intersects_obb(aabb, &model, false, true) } diff --git a/crates/core/src/gamestate.rs b/crates/core/src/gamestate.rs index ddcb52e8a..a2e50c66e 100644 --- a/crates/core/src/gamestate.rs +++ b/crates/core/src/gamestate.rs @@ -1,5 +1,4 @@ use bevy::prelude::*; -use iyes_loopless::prelude::*; use iyes_progress::prelude::*; use crate::state::AppState; @@ -8,26 +7,33 @@ pub(super) struct GameStatePlugin; impl Plugin for GameStatePlugin { fn build(&self, app: &mut App) { - app.add_loopless_state_before_stage(CoreStage::PreUpdate, GameState::None) + app.add_state::() + .add_system( + // TODO chekc this + apply_state_transition:: + .in_base_set(CoreSet::StateTransitions) + .after(apply_state_transition::), + ) .add_plugin(ProgressPlugin::new(GameState::Loading).continue_to(GameState::Playing)) - .add_enter_system(AppState::InGame, setup) - .add_exit_system(AppState::InGame, cleanup); + .add_system(setup.in_schedule(OnEnter(AppState::InGame))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))); } } /// Phase of an already started game. The game might be still loading or /// finishing. -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, States)] pub enum GameState { + #[default] None, Loading, Playing, } -fn setup(mut commands: Commands) { - commands.insert_resource(NextState(GameState::Loading)); +fn setup(mut next_state: ResMut>) { + next_state.set(GameState::Loading); } -fn cleanup(mut commands: Commands) { - commands.insert_resource(NextState(GameState::None)); +fn cleanup(mut next_state: ResMut>) { + next_state.set(GameState::None); } diff --git a/crates/core/src/lib.rs b/crates/core/src/lib.rs index c4f352419..a76e18add 100644 --- a/crates/core/src/lib.rs +++ b/crates/core/src/lib.rs @@ -1,12 +1,13 @@ +use baseset::GameSetsPlugin; use bevy::{app::PluginGroupBuilder, prelude::PluginGroup}; use cleanup::CleanupPlugin; use gamestate::GameStatePlugin; use iyes_progress::prelude::*; -use stages::StagesPlugin; use state::AppState; use visibility::VisibilityPlugin; pub mod assets; +pub mod baseset; pub mod cleanup; mod errors; pub mod events; @@ -18,7 +19,6 @@ pub mod objects; pub mod player; pub mod projection; pub mod screengeom; -pub mod stages; pub mod state; pub mod visibility; @@ -28,7 +28,7 @@ impl PluginGroup for CorePluginGroup { fn build(self) -> PluginGroupBuilder { PluginGroupBuilder::start::() .add(ProgressPlugin::new(AppState::AppLoading).continue_to(AppState::InMenu)) - .add(StagesPlugin) + .add(GameSetsPlugin) .add(GameStatePlugin) .add(VisibilityPlugin) .add(CleanupPlugin) diff --git a/crates/core/src/stages.rs b/crates/core/src/stages.rs deleted file mode 100644 index 7c1d7317f..000000000 --- a/crates/core/src/stages.rs +++ /dev/null @@ -1,73 +0,0 @@ -use bevy::prelude::{App, CoreStage, Plugin, StageLabel, SystemStage}; - -pub struct StagesPlugin; - -impl Plugin for StagesPlugin { - fn build(&self, app: &mut App) { - app.add_stage_before(CoreStage::Update, GameStage::Input, SystemStage::parallel()) - .add_stage_before( - CoreStage::Update, - GameStage::PreMovement, - SystemStage::parallel(), - ) - .add_stage_before( - CoreStage::Update, - GameStage::Movement, - SystemStage::parallel(), - ) - .add_stage_before( - CoreStage::Update, - GameStage::PostMovement, - SystemStage::parallel(), - ) - .add_stage_before( - CoreStage::Update, - GameStage::PreUpdate, - SystemStage::parallel(), - ) - .add_stage_before( - CoreStage::Update, - GameStage::Update, - SystemStage::parallel(), - ) - .add_stage_before( - CoreStage::Update, - GameStage::PostUpdate, - SystemStage::parallel(), - ); - } -} - -/// This enum defines execution stage labels. All are executed in-order just -/// before [`bevy::prelude::CoreStage::Update`]. -#[derive(StageLabel)] -pub enum GameStage { - /// All user input is handled during this stage. - Input, - /// The game state is prepared for movement stage during this stage. The - /// preparation includes, among other things, global path finding & - /// planning related updates. - PreMovement, - /// All of "game active" entity movement (changes to [`bevy::prelude::Transform`]) - /// happens during this stage (an in no other stage). - /// - /// "Game active" entities are those which impact the game dynamics. For - /// example buildings, units or the terrain. Auxiliary entities, for - /// example building drafts, might be moved during other stages. - Movement, - /// This stage includes for example update to spatial index of movable - /// objects. - PostMovement, - /// This stage includes all necessary preparation for the game update, e.g. - /// insertion of components which need to be present during game update. - PreUpdate, - /// Most of the (movement unrelated) game logic happens during this stage. - /// For example unit AI, attacking, object health updates and so on. - /// - /// This is the only stage during which "game active" entities are - /// (de)spawned. - Update, - /// For example this stage includes update to spatial index necessary due - /// to (de)spawning of objects to the game. - PostUpdate, -} diff --git a/crates/core/src/state.rs b/crates/core/src/state.rs index d208a0028..0808a8e38 100644 --- a/crates/core/src/state.rs +++ b/crates/core/src/state.rs @@ -1,5 +1,8 @@ -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +use bevy::prelude::States; + +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, States)] pub enum AppState { + #[default] AppLoading, InMenu, InGame, diff --git a/crates/core/src/visibility.rs b/crates/core/src/visibility.rs index 42d1c2a30..2418a0765 100644 --- a/crates/core/src/visibility.rs +++ b/crates/core/src/visibility.rs @@ -1,23 +1,22 @@ use bevy::prelude::*; -use iyes_loopless::prelude::*; -use crate::{stages::GameStage, state::AppState}; +use crate::{baseset::GameSet, state::AppState}; pub(crate) struct VisibilityPlugin; impl Plugin for VisibilityPlugin { fn build(&self, app: &mut App) { - app.add_system_to_stage( - GameStage::PostUpdate, + app.add_system( update - .run_in_state(AppState::InGame) - .label(VisibilityLabels::Update), + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(AppState::InGame)) + .in_set(VisibilitySet::Update), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub enum VisibilityLabels { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub enum VisibilitySet { Update, } @@ -25,8 +24,8 @@ pub enum VisibilityLabels { /// "visible" flag is set to true and none of "invisible" flag is true. The /// individual flags can be controlled independently. /// -/// The system [`VisibilityLabels::Update`] executed during -/// [`GameStage::PostUpdate`] automatically updates +/// The system [`VisibilitySet::Update`] executed during +/// [`GameSet::PostUpdate`] automatically updates /// [`bevy::render::prelude::Visibility`] of entities with this component. #[derive(Component, Default)] pub struct VisibilityFlags { @@ -64,7 +63,11 @@ impl VisibilityFlags { fn update(mut entities: Query<(&VisibilityFlags, &mut Visibility), Changed>) { for (flags, mut visibility) in entities.iter_mut() { - visibility.is_visible = flags.visible(); + *visibility = if flags.visible() { + Visibility::Inherited + } else { + Visibility::Hidden + }; } } diff --git a/crates/gui/Cargo.toml b/crates/gui/Cargo.toml index bcee82928..24fb70826 100644 --- a/crates/gui/Cargo.toml +++ b/crates/gui/Cargo.toml @@ -17,4 +17,3 @@ de_core.workspace = true # Other bevy.workspace = true -iyes_loopless.workspace = true diff --git a/crates/gui/src/focus.rs b/crates/gui/src/focus.rs index d50a4f74d..612ee7a25 100644 --- a/crates/gui/src/focus.rs +++ b/crates/gui/src/focus.rs @@ -16,7 +16,11 @@ impl Plugin for FocusPlugin { fn build(&self, app: &mut App) { app.init_resource::() .add_event::() - .add_system_to_stage(CoreStage::PreUpdate, focus_system.after(UiSystem::Focus)); + .add_system( + focus_system + .in_base_set(CoreSet::PreUpdate) + .after(UiSystem::Focus), + ); } } @@ -87,7 +91,7 @@ pub(super) struct UiFocus { fn focus_system( mut focus: ResMut, - removals: RemovedComponents, + mut removals: RemovedComponents, mouse: Res>, touch: Res, interactions: Query<(Entity, &Interaction), Changed>, diff --git a/crates/gui/src/lib.rs b/crates/gui/src/lib.rs index 415bddb96..bf820c722 100644 --- a/crates/gui/src/lib.rs +++ b/crates/gui/src/lib.rs @@ -14,7 +14,7 @@ use text::TextPlugin; use textbox::TextBoxPlugin; pub use textbox::{TextBoxCommands, TextBoxQuery}; use toast::ToastPlugin; -pub use toast::{ToastEvent, ToastLabel}; +pub use toast::{ToastEvent, ToastSet}; mod button; mod commands; diff --git a/crates/gui/src/text.rs b/crates/gui/src/text.rs index c4a54bf34..3fbad0cd1 100644 --- a/crates/gui/src/text.rs +++ b/crates/gui/src/text.rs @@ -1,11 +1,10 @@ use bevy::prelude::*; -use iyes_loopless::prelude::*; pub(crate) struct TextPlugin; impl Plugin for TextPlugin { fn build(&self, app: &mut App) { - app.add_system(setup.run_unless_resource_exists::()); + app.add_system(setup.run_if(not(resource_exists::()))); } } diff --git a/crates/gui/src/textbox.rs b/crates/gui/src/textbox.rs index 51bb83120..82306f919 100644 --- a/crates/gui/src/textbox.rs +++ b/crates/gui/src/textbox.rs @@ -54,7 +54,7 @@ impl<'w, 's> TextBoxCommands<'w, 's> for GuiCommands<'w, 's> { .with_children(|builder| { builder.spawn( TextBundle::from_section("", text_style) - .with_text_alignment(TextAlignment::CENTER_LEFT), + .with_text_alignment(TextAlignment::Left), ); }); diff --git a/crates/gui/src/toast.rs b/crates/gui/src/toast.rs index 85d96db1e..60a3cfa0d 100644 --- a/crates/gui/src/toast.rs +++ b/crates/gui/src/toast.rs @@ -2,7 +2,6 @@ use std::{collections::VecDeque, time::Duration}; use bevy::prelude::*; use de_core::state::AppState; -use iyes_loopless::prelude::*; use crate::text::TextProps; @@ -15,26 +14,23 @@ impl Plugin for ToastPlugin { fn build(&self, app: &mut App) { app.init_resource::() .add_event::() - .add_system_set( - SystemSet::new() - .with_system(process_events.label(ToastLabel::ProcessEvents)) - .with_system( - spawn_and_despawn - .run_not_in_state(AppState::AppLoading) - .after(ToastLabel::ProcessEvents), - ), + .add_system(process_events.in_set(ToastSet::ProcessEvents)) + .add_system( + spawn_and_despawn + .run_if(not(in_state(AppState::AppLoading))) + .after(ToastSet::ProcessEvents), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub enum ToastLabel { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub enum ToastSet { ProcessEvents, } /// Send this event to briefly display a UI toast. /// -/// The events are processed by a system labeled [`ToastLabel::ProcessEvents`]. +/// The events are processed by a system labeled [`ToastSet::ProcessEvents`]. pub struct ToastEvent(String); impl ToastEvent { diff --git a/crates/index/Cargo.toml b/crates/index/Cargo.toml index 5c5b3a1d7..18dc75e45 100644 --- a/crates/index/Cargo.toml +++ b/crates/index/Cargo.toml @@ -19,7 +19,6 @@ de_objects.workspace = true # Other bevy.workspace = true glam.workspace = true -iyes_loopless.workspace = true parry3d.workspace = true parry2d.workspace = true ahash.workspace = true diff --git a/crates/index/src/lib.rs b/crates/index/src/lib.rs index 72e2983c2..b82506c0d 100644 --- a/crates/index/src/lib.rs +++ b/crates/index/src/lib.rs @@ -20,7 +20,7 @@ use systems::IndexPlugin; pub use self::{ collider::{ColliderWithCache, LocalCollider, QueryCollider}, index::{EntityIndex, RayEntityIntersection, SpatialQuery}, - systems::IndexLabel, + systems::IndexSet, }; /// Size (in world-space) of a single square tile where entities are kept. diff --git a/crates/index/src/systems.rs b/crates/index/src/systems.rs index 0deedbb7d..4abac9573 100644 --- a/crates/index/src/systems.rs +++ b/crates/index/src/systems.rs @@ -3,13 +3,12 @@ use bevy::prelude::*; use de_core::{ + baseset::GameSet, gamestate::GameState, objects::{MovableSolid, ObjectType, StaticSolid}, - stages::GameStage, state::AppState, }; use de_objects::{ColliderCache, ObjectCache}; -use iyes_loopless::prelude::*; use parry3d::math::Isometry; use super::index::EntityIndex; @@ -43,31 +42,31 @@ pub(crate) struct IndexPlugin; impl Plugin for IndexPlugin { fn build(&self, app: &mut App) { - app.add_enter_system(AppState::InGame, setup) - .add_exit_system(AppState::InGame, cleanup) - .add_system_to_stage( - GameStage::PostUpdate, + app.add_system(setup.in_schedule(OnEnter(AppState::InGame))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) + .add_system( insert - .run_in_state(GameState::Playing) - .label(IndexLabel::Index), + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(GameState::Playing)) + .in_set(IndexSet::Index), ) - .add_system_to_stage( - GameStage::PostUpdate, + .add_system( remove - .run_in_state(GameState::Playing) - .label(IndexLabel::Index), + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(GameState::Playing)) + .in_set(IndexSet::Index), ) - .add_system_to_stage( - GameStage::PostMovement, + .add_system( update - .run_in_state(GameState::Playing) - .label(IndexLabel::Index), + .in_base_set(GameSet::PostMovement) + .run_if(in_state(GameState::Playing)) + .in_set(IndexSet::Index), ); } } -#[derive(SystemLabel)] -pub enum IndexLabel { +#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug, SystemSet)] +pub enum IndexSet { Index, } @@ -105,7 +104,7 @@ fn insert( } } -fn remove(mut index: ResMut, removed: RemovedComponents) { +fn remove(mut index: ResMut, mut removed: RemovedComponents) { for entity in removed.iter() { index.remove(entity); } diff --git a/crates/loader/Cargo.toml b/crates/loader/Cargo.toml index 127621410..408c1e878 100644 --- a/crates/loader/Cargo.toml +++ b/crates/loader/Cargo.toml @@ -21,6 +21,5 @@ de_camera.workspace = true # Other bevy.workspace = true -iyes_loopless.workspace = true iyes_progress.workspace = true futures-lite.workspace = true diff --git a/crates/loader/src/map.rs b/crates/loader/src/map.rs index fb9131be3..3315323ae 100644 --- a/crates/loader/src/map.rs +++ b/crates/loader/src/map.rs @@ -21,16 +21,19 @@ use de_map::{ use de_spawner::SpawnBundle; use de_terrain::TerrainBundle; use futures_lite::future; -use iyes_loopless::prelude::*; use iyes_progress::prelude::*; pub(crate) struct MapLoaderPlugin; impl Plugin for MapLoaderPlugin { fn build(&self, app: &mut App) { - app.add_enter_system(AppState::InGame, load_map_system) - .add_exit_system(AppState::InGame, cleanup) - .add_system(spawn_map.track_progress().run_in_state(GameState::Loading)); + app.add_system(load_map_system.in_schedule(OnEnter(AppState::InGame))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) + .add_system( + spawn_map + .track_progress() + .run_if(in_state(GameState::Loading)), + ); } } @@ -75,9 +78,9 @@ fn spawn_map( let map = match loading_result { Ok(map) => map, - Err(error) => { - log_full_error!(error); - panic!("{}", error); + Err(err) => { + log_full_error!(err); + panic!("{}", err); } }; diff --git a/crates/lobby_client/Cargo.toml b/crates/lobby_client/Cargo.toml index e9da374db..f0382d391 100644 --- a/crates/lobby_client/Cargo.toml +++ b/crates/lobby_client/Cargo.toml @@ -23,7 +23,6 @@ anyhow.workspace = true async-compat.workspace = true bevy.workspace = true futures-lite.workspace = true -iyes_loopless.workspace = true iyes_progress.workspace = true reqwest.workspace = true serde.workspace = true diff --git a/crates/lobby_client/src/client.rs b/crates/lobby_client/src/client.rs index 60c3aaf96..b45950fcf 100644 --- a/crates/lobby_client/src/client.rs +++ b/crates/lobby_client/src/client.rs @@ -1,4 +1,4 @@ -use std::{marker::PhantomData, time::Duration}; +use std::time::Duration; use anyhow::{anyhow, bail, Context, Result}; use async_compat::Compat; @@ -15,14 +15,12 @@ use crate::requestable::LobbyRequestCreator; const USER_AGENT: &str = concat!("DigitalExtinction/", env!("CARGO_PKG_VERSION")); #[derive(SystemParam)] -pub(super) struct AuthenticatedClient<'w, 's> { +pub(super) struct AuthenticatedClient<'w> { auth: Res<'w, Authentication>, client: Option>, - #[system_param(ignore)] - _marker: PhantomData<&'s ()>, } -impl<'w, 's> AuthenticatedClient<'w, 's> { +impl<'w> AuthenticatedClient<'w> { pub(super) fn fire( &self, requestable: &T, diff --git a/crates/lobby_client/src/systems.rs b/crates/lobby_client/src/systems.rs index 77bedaac7..2dec95a35 100644 --- a/crates/lobby_client/src/systems.rs +++ b/crates/lobby_client/src/systems.rs @@ -2,7 +2,6 @@ use bevy::prelude::*; use de_conf::Configuration; use de_core::state::AppState; use de_lobby_model::Token; -use iyes_loopless::prelude::*; use iyes_progress::prelude::*; use crate::{ @@ -17,7 +16,7 @@ impl Plugin for LobbyPlugin { .add_system( setup_client .track_progress() - .run_in_state(AppState::AppLoading), + .run_if(in_state(AppState::AppLoading)), ) .add_system(set_token::) .add_system(set_token::); diff --git a/crates/menu/Cargo.toml b/crates/menu/Cargo.toml index 0cab052b7..4414d2b4d 100644 --- a/crates/menu/Cargo.toml +++ b/crates/menu/Cargo.toml @@ -23,5 +23,4 @@ de_map.workspace = true async-std.workspace = true bevy.workspace = true futures-lite.workspace = true -iyes_loopless.workspace = true thiserror.workspace = true diff --git a/crates/menu/src/aftergame.rs b/crates/menu/src/aftergame.rs index ac93cf98d..62f18beae 100644 --- a/crates/menu/src/aftergame.rs +++ b/crates/menu/src/aftergame.rs @@ -1,7 +1,6 @@ use bevy::prelude::*; use de_core::gresult::GameResult; use de_gui::{GuiCommands, LabelCommands, OuterStyle}; -use iyes_loopless::prelude::*; use crate::{menu::Menu, MenuState}; @@ -9,8 +8,8 @@ pub(crate) struct AfterGamePlugin; impl Plugin for AfterGamePlugin { fn build(&self, app: &mut App) { - app.add_enter_system(MenuState::AfterGame, setup) - .add_enter_system(MenuState::AfterGame, cleanup); + app.add_system(setup.in_schedule(OnEnter(MenuState::AfterGame))) + .add_system(cleanup.in_schedule(OnEnter(MenuState::AfterGame))); } } diff --git a/crates/menu/src/create.rs b/crates/menu/src/create.rs index abd2496a7..562396633 100644 --- a/crates/menu/src/create.rs +++ b/crates/menu/src/create.rs @@ -6,7 +6,6 @@ use de_gui::{ use de_lobby_client::CreateGameRequest; use de_lobby_model::{GameConfig, GameMap, Validatable}; use de_map::hash::MapHash; -use iyes_loopless::prelude::*; use crate::{ mapselection::{MapSelectedEvent, SelectMapEvent}, @@ -21,30 +20,30 @@ impl Plugin for CreateGamePlugin { fn build(&self, app: &mut App) { app.add_plugin(RequestsPlugin::::new()) .add_event::() - .add_enter_system(MenuState::GameCreation, setup) - .add_exit_system(MenuState::GameCreation, cleanup) + .add_system(setup.in_schedule(OnEnter(MenuState::GameCreation))) + .add_system(cleanup.in_schedule(OnExit(MenuState::GameCreation))) .add_system( button_system - .run_in_state(MenuState::GameCreation) - .label(CreateLabel::Buttons), + .run_if(in_state(MenuState::GameCreation)) + .in_set(CreateSet::Buttons), ) .add_system( map_selected_system - .run_in_state(MenuState::GameCreation) - .label(CreateLabel::MapSelected), + .run_if(in_state(MenuState::GameCreation)) + .in_set(CreateSet::MapSelected), ) .add_system( create_game_system - .run_in_state(MenuState::GameCreation) - .after(CreateLabel::Buttons) - .after(CreateLabel::MapSelected), + .run_if(in_state(MenuState::GameCreation)) + .after(CreateSet::Buttons) + .after(CreateSet::MapSelected), ) - .add_system(response_system.run_in_state(MenuState::GameCreation)); + .add_system(response_system.run_if(in_state(MenuState::GameCreation))); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub(crate) enum CreateLabel { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub(crate) enum CreateSet { Buttons, MapSelected, } @@ -269,13 +268,13 @@ fn create_game_system( } fn response_system( - mut commands: Commands, + mut next_state: ResMut>, mut receiver: Receiver, mut toasts: EventWriter, ) { if let Some(result) = receiver.receive() { match result { - Ok(_) => commands.insert_resource(NextState(MenuState::MultiPlayerGame)), + Ok(_) => next_state.set(MenuState::MultiPlayerGame), Err(error) => toasts.send(ToastEvent::new(error)), } } diff --git a/crates/menu/src/gamelisting.rs b/crates/menu/src/gamelisting.rs index ba9a9043f..cdde52203 100644 --- a/crates/menu/src/gamelisting.rs +++ b/crates/menu/src/gamelisting.rs @@ -1,10 +1,9 @@ use std::time::Duration; use bevy::{prelude::*, time::Stopwatch}; -use de_gui::{ButtonCommands, GuiCommands, LabelCommands, OuterStyle, ToastEvent, ToastLabel}; +use de_gui::{ButtonCommands, GuiCommands, LabelCommands, OuterStyle, ToastEvent, ToastSet}; use de_lobby_client::{ListGamesRequest, RequestEvent, ResponseEvent}; use de_lobby_model::GamePartial; -use iyes_loopless::prelude::*; use crate::{menu::Menu, MenuState}; @@ -14,15 +13,15 @@ pub(crate) struct GameListingPlugin; impl Plugin for GameListingPlugin { fn build(&self, app: &mut App) { - app.add_enter_system(MenuState::GameListing, setup) - .add_exit_system(MenuState::GameListing, cleanup) - .add_system(refresh_system.run_in_state(MenuState::GameListing)) + app.add_system(setup.in_schedule(OnEnter(MenuState::GameListing))) + .add_system(cleanup.in_schedule(OnExit(MenuState::GameListing))) + .add_system(refresh_system.run_if(in_state(MenuState::GameListing))) .add_system( list_games_system - .run_in_state(MenuState::GameListing) - .before(ToastLabel::ProcessEvents), + .run_if(in_state(MenuState::GameListing)) + .before(ToastSet::ProcessEvents), ) - .add_system(button_system.run_in_state(MenuState::GameListing)); + .add_system(button_system.run_if(in_state(MenuState::GameListing))); } } @@ -178,16 +177,14 @@ fn list_games_system( } fn button_system( - mut commands: Commands, + mut next_state: ResMut>, interactions: Query<(&Interaction, &ButtonAction), Changed>, mut toasts: EventWriter, ) { for (&interaction, action) in interactions.iter() { if let Interaction::Clicked = interaction { match action { - ButtonAction::Create => { - commands.insert_resource(NextState(MenuState::GameCreation)) - } + ButtonAction::Create => next_state.set(MenuState::GameCreation), ButtonAction::Join => { toasts.send(ToastEvent::new("Not yet implemented (issue #301).")) } diff --git a/crates/menu/src/lib.rs b/crates/menu/src/lib.rs index 85d2c1f62..e2cdd8546 100644 --- a/crates/menu/src/lib.rs +++ b/crates/menu/src/lib.rs @@ -3,8 +3,6 @@ use bevy::{app::PluginGroupBuilder, prelude::*}; use create::CreateGamePlugin; use de_core::{gresult::GameResult, state::AppState}; use gamelisting::GameListingPlugin; -use iyes_loopless::prelude::*; -use iyes_loopless::state::NextState; use mainmenu::MainMenuPlugin; use mapselection::MapSelectionPlugin; use menu::MenuPlugin; @@ -42,14 +40,21 @@ struct MenuSetupPlugin; impl Plugin for MenuSetupPlugin { fn build(&self, app: &mut App) { - app.add_loopless_state_before_stage(CoreStage::PreUpdate, MenuState::None) - .add_enter_system(AppState::InMenu, menu_entered_system) - .add_exit_system(AppState::InMenu, menu_exited_system); + app.add_state::() + .add_system( + // TODO find a nicer way, i.e. without adding it twice + apply_state_transition:: + .in_base_set(CoreSet::StateTransitions) + .after(apply_state_transition::), + ) + .add_system(menu_entered_system.in_schedule(OnEnter(AppState::InMenu))) + .add_system(menu_exited_system.in_schedule(OnExit(AppState::InMenu))); } } -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, States)] pub(crate) enum MenuState { + #[default] None, MainMenu, SinglePlayerGame, @@ -60,14 +65,17 @@ pub(crate) enum MenuState { AfterGame, } -fn menu_entered_system(mut commands: Commands, result: Option>) { +fn menu_entered_system( + mut next_state: ResMut>, + result: Option>, +) { if result.is_some() { - commands.insert_resource(NextState(MenuState::AfterGame)); + next_state.set(MenuState::AfterGame); } else { - commands.insert_resource(NextState(MenuState::MainMenu)); + next_state.set(MenuState::MainMenu); } } -fn menu_exited_system(mut commands: Commands) { - commands.insert_resource(NextState(MenuState::None)); +fn menu_exited_system(mut next_state: ResMut>) { + next_state.set(MenuState::None); } diff --git a/crates/menu/src/mainmenu.rs b/crates/menu/src/mainmenu.rs index 3b306d7fb..a4c4e40a8 100644 --- a/crates/menu/src/mainmenu.rs +++ b/crates/menu/src/mainmenu.rs @@ -1,6 +1,5 @@ use bevy::{app::AppExit, prelude::*}; use de_gui::{ButtonCommands, GuiCommands, OuterStyle}; -use iyes_loopless::prelude::*; use crate::{menu::Menu, MenuState}; @@ -8,8 +7,8 @@ pub(crate) struct MainMenuPlugin; impl Plugin for MainMenuPlugin { fn build(&self, app: &mut App) { - app.add_enter_system(MenuState::MainMenu, setup) - .add_system(button_system.run_in_state(MenuState::MainMenu)); + app.add_system(setup.in_schedule(OnEnter(MenuState::MainMenu))) + .add_system(button_system.run_if(in_state(MenuState::MainMenu))); } } @@ -70,14 +69,14 @@ fn button(commands: &mut GuiCommands, parent: Entity, action: ButtonAction, capt } fn button_system( - mut commands: Commands, + mut next_state: ResMut>, mut exit: EventWriter, interactions: Query<(&Interaction, &ButtonAction), Changed>, ) { for (&interaction, &action) in interactions.iter() { if let Interaction::Clicked = interaction { match action { - ButtonAction::SwithState(state) => commands.insert_resource(NextState(state)), + ButtonAction::SwithState(state) => next_state.set(state), ButtonAction::Quit => exit.send(AppExit), }; } diff --git a/crates/menu/src/mapselection.rs b/crates/menu/src/mapselection.rs index 84efc0486..de026964a 100644 --- a/crates/menu/src/mapselection.rs +++ b/crates/menu/src/mapselection.rs @@ -12,30 +12,27 @@ use de_map::{ meta::MapMetadata, }; use futures_lite::future; -use iyes_loopless::prelude::*; use thiserror::Error; pub(crate) struct MapSelectionPlugin; impl Plugin for MapSelectionPlugin { fn build(&self, app: &mut App) { - app.add_loopless_state_before_stage(CoreStage::PreUpdate, MapState::Off) + app.add_state::() .add_event::() .add_event::() - .add_enter_system(MapState::On, setup) - .add_exit_system(MapState::On, cleanup) - .add_system_set( - SystemSet::new() - .with_system(init_buttons.run_in_state(MapState::On)) - .with_system(button_system.run_in_state(MapState::On)) - .with_system(select_map_system.run_in_state(AppState::InMenu)), - ); + .add_system(setup.in_schedule(OnEnter(MapState::On))) + .add_system(cleanup.in_schedule(OnExit(MapState::On))) + .add_system(init_buttons.run_if(in_state(MapState::On))) + .add_system(button_system.run_if(in_state(MapState::On))) + .add_system(select_map_system.run_if(in_state(AppState::InMenu))); } } -#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] +#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default, States)] enum MapState { On, + #[default] Off, } @@ -128,9 +125,9 @@ fn init_buttons( let map_entries = match result { Ok(entries) => entries, - Err(error) => { - log_full_error!(error); - panic!("{}", error); + Err(err) => { + log_full_error!(err); + panic!("{}", err); } }; @@ -164,13 +161,13 @@ fn cleanup(mut commands: Commands, node: Res) { } fn button_system( - mut commands: Commands, + mut next_state: ResMut>, interactions: Query<(&Interaction, &MapEntry), Changed>, mut events: EventWriter, ) { for (&interaction, map) in interactions.iter() { if let Interaction::Clicked = interaction { - commands.insert_resource(NextState(MapState::Off)); + next_state.set(MapState::Off); events.send(MapSelectedEvent::new( map.path().into(), map.metadata().clone(), @@ -234,10 +231,13 @@ fn map_button(commands: &mut GuiCommands, map: MapEntry) -> Entity { .id() } -fn select_map_system(mut commands: Commands, mut events: EventReader) { +fn select_map_system( + mut next_state: ResMut>, + mut events: EventReader, +) { // Exhaust the iterator. if events.iter().count() == 0 { return; } - commands.insert_resource(NextState(MapState::On)); + next_state.set(MapState::On); } diff --git a/crates/menu/src/menu.rs b/crates/menu/src/menu.rs index c1289d789..cff989a63 100644 --- a/crates/menu/src/menu.rs +++ b/crates/menu/src/menu.rs @@ -1,7 +1,6 @@ use bevy::prelude::*; use de_core::state::AppState; use de_gui::{ButtonCommands, GuiCommands, OuterStyle}; -use iyes_loopless::{prelude::*, state::StateTransitionStageLabel}; use crate::MenuState; @@ -9,26 +8,24 @@ pub(crate) struct MenuPlugin; impl Plugin for MenuPlugin { fn build(&self, app: &mut App) { - app.add_stage_before( - StateTransitionStageLabel::from_type::(), - MenuStage::PreTransition, - SystemStage::parallel(), - ) - .add_enter_system(AppState::InMenu, setup) - .add_exit_system(AppState::InMenu, cleanup) - .add_system_to_stage( - MenuStage::PreTransition, - state_transition.run_if_resource_exists::(), - ) - .add_system(button_system.run_in_state(AppState::InMenu)); + app.add_system(setup.in_schedule(OnEnter(AppState::InMenu))) + .add_system(cleanup.in_schedule(OnExit(AppState::InMenu))) + .add_system( + // TODO check if it is possible to run this in StateTransitions + // set but before stage transition is applied + clean_up_root + .in_base_set(CoreSet::PreUpdate) + .run_if(resource_exists::()), + ) + .add_system( + hide_show_corner + .run_if(resource_exists::()) + .run_if(resource_changed::>()), + ) + .add_system(button_system.run_if(in_state(AppState::InMenu))); } } -#[derive(StageLabel)] -pub enum MenuStage { - PreTransition, -} - #[derive(Resource)] pub(crate) struct Menu { root_node: Entity, @@ -57,18 +54,24 @@ enum ButtonAction { Close, } -fn state_transition( - mut commands: Commands, - state: Option>>, +fn clean_up_root(mut commands: Commands, state: Res>, menu: Res) { + if state.0.is_none() { + return; + }; + commands.entity(menu.root_node()).despawn_descendants(); +} + +fn hide_show_corner( + state: Res>, menu: Res, mut visibility: Query<&mut Visibility>, ) { - if let Some(state) = state { - commands.entity(menu.root_node()).despawn_descendants(); - - let mut corner_visibility = visibility.get_mut(menu.corner_node()).unwrap(); - corner_visibility.is_visible = state.0 != MenuState::MainMenu; - } + let mut corner_visibility = visibility.get_mut(menu.corner_node()).unwrap(); + *corner_visibility = if state.0 == MenuState::MainMenu { + Visibility::Hidden + } else { + Visibility::Inherited + }; } fn setup(mut commands: GuiCommands) { @@ -137,13 +140,13 @@ fn spawn_corner_node(commands: &mut GuiCommands) -> Entity { } fn button_system( - mut commands: Commands, + mut next_state: ResMut>, interactions: Query<(&Interaction, &ButtonAction), Changed>, ) { for (&interaction, &action) in interactions.iter() { if let Interaction::Clicked = interaction { match action { - ButtonAction::Close => commands.insert_resource(NextState(MenuState::MainMenu)), + ButtonAction::Close => next_state.set(MenuState::MainMenu), } } } diff --git a/crates/menu/src/requests.rs b/crates/menu/src/requests.rs index 51b34fde3..0bd3d7e4f 100644 --- a/crates/menu/src/requests.rs +++ b/crates/menu/src/requests.rs @@ -3,7 +3,6 @@ use std::marker::PhantomData; use bevy::{ecs::system::SystemParam, prelude::*}; use de_core::state::AppState; use de_lobby_client::{LobbyRequest, RequestEvent, ResponseEvent, Result}; -use iyes_loopless::prelude::*; pub(crate) struct RequestsPlugin where @@ -28,21 +27,21 @@ where T: LobbyRequest, { fn build(&self, app: &mut App) { - app.add_enter_system(AppState::InMenu, setup::) - .add_exit_system(AppState::InMenu, cleanup::); + app.add_system(setup::.in_schedule(OnEnter(AppState::InMenu))) + .add_system(cleanup::.in_schedule(OnExit(AppState::InMenu))); } } #[derive(SystemParam)] -pub(crate) struct Sender<'w, 's, T> +pub(crate) struct Sender<'w, T> where T: LobbyRequest, { counter: ResMut<'w, Counter>, - requests: EventWriter<'w, 's, RequestEvent>, + requests: EventWriter<'w, RequestEvent>, } -impl<'w, 's, T> Sender<'w, 's, T> +impl<'w, T> Sender<'w, T> where T: LobbyRequest, { diff --git a/crates/menu/src/signin.rs b/crates/menu/src/signin.rs index 106da1cbb..8e2f7f925 100644 --- a/crates/menu/src/signin.rs +++ b/crates/menu/src/signin.rs @@ -1,11 +1,10 @@ use bevy::prelude::*; use de_gui::{ ButtonCommands, GuiCommands, LabelCommands, OuterStyle, SetFocusEvent, TextBoxCommands, - TextBoxQuery, ToastEvent, ToastLabel, + TextBoxQuery, ToastEvent, ToastSet, }; use de_lobby_client::{Authentication, LobbyRequest, SignInRequest, SignUpRequest}; use de_lobby_model::{User, UserWithPassword, UsernameAndPassword}; -use iyes_loopless::prelude::*; use crate::{ menu::Menu, @@ -19,24 +18,24 @@ impl Plugin for SignInPlugin { fn build(&self, app: &mut App) { app.add_plugin(RequestsPlugin::::new()) .add_plugin(RequestsPlugin::::new()) - .add_enter_system(MenuState::SignIn, setup) - .add_exit_system(MenuState::SignIn, cleanup) + .add_system(setup.in_schedule(OnEnter(MenuState::SignIn))) + .add_system(cleanup.in_schedule(OnExit(MenuState::SignIn))) .add_system( button_system - .run_if_resource_exists::() - .run_in_state(MenuState::SignIn), + .run_if(resource_exists::()) + .run_if(in_state(MenuState::SignIn)), ) .add_system( response_system:: - .run_in_state(MenuState::SignIn) - .before(ToastLabel::ProcessEvents), + .run_if(in_state(MenuState::SignIn)) + .before(ToastSet::ProcessEvents), ) .add_system( response_system:: - .run_in_state(MenuState::SignIn) - .before(ToastLabel::ProcessEvents), + .run_if(in_state(MenuState::SignIn)) + .before(ToastSet::ProcessEvents), ) - .add_system(auth_system.run_in_state(MenuState::SignIn)); + .add_system(auth_system.run_if(in_state(MenuState::SignIn))); } } @@ -204,8 +203,8 @@ where } } -fn auth_system(mut commands: Commands, auth: Res) { +fn auth_system(mut next_state: ResMut>, auth: Res) { if auth.is_authenticated() { - commands.insert_resource(NextState(MenuState::GameListing)); + next_state.set(MenuState::GameListing); } } diff --git a/crates/menu/src/singleplayer.rs b/crates/menu/src/singleplayer.rs index cf494dca5..08b6e3f5c 100644 --- a/crates/menu/src/singleplayer.rs +++ b/crates/menu/src/singleplayer.rs @@ -2,7 +2,6 @@ use async_std::path::PathBuf; use bevy::prelude::*; use de_core::{gconfig::GameConfig, player::Player, state::AppState}; use de_gui::{ButtonCommands, GuiCommands, OuterStyle, ToastEvent}; -use iyes_loopless::prelude::*; use crate::{ mapselection::{MapSelectedEvent, SelectMapEvent}, @@ -14,10 +13,10 @@ pub(crate) struct SinglePlayerPlugin; impl Plugin for SinglePlayerPlugin { fn build(&self, app: &mut App) { - app.add_enter_system(MenuState::SinglePlayerGame, setup) - .add_exit_system(MenuState::SinglePlayerGame, cleanup) - .add_system(button_system.run_in_state(MenuState::SinglePlayerGame)) - .add_system(map_selected_system.run_in_state(MenuState::SinglePlayerGame)); + app.add_system(setup.in_schedule(OnEnter(MenuState::SinglePlayerGame))) + .add_system(cleanup.in_schedule(OnExit(MenuState::SinglePlayerGame))) + .add_system(button_system.run_if(in_state(MenuState::SinglePlayerGame))) + .add_system(map_selected_system.run_if(in_state(MenuState::SinglePlayerGame))); } } @@ -88,6 +87,7 @@ fn cleanup(mut commands: Commands) { fn button_system( mut commands: Commands, interactions: Query<(&Interaction, &ButtonAction), Changed>, + mut next_state: ResMut>, map: Res, mut map_events: EventWriter, mut toasts: EventWriter, @@ -102,7 +102,7 @@ fn button_system( Player::Player1, Player::Player4, )); - commands.insert_resource(NextState(AppState::InGame)); + next_state.set(AppState::InGame); } None => { toasts.send(ToastEvent::new("No map selected.")); diff --git a/crates/movement/Cargo.toml b/crates/movement/Cargo.toml index 487634816..c5a3e8c9d 100644 --- a/crates/movement/Cargo.toml +++ b/crates/movement/Cargo.toml @@ -21,7 +21,6 @@ de_index.workspace = true # Other bevy.workspace = true -iyes_loopless.workspace = true parry3d.workspace = true parry2d.workspace = true glam.workspace = true diff --git a/crates/movement/src/altitude.rs b/crates/movement/src/altitude.rs index e114e8579..6715cfb69 100644 --- a/crates/movement/src/altitude.rs +++ b/crates/movement/src/altitude.rs @@ -1,12 +1,11 @@ use bevy::prelude::*; use de_core::{ + baseset::GameSet, gamestate::GameState, objects::{MovableSolid, ObjectType}, - stages::GameStage, state::AppState, }; use de_objects::ObjectCache; -use iyes_loopless::prelude::*; use crate::{ movement::DesiredVelocity, @@ -18,24 +17,23 @@ pub(crate) struct AltitudePlugin; impl Plugin for AltitudePlugin { fn build(&self, app: &mut App) { - app.add_system_to_stage( - GameStage::PreMovement, - setup_entities.run_in_state(AppState::InGame), + app.add_system( + setup_entities + .in_base_set(GameSet::PreMovement) + .run_if(in_state(AppState::InGame)), ) - .add_system_set_to_stage( - GameStage::Movement, - SystemSet::new().with_system( - update - .run_in_state(GameState::Playing) - .label(AltitudeLabels::Update) - .after(RepulsionLables::Apply), - ), + .add_system( + update + .in_base_set(GameSet::Movement) + .run_if(in_state(GameState::Playing)) + .in_set(AltitudeSet::Update) + .after(RepulsionLables::Apply), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub(crate) enum AltitudeLabels { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub(crate) enum AltitudeSet { Update, } @@ -70,8 +68,7 @@ fn update( &Transform, )>, ) { - objects.par_for_each_mut( - 512, + objects.par_iter_mut().for_each_mut( |(&object_type, mut horizontal, mut climbing, transform)| { let Some(flight) = cache.get(object_type).flight() else { return }; let height = transform.translation.y; diff --git a/crates/movement/src/kinematics.rs b/crates/movement/src/kinematics.rs index 7a1968fcc..ad15a7dac 100644 --- a/crates/movement/src/kinematics.rs +++ b/crates/movement/src/kinematics.rs @@ -2,14 +2,13 @@ use std::f32::consts::{FRAC_PI_4, PI, TAU}; use bevy::prelude::*; use de_core::{ - gamestate::GameState, objects::MovableSolid, projection::ToAltitude, stages::GameStage, + baseset::GameSet, gamestate::GameState, objects::MovableSolid, projection::ToAltitude, state::AppState, }; -use iyes_loopless::prelude::*; use crate::{ - altitude::{AltitudeLabels, DesiredClimbing}, - movement::{DesiredVelocity, MovementLabels, ObjectVelocity}, + altitude::{AltitudeSet, DesiredClimbing}, + movement::{DesiredVelocity, MovementSet, ObjectVelocity}, repulsion::{RepulsionLables, RepulsionVelocity}, G_ACCELERATION, MAX_ANGULAR_SPEED, MAX_H_SPEED, MAX_V_ACCELERATION, MAX_V_SPEED, }; @@ -18,26 +17,25 @@ pub(crate) struct KinematicsPlugin; impl Plugin for KinematicsPlugin { fn build(&self, app: &mut App) { - app.add_system_to_stage( - GameStage::PreMovement, - setup_entities.run_in_state(AppState::InGame), + app.add_system( + setup_entities + .in_base_set(GameSet::PreMovement) + .run_if(in_state(AppState::InGame)), ) - .add_system_set_to_stage( - GameStage::Movement, - SystemSet::new().with_system( - kinematics - .run_in_state(GameState::Playing) - .label(KinematicsLabels::Kinematics) - .before(MovementLabels::UpdateTransform) - .after(RepulsionLables::Apply) - .after(AltitudeLabels::Update), - ), + .add_system( + kinematics + .in_base_set(GameSet::Movement) + .run_if(in_state(GameState::Playing)) + .in_set(KinematicsSet::Kinematics) + .before(MovementSet::UpdateTransform) + .after(RepulsionLables::Apply) + .after(AltitudeSet::Update), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -enum KinematicsLabels { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +enum KinematicsSet { Kinematics, } @@ -115,37 +113,39 @@ fn kinematics( ) { let time_delta = time.delta_seconds(); - objects.par_for_each_mut(512, |(movement, climbing, mut kinematics, mut velocity)| { - let desired_h_velocity = movement.velocity(); - let desired_heading = if desired_h_velocity == Vec2::ZERO { - kinematics.heading() - } else { - desired_h_velocity.y.atan2(desired_h_velocity.x) - }; - - let heading_diff = normalize_angle(desired_heading - kinematics.heading()); - let max_heading_delta = MAX_ANGULAR_SPEED * time_delta; - let heading_delta = heading_diff.clamp(-max_heading_delta, max_heading_delta); - kinematics.update_heading(heading_delta); - - let max_h_speed_delta = MAX_H_SPEED * time_delta; - let h_speed_delta = if (heading_diff - heading_delta).abs() > FRAC_PI_4 { - // Slow down if not going in roughly good direction. - -kinematics.horizontal_speed() - } else { - desired_h_velocity.length() - kinematics.horizontal_speed() - } - .clamp(-max_h_speed_delta, max_h_speed_delta); - kinematics.update_horizontal_speed(h_speed_delta); - - let v_speed_delta = (climbing.speed() - kinematics.vertical_speed()).clamp( - -time_delta * G_ACCELERATION, - time_delta * MAX_V_ACCELERATION, - ); - kinematics.update_vertical_speed(v_speed_delta); - - velocity.update(kinematics.compute_velocity(), kinematics.heading()); - }); + objects + .par_iter_mut() + .for_each_mut(|(movement, climbing, mut kinematics, mut velocity)| { + let desired_h_velocity = movement.velocity(); + let desired_heading = if desired_h_velocity == Vec2::ZERO { + kinematics.heading() + } else { + desired_h_velocity.y.atan2(desired_h_velocity.x) + }; + + let heading_diff = normalize_angle(desired_heading - kinematics.heading()); + let max_heading_delta = MAX_ANGULAR_SPEED * time_delta; + let heading_delta = heading_diff.clamp(-max_heading_delta, max_heading_delta); + kinematics.update_heading(heading_delta); + + let max_h_speed_delta = MAX_H_SPEED * time_delta; + let h_speed_delta = if (heading_diff - heading_delta).abs() > FRAC_PI_4 { + // Slow down if not going in roughly good direction. + -kinematics.horizontal_speed() + } else { + desired_h_velocity.length() - kinematics.horizontal_speed() + } + .clamp(-max_h_speed_delta, max_h_speed_delta); + kinematics.update_horizontal_speed(h_speed_delta); + + let v_speed_delta = (climbing.speed() - kinematics.vertical_speed()).clamp( + -time_delta * G_ACCELERATION, + time_delta * MAX_V_ACCELERATION, + ); + kinematics.update_vertical_speed(v_speed_delta); + + velocity.update(kinematics.compute_velocity(), kinematics.heading()); + }); } fn normalize_angle(mut angle: f32) -> f32 { diff --git a/crates/movement/src/movement.rs b/crates/movement/src/movement.rs index 03cd5aa91..0f1059f51 100644 --- a/crates/movement/src/movement.rs +++ b/crates/movement/src/movement.rs @@ -2,12 +2,11 @@ use std::marker::PhantomData; use bevy::prelude::*; use de_core::{ - gamestate::GameState, objects::MovableSolid, projection::ToAltitude, stages::GameStage, + baseset::GameSet, gamestate::GameState, objects::MovableSolid, projection::ToAltitude, state::AppState, }; use de_map::size::MapBounds; use de_objects::EXCLUSION_OFFSET; -use iyes_loopless::prelude::*; use crate::MAX_ALTITUDE; @@ -15,23 +14,22 @@ pub(crate) struct MovementPlugin; impl Plugin for MovementPlugin { fn build(&self, app: &mut App) { - app.add_system_to_stage( - GameStage::PreMovement, - setup_entities.run_in_state(AppState::InGame), + app.add_system( + setup_entities + .in_base_set(GameSet::PreMovement) + .run_if(in_state(AppState::InGame)), ) - .add_system_set_to_stage( - GameStage::Movement, - SystemSet::new().with_system( - update_transform - .run_in_state(GameState::Playing) - .label(MovementLabels::UpdateTransform), - ), + .add_system( + update_transform + .in_base_set(GameSet::Movement) + .run_if(in_state(GameState::Playing)) + .in_set(MovementSet::UpdateTransform), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub(crate) enum MovementLabels { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub(crate) enum MovementSet { UpdateTransform, } diff --git a/crates/movement/src/obstacles.rs b/crates/movement/src/obstacles.rs index d9c119035..877b06baf 100644 --- a/crates/movement/src/obstacles.rs +++ b/crates/movement/src/obstacles.rs @@ -1,13 +1,12 @@ use bevy::prelude::*; use de_core::{ + baseset::GameSet, gamestate::GameState, objects::{MovableSolid, ObjectType, StaticSolid}, projection::ToFlat, - stages::GameStage, }; use de_index::SpatialQuery; use de_objects::{IchnographyCache, ObjectCache}; -use iyes_loopless::prelude::*; use parry3d::{bounding_volume::Aabb, math::Point}; use crate::{cache::DecayingCache, disc::Disc}; @@ -20,30 +19,32 @@ pub(crate) struct ObstaclesPlugin; impl Plugin for ObstaclesPlugin { fn build(&self, app: &mut App) { - app.add_system_set_to_stage( - GameStage::PreMovement, - SystemSet::new() - .with_system(setup_discs.run_in_state(GameState::Playing)) - .with_system(update_discs.run_in_state(GameState::Playing)), + app.add_system( + setup_discs + .in_base_set(GameSet::PreMovement) + .run_if(in_state(GameState::Playing)), ) - .add_system_set_to_stage( - GameStage::Movement, - SystemSet::new() - .with_system( - update_nearby:: - .run_in_state(GameState::Playing) - .label(ObstaclesLables::UpdateNearby), - ) - .with_system( - update_nearby:: - .run_in_state(GameState::Playing) - .label(ObstaclesLables::UpdateNearby), - ), + .add_system( + update_discs + .in_base_set(GameSet::PreMovement) + .run_if(in_state(GameState::Playing)), + ) + .add_system( + update_nearby:: + .in_base_set(GameSet::Movement) + .run_if(in_state(GameState::Playing)) + .in_set(ObstaclesLables::UpdateNearby), + ) + .add_system( + update_nearby:: + .in_base_set(GameSet::Movement) + .run_if(in_state(GameState::Playing)) + .in_set(ObstaclesLables::UpdateNearby), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] pub(crate) enum ObstaclesLables { UpdateNearby, } @@ -82,13 +83,15 @@ fn update_nearby( mut objects: Query<(Entity, &Transform, &mut DecayingCache)>, space: SpatialQuery>, ) { - objects.par_for_each_mut(512, |(entity, transform, mut cache)| { - cache.clear(); - let half_extent = Vec3::splat(NEARBY_HALF_EXTENT); - let mins = transform.translation - half_extent; - let maxs = transform.translation + half_extent; - let region = Aabb::new(Point::from(mins), Point::from(maxs)); - cache.extend(space.query_aabb(®ion, Some(entity))); - cache.decay(time.delta_seconds()); - }); + objects + .par_iter_mut() + .for_each_mut(|(entity, transform, mut cache)| { + cache.clear(); + let half_extent = Vec3::splat(NEARBY_HALF_EXTENT); + let mins = transform.translation - half_extent; + let maxs = transform.translation + half_extent; + let region = Aabb::new(Point::from(mins), Point::from(maxs)); + cache.extend(space.query_aabb(®ion, Some(entity))); + cache.decay(time.delta_seconds()); + }); } diff --git a/crates/movement/src/pathing.rs b/crates/movement/src/pathing.rs index f4a4a7cd8..7bfd0b34e 100644 --- a/crates/movement/src/pathing.rs +++ b/crates/movement/src/pathing.rs @@ -1,7 +1,6 @@ use bevy::prelude::*; -use de_core::{gamestate::GameState, projection::ToFlat, stages::GameStage, state::AppState}; +use de_core::{baseset::GameSet, gamestate::GameState, projection::ToFlat, state::AppState}; use de_pathing::ScheduledPath; -use iyes_loopless::prelude::*; use crate::{ movement::{add_desired_velocity, DesiredVelocity}, @@ -14,27 +13,29 @@ pub(crate) struct PathingPlugin; impl Plugin for PathingPlugin { fn build(&self, app: &mut App) { - app.add_system_set_to_stage( - GameStage::PreMovement, - SystemSet::new() - .with_system(finish_paths.run_in_state(GameState::Playing)) - .with_system(add_desired_velocity::.run_in_state(AppState::InGame)), + app.add_system( + finish_paths + .in_base_set(GameSet::PreMovement) + .run_if(in_state(GameState::Playing)), ) - .add_system_set_to_stage( - GameStage::Movement, - SystemSet::new().with_system( - follow_path - .run_in_state(GameState::Playing) - .label(PathingLabels::FollowPath), - ), + .add_system( + add_desired_velocity:: + .in_base_set(GameSet::PreMovement) + .run_if(in_state(AppState::InGame)), + ) + .add_system( + follow_path + .in_base_set(GameSet::Movement) + .run_if(in_state(GameState::Playing)) + .in_set(PathingSet::FollowPath), ); } } pub(crate) struct PathVelocity; -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub(crate) enum PathingLabels { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub(crate) enum PathingSet { FollowPath, } @@ -63,12 +64,14 @@ fn follow_path( &mut DesiredVelocity, )>, ) { - objects.par_for_each_mut(512, |(transform, mut path, mut movement)| { - let location = transform.translation.to_flat(); - let remaining = path.destination().distance(location); - let advancement = path.advance(location, MAX_H_SPEED * 0.5); - let direction = (advancement - location).normalize(); - let desired_speed = MAX_H_SPEED.min((2. * remaining * MAX_H_ACCELERATION).sqrt()); - movement.update(desired_speed * direction); - }); + objects + .par_iter_mut() + .for_each_mut(|(transform, mut path, mut movement)| { + let location = transform.translation.to_flat(); + let remaining = path.destination().distance(location); + let advancement = path.advance(location, MAX_H_SPEED * 0.5); + let direction = (advancement - location).normalize(); + let desired_speed = MAX_H_SPEED.min((2. * remaining * MAX_H_ACCELERATION).sqrt()); + movement.update(desired_speed * direction); + }); } diff --git a/crates/movement/src/repulsion.rs b/crates/movement/src/repulsion.rs index 5542ce4df..c251ce4ef 100644 --- a/crates/movement/src/repulsion.rs +++ b/crates/movement/src/repulsion.rs @@ -1,14 +1,13 @@ use bevy::prelude::*; use de_core::{ + baseset::GameSet, gamestate::GameState, objects::{MovableSolid, ObjectType, StaticSolid}, projection::ToFlat, - stages::GameStage, state::AppState, }; use de_map::size::MapBounds; use de_objects::{IchnographyCache, ObjectCache, EXCLUSION_OFFSET}; -use iyes_loopless::prelude::*; use parry2d::{math::Isometry, na::Unit, query::PointQuery}; use crate::{ @@ -16,7 +15,7 @@ use crate::{ disc::Disc, movement::{add_desired_velocity, DesiredVelocity}, obstacles::{MovableObstacles, ObstaclesLables, StaticObstacles}, - pathing::{PathVelocity, PathingLabels}, + pathing::{PathVelocity, PathingSet}, MAX_H_ACCELERATION, MAX_H_SPEED, }; @@ -29,50 +28,52 @@ pub(crate) struct RepulsionPlugin; impl Plugin for RepulsionPlugin { fn build(&self, app: &mut App) { - app.add_system_set_to_stage( - GameStage::PreMovement, - SystemSet::new() - .with_system(setup_entities.run_in_state(AppState::InGame)) - .with_system( - add_desired_velocity::.run_in_state(AppState::InGame), - ), + app.add_system( + setup_entities + .in_base_set(GameSet::PreMovement) + .run_if(in_state(AppState::InGame)), ) - .add_system_set_to_stage( - GameStage::Movement, - SystemSet::new() - .with_system( - repel_static - .run_in_state(GameState::Playing) - .label(RepulsionLables::RepelStatic) - .after(ObstaclesLables::UpdateNearby) - .after(PathingLabels::FollowPath), - ) - .with_system( - repel_movable - .run_in_state(GameState::Playing) - .label(RepulsionLables::RepelMovable) - .after(ObstaclesLables::UpdateNearby) - .after(PathingLabels::FollowPath), - ) - .with_system( - repel_bounds - .run_in_state(GameState::Playing) - .label(RepulsionLables::RepelBounds) - .after(PathingLabels::FollowPath), - ) - .with_system( - apply - .run_in_state(GameState::Playing) - .label(RepulsionLables::Apply) - .after(RepulsionLables::RepelStatic) - .after(RepulsionLables::RepelMovable) - .after(RepulsionLables::RepelBounds), - ), + .add_system( + add_desired_velocity:: + .in_base_set(GameSet::PreMovement) + .run_if(in_state(AppState::InGame)), + ) + .add_system( + repel_static + .in_base_set(GameSet::Movement) + .run_if(in_state(GameState::Playing)) + .in_set(RepulsionLables::RepelStatic) + .after(ObstaclesLables::UpdateNearby) + .after(PathingSet::FollowPath), + ) + .add_system( + repel_movable + .in_base_set(GameSet::Movement) + .run_if(in_state(GameState::Playing)) + .in_set(RepulsionLables::RepelMovable) + .after(ObstaclesLables::UpdateNearby) + .after(PathingSet::FollowPath), + ) + .add_system( + repel_bounds + .in_base_set(GameSet::Movement) + .run_if(in_state(GameState::Playing)) + .in_set(RepulsionLables::RepelBounds) + .after(PathingSet::FollowPath), + ) + .add_system( + apply + .in_base_set(GameSet::Movement) + .run_if(in_state(GameState::Playing)) + .in_set(RepulsionLables::Apply) + .after(RepulsionLables::RepelStatic) + .after(RepulsionLables::RepelMovable) + .after(RepulsionLables::RepelBounds), ); } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] pub(crate) enum RepulsionLables { RepelStatic, RepelMovable, @@ -171,44 +172,46 @@ fn repel_static( )>, obstacles: Query<(&ObjectType, &Transform), With>, ) { - objects.par_for_each_mut(512, |(movement, disc, static_obstacles, mut repulsion)| { - if movement.stationary() { - return; - } - - for &entity in static_obstacles.entities() { - let (&object_type, transform) = obstacles.get(entity).unwrap(); + objects + .par_iter_mut() + .for_each_mut(|(movement, disc, static_obstacles, mut repulsion)| { + if movement.stationary() { + return; + } - let angle = transform.rotation.to_euler(EulerRot::YXZ).0; - let isometry = Isometry::new(transform.translation.to_flat().into(), angle); - let local_point = isometry.inverse_transform_point(&From::from(disc.center())); + for &entity in static_obstacles.entities() { + let (&object_type, transform) = obstacles.get(entity).unwrap(); - let footprint = cache.get_ichnography(object_type).convex_hull(); - let projection = footprint.project_local_point(&local_point, true); + let angle = transform.rotation.to_euler(EulerRot::YXZ).0; + let isometry = Isometry::new(transform.translation.to_flat().into(), angle); + let local_point = isometry.inverse_transform_point(&From::from(disc.center())); - let mut diff = projection.point - local_point; - let mut distance = diff.norm(); - if projection.is_inside { - diff *= -1.; - distance *= -1.; - } - distance -= disc.radius(); + let footprint = cache.get_ichnography(object_type).convex_hull(); + let projection = footprint.project_local_point(&local_point, true); - if distance > MAX_REPULSION_DISTANCE { - continue; - } + let mut diff = projection.point - local_point; + let mut distance = diff.norm(); + if projection.is_inside { + diff *= -1.; + distance *= -1.; + } + distance -= disc.radius(); - let direction = match Unit::try_new(diff, parry2d::math::DEFAULT_EPSILON) { - Some(direction) => { - let feature_id = footprint.support_feature_id_toward(&direction); - let local_normal = footprint.feature_normal(feature_id).unwrap(); - Vec2::from(isometry.transform_vector(&local_normal)) + if distance > MAX_REPULSION_DISTANCE { + continue; } - None => Vec2::X, - }; - repulsion.add(direction, distance - MIN_STATIC_OBJECT_DISTANCE); - } - }); + + let direction = match Unit::try_new(diff, parry2d::math::DEFAULT_EPSILON) { + Some(direction) => { + let feature_id = footprint.support_feature_id_toward(&direction); + let local_normal = footprint.feature_normal(feature_id).unwrap(); + Vec2::from(isometry.transform_vector(&local_normal)) + } + None => Vec2::X, + }; + repulsion.add(direction, distance - MIN_STATIC_OBJECT_DISTANCE); + } + }); } fn repel_movable( @@ -220,50 +223,54 @@ fn repel_movable( )>, obstacles: Query<&Disc>, ) { - objects.par_for_each_mut(512, |(movement, disc, movable_obstacles, mut repulsion)| { - if movement.stationary() { - return; - } + objects + .par_iter_mut() + .for_each_mut(|(movement, disc, movable_obstacles, mut repulsion)| { + if movement.stationary() { + return; + } - for &entity in movable_obstacles.entities() { - let other_disc = obstacles.get(entity).unwrap(); - let diff = other_disc.center() - disc.center(); - let mut distance = diff.length(); - let direction = if distance <= parry2d::math::DEFAULT_EPSILON { - Vec2::X - } else { - diff / distance - }; - distance -= disc.radius() + other_disc.radius(); - if distance < MAX_REPULSION_DISTANCE { - repulsion.add(direction, distance - MIN_MOVABLE_OBJECT_DISTANCE); + for &entity in movable_obstacles.entities() { + let other_disc = obstacles.get(entity).unwrap(); + let diff = other_disc.center() - disc.center(); + let mut distance = diff.length(); + let direction = if distance <= parry2d::math::DEFAULT_EPSILON { + Vec2::X + } else { + diff / distance + }; + distance -= disc.radius() + other_disc.radius(); + if distance < MAX_REPULSION_DISTANCE { + repulsion.add(direction, distance - MIN_MOVABLE_OBJECT_DISTANCE); + } } - } - }); + }); } fn repel_bounds( bounds: Res, mut objects: Query<(&DesiredVelocity, &Disc, &mut Repulsion)>, ) { - objects.par_for_each_mut(512, |(movement, disc, mut repulsion)| { - if movement.stationary() { - return; - } + objects + .par_iter_mut() + .for_each_mut(|(movement, disc, mut repulsion)| { + if movement.stationary() { + return; + } - let projection = bounds - .aabb() - .project_local_point(&From::from(disc.center()), false); - debug_assert!(projection.is_inside); + let projection = bounds + .aabb() + .project_local_point(&From::from(disc.center()), false); + debug_assert!(projection.is_inside); - let diff = Vec2::from(projection.point) - disc.center(); - let diff_norm = diff.length(); - let distance = diff_norm - disc.radius(); + let diff = Vec2::from(projection.point) - disc.center(); + let diff_norm = diff.length(); + let distance = diff_norm - disc.radius(); - if distance < MAX_REPULSION_DISTANCE { - repulsion.add(diff / diff_norm, distance - EXCLUSION_OFFSET); - } - }); + if distance < MAX_REPULSION_DISTANCE { + repulsion.add(diff / diff_norm, distance - EXCLUSION_OFFSET); + } + }); } fn apply( @@ -273,8 +280,7 @@ fn apply( &mut DesiredVelocity, )>, ) { - objects.par_for_each_mut( - 512, + objects.par_iter_mut().for_each_mut( |(mut repulsion, path_velocity, mut repulsion_velocity)| { let velocity = repulsion.apply(path_velocity.velocity()); repulsion_velocity.update(velocity.clamp_length_max(MAX_H_SPEED)); diff --git a/crates/objects/Cargo.toml b/crates/objects/Cargo.toml index 7c27dc4c2..af6006df6 100644 --- a/crates/objects/Cargo.toml +++ b/crates/objects/Cargo.toml @@ -17,7 +17,6 @@ de_core.workspace = true # Other bevy.workspace = true -iyes_loopless.workspace = true iyes_progress.workspace = true glam.workspace = true parry2d.workspace = true diff --git a/crates/objects/src/cache.rs b/crates/objects/src/cache.rs index 7b3960e9a..b1b3c397e 100644 --- a/crates/objects/src/cache.rs +++ b/crates/objects/src/cache.rs @@ -10,7 +10,6 @@ use de_core::{ state::AppState, }; use enum_map::{enum_map, EnumMap}; -use iyes_loopless::prelude::*; use iyes_progress::prelude::*; use crate::{ @@ -25,12 +24,12 @@ impl Plugin for CachePlugin { fn build(&self, app: &mut App) { app.add_asset::() .add_asset_loader(ObjectLoader) - .add_enter_system(AppState::InGame, setup) - .add_exit_system(AppState::InGame, cleanup) + .add_system(setup.in_schedule(OnEnter(AppState::InGame))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) .add_system( check_status .track_progress() - .run_in_state(GameState::Loading), + .run_if(in_state(GameState::Loading)), ); } } diff --git a/crates/pathing/Cargo.toml b/crates/pathing/Cargo.toml index c6c0ca112..5852811dc 100644 --- a/crates/pathing/Cargo.toml +++ b/crates/pathing/Cargo.toml @@ -26,7 +26,6 @@ ahash.workspace = true approx.workspace = true rstar.workspace = true tinyvec.workspace = true -iyes_loopless.workspace = true spade.workspace = true futures-lite.workspace = true diff --git a/crates/pathing/src/fplugin.rs b/crates/pathing/src/fplugin.rs index 9f82a191e..a883f1b2b 100644 --- a/crates/pathing/src/fplugin.rs +++ b/crates/pathing/src/fplugin.rs @@ -5,15 +5,14 @@ use bevy::{ tasks::{AsyncComputeTaskPool, Task}, }; use de_core::{ + baseset::GameSet, gamestate::GameState, objects::{ObjectType, StaticSolid}, - stages::GameStage, state::AppState, }; use de_map::size::MapBounds; use de_objects::{IchnographyCache, ObjectCache}; use futures_lite::future; -use iyes_loopless::prelude::*; use crate::{exclusion::ExclusionArea, finder::PathFinder, triangulation::triangulate}; @@ -43,39 +42,39 @@ pub struct FinderPlugin; impl Plugin for FinderPlugin { fn build(&self, app: &mut App) { app.add_event::() - .add_enter_system(AppState::InGame, setup_loading) - .add_enter_system(GameState::Playing, setup_playing) - .add_exit_system(AppState::InGame, cleanup) - .add_system_to_stage( - GameStage::PostUpdate, + .add_system(setup_loading.in_schedule(OnEnter(AppState::InGame))) + .add_system(setup_playing.in_schedule(OnEnter(GameState::Playing))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) + .add_system( check_removed - .run_in_state(AppState::InGame) - .label(FinderLabel::CheckRemoved), + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(AppState::InGame)) + .in_set(FinderSet::CheckRemoved), ) - .add_system_to_stage( - GameStage::PostUpdate, + .add_system( check_updated - .run_in_state(GameState::Playing) - .label(FinderLabel::CheckUpdated), + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(GameState::Playing)) + .in_set(FinderSet::CheckUpdated), ) - .add_system_to_stage( - GameStage::PostUpdate, + .add_system( update - .run_in_state(GameState::Playing) - .after(FinderLabel::CheckUpdated) - .after(FinderLabel::CheckRemoved), + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(GameState::Playing)) + .after(FinderSet::CheckUpdated) + .after(FinderSet::CheckRemoved), ) - .add_system_to_stage( - GameStage::PreMovement, + .add_system( check_update_result - .run_in_state(GameState::Playing) - .label(FinderLabel::UpdateFinder), + .in_base_set(GameSet::PreMovement) + .run_if(in_state(GameState::Playing)) + .in_set(FinderSet::UpdateFinder), ); } } -#[derive(SystemLabel)] -pub(crate) enum FinderLabel { +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, SystemSet)] +pub(crate) enum FinderSet { UpdateFinder, CheckRemoved, CheckUpdated, @@ -173,7 +172,10 @@ fn cleanup(mut commands: Commands) { commands.remove_resource::(); } -fn check_removed(mut state: ResMut, removed: RemovedComponents) { +fn check_removed( + mut state: ResMut, + mut removed: RemovedComponents, +) { if removed.iter().next().is_some() { state.invalidate(); } diff --git a/crates/pathing/src/pplugin.rs b/crates/pathing/src/pplugin.rs index d8e9bbb9e..72d97eae4 100644 --- a/crates/pathing/src/pplugin.rs +++ b/crates/pathing/src/pplugin.rs @@ -4,14 +4,13 @@ use bevy::{ tasks::{AsyncComputeTaskPool, Task}, }; use de_core::{ - gamestate::GameState, objects::MovableSolid, projection::ToFlat, stages::GameStage, + baseset::GameSet, gamestate::GameState, objects::MovableSolid, projection::ToFlat, state::AppState, }; use futures_lite::future; -use iyes_loopless::prelude::*; use crate::{ - fplugin::{FinderLabel, FinderRes, PathFinderUpdated}, + fplugin::{FinderRes, FinderSet, PathFinderUpdated}, path::{Path, ScheduledPath}, PathQueryProps, PathTarget, }; @@ -35,49 +34,50 @@ pub struct PathingPlugin; impl Plugin for PathingPlugin { fn build(&self, app: &mut App) { app.add_event::() - .add_enter_system(AppState::InGame, setup) - .add_exit_system(AppState::InGame, cleanup) - .add_system_to_stage( - GameStage::PreMovement, + .add_system(setup.in_schedule(OnEnter(AppState::InGame))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) + .add_system( update_existing_paths - .run_in_state(GameState::Playing) - .label(PathingLabel::UpdateExistingPaths) - .after(FinderLabel::UpdateFinder), + .in_base_set(GameSet::PreMovement) + .run_if(in_state(GameState::Playing)) + .in_set(PathingSet::UpdateExistingPaths) + .after(FinderSet::UpdateFinder), ) - .add_system_to_stage( - GameStage::PreMovement, + .add_system( update_requested_paths - .run_in_state(GameState::Playing) - .label(PathingLabel::UpdateRequestedPaths) - .after(PathingLabel::UpdateExistingPaths), + .in_base_set(GameSet::PreMovement) + .run_if(in_state(GameState::Playing)) + .in_set(PathingSet::UpdateRequestedPaths) + .after(PathingSet::UpdateExistingPaths), ) - .add_system_to_stage( - GameStage::PreMovement, + .add_system( check_path_results - .run_in_state(GameState::Playing) + .in_base_set(GameSet::PreMovement) + .run_if(in_state(GameState::Playing)) // This is needed to avoid race condition in PathTarget // removal which would happen if path was not-found before // this system is run. - .before(PathingLabel::UpdateRequestedPaths) + .before(PathingSet::UpdateRequestedPaths) // This system removes finished tasks from UpdatePathsState // and inserts Scheduledpath components. When this happen, // the tasks is no longer available however the component // is not available as well until the end of the stage. // - // System PathingLabel::UpdateExistingPaths needs to detect + // System PathingSet::UpdateExistingPaths needs to detect // that a path is either already scheduled or being // computed. Thus this system must run after it. - .after(PathingLabel::UpdateExistingPaths), + .after(PathingSet::UpdateExistingPaths), ) - .add_system_to_stage( - GameStage::PostMovement, - remove_path_targets.run_in_state(AppState::InGame), + .add_system( + remove_path_targets + .in_base_set(GameSet::PostMovement) + .run_if(in_state(AppState::InGame)), ); } } -#[derive(SystemLabel)] -enum PathingLabel { +#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, SystemSet)] +enum PathingSet { UpdateRequestedPaths, UpdateExistingPaths, } @@ -250,7 +250,7 @@ fn check_path_results( fn remove_path_targets( mut commands: Commands, targets: Query<&PathTarget>, - removed: RemovedComponents, + mut removed: RemovedComponents, ) { for entity in removed.iter() { if let Ok(target) = targets.get(entity) { diff --git a/crates/signs/Cargo.toml b/crates/signs/Cargo.toml index 02bec4301..7b9cb69c2 100644 --- a/crates/signs/Cargo.toml +++ b/crates/signs/Cargo.toml @@ -21,4 +21,3 @@ de_terrain.workspace = true # Other bevy.workspace = true glam.workspace = true -iyes_loopless.workspace = true diff --git a/crates/signs/src/bars.rs b/crates/signs/src/bars.rs index fcb80d510..c8dff7bb5 100644 --- a/crates/signs/src/bars.rs +++ b/crates/signs/src/bars.rs @@ -10,15 +10,14 @@ use bevy::{ }, }, }; -use de_camera::{CameraDistance, DistanceLabels}; +use de_camera::{CameraDistance, DistanceSet}; use de_core::{ + baseset::GameSet, objects::{Active, ObjectType}, - stages::GameStage, state::AppState, - visibility::{VisibilityFlags, VisibilityLabels}, + visibility::{VisibilityFlags, VisibilitySet}, }; use de_objects::{ColliderCache, ObjectCache}; -use iyes_loopless::prelude::*; use crate::{DISTANCE_FLAG_BIT, MAX_VISIBILITY_DISTANCE}; @@ -36,24 +35,30 @@ impl Plugin for BarsPlugin { app.add_plugin(MaterialPlugin::::default()) .add_event::() .add_event::() - .add_enter_system(AppState::InGame, setup) - .add_exit_system(AppState::InGame, cleanup) - .add_system_set_to_stage( - GameStage::PostUpdate, - SystemSet::new() - .with_system(spawn.run_in_state(AppState::InGame)) - .with_system(update_value.run_in_state(AppState::InGame)) - .with_system( - update_visibility_events - .run_in_state(AppState::InGame) - .before(VisibilityLabels::Update), - ) - .with_system( - update_visibility_distance - .run_in_state(AppState::InGame) - .before(VisibilityLabels::Update) - .after(DistanceLabels::Update), - ), + .add_system(setup.in_schedule(OnEnter(AppState::InGame))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) + .add_system( + spawn + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(AppState::InGame)), + ) + .add_system( + update_value + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(AppState::InGame)), + ) + .add_system( + update_visibility_events + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(AppState::InGame)) + .before(VisibilitySet::Update), + ) + .add_system( + update_visibility_distance + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(AppState::InGame)) + .before(VisibilitySet::Update) + .after(DistanceSet::Update), ); } } @@ -211,7 +216,7 @@ fn spawn( mesh: mesh.mesh(), material, transform, - visibility: Visibility { is_visible: false }, + visibility: Visibility::Hidden, ..Default::default() }, NotShadowCaster, diff --git a/crates/signs/src/markers.rs b/crates/signs/src/markers.rs index 4e2cb0a06..9c5fba15d 100644 --- a/crates/signs/src/markers.rs +++ b/crates/signs/src/markers.rs @@ -1,8 +1,7 @@ use bevy::prelude::*; -use de_camera::{CameraDistance, DistanceLabels}; -use de_core::{stages::GameStage, state::AppState}; +use de_camera::{CameraDistance, DistanceSet}; +use de_core::{baseset::GameSet, state::AppState}; use de_terrain::CircleMarker; -use iyes_loopless::prelude::*; use crate::{DISTANCE_FLAG_BIT, MAX_VISIBILITY_DISTANCE}; @@ -10,11 +9,11 @@ pub(crate) struct MarkersPlugin; impl Plugin for MarkersPlugin { fn build(&self, app: &mut App) { - app.add_system_to_stage( - GameStage::PostUpdate, + app.add_system( update_distance - .run_in_state(AppState::InGame) - .after(DistanceLabels::Update), + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(AppState::InGame)) + .after(DistanceSet::Update), ); } } diff --git a/crates/spawner/Cargo.toml b/crates/spawner/Cargo.toml index 4a991c447..8c33c9ec4 100644 --- a/crates/spawner/Cargo.toml +++ b/crates/spawner/Cargo.toml @@ -22,6 +22,5 @@ de_terrain.workspace = true # Other ahash.workspace = true bevy.workspace = true -iyes_loopless.workspace = true parry2d.workspace = true parry3d.workspace = true diff --git a/crates/spawner/src/counter.rs b/crates/spawner/src/counter.rs index 82bdad2d9..3205f7d87 100644 --- a/crates/spawner/src/counter.rs +++ b/crates/spawner/src/counter.rs @@ -8,14 +8,13 @@ use de_core::{ player::{Player, PlayerRange}, state::AppState, }; -use iyes_loopless::prelude::*; pub(crate) struct CounterPlugin; impl Plugin for CounterPlugin { fn build(&self, app: &mut App) { - app.add_enter_system(AppState::InGame, setup) - .add_exit_system(AppState::InGame, cleanup); + app.add_system(setup.in_schedule(OnEnter(AppState::InGame))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))); } } diff --git a/crates/spawner/src/destroyer.rs b/crates/spawner/src/destroyer.rs index 660f97880..af45fa18f 100644 --- a/crates/spawner/src/destroyer.rs +++ b/crates/spawner/src/destroyer.rs @@ -1,19 +1,18 @@ use bevy::prelude::*; -use de_core::{objects::ObjectType, player::Player, stages::GameStage, state::AppState}; +use de_core::{baseset::GameSet, objects::ObjectType, player::Player, state::AppState}; use de_objects::Health; -use iyes_loopless::prelude::*; -use crate::{ObjectCounter, SpawnerLabels}; +use crate::{ObjectCounter, SpawnerSet}; pub(crate) struct DestroyerPlugin; impl Plugin for DestroyerPlugin { fn build(&self, app: &mut App) { - app.add_system_to_stage( - GameStage::Update, + app.add_system( destroy - .run_in_state(AppState::InGame) - .label(SpawnerLabels::Destroyer), + .in_base_set(GameSet::Update) + .run_if(in_state(AppState::InGame)) + .in_set(SpawnerSet::Destroyer), ); } } diff --git a/crates/spawner/src/draft.rs b/crates/spawner/src/draft.rs index c0590e036..cd6af616b 100644 --- a/crates/spawner/src/draft.rs +++ b/crates/spawner/src/draft.rs @@ -7,16 +7,15 @@ use bevy::prelude::*; use bevy::scene::SceneInstance; use de_core::{ + baseset::GameSet, gamestate::GameState, objects::{ActiveObjectType, BuildingType, MovableSolid, ObjectType, StaticSolid}, projection::ToFlat, - stages::GameStage, state::AppState, }; -use de_index::{ColliderWithCache, IndexLabel, QueryCollider, SpatialQuery}; +use de_index::{ColliderWithCache, IndexSet, QueryCollider, SpatialQuery}; use de_map::size::MapBounds; use de_objects::{ColliderCache, ObjectCache, EXCLUSION_OFFSET}; -use iyes_loopless::prelude::*; use parry2d::{ bounding_volume::{Aabb, BoundingVolume}, math::Vector, @@ -33,29 +32,30 @@ pub(crate) struct DraftPlugin; impl Plugin for DraftPlugin { fn build(&self, app: &mut App) { - app.add_enter_system(AppState::InGame, insert_materials) - .add_exit_system(AppState::InGame, cleanup) - .add_system_to_stage( - GameStage::Update, - new_draft.run_in_state(GameState::Playing), + app.add_system(insert_materials.in_schedule(OnEnter(AppState::InGame))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) + .add_system( + new_draft + .in_base_set(GameSet::Update) + .run_if(in_state(GameState::Playing)), ) - .add_system_to_stage( - GameStage::PostUpdate, + .add_system( update_draft - .run_in_state(GameState::Playing) - .after(IndexLabel::Index), + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(GameState::Playing)) + .after(IndexSet::Index), ) - .add_system_to_stage( - GameStage::PostUpdate, + .add_system( check_draft_loaded - .run_in_state(GameState::Playing) - .after(IndexLabel::Index), + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(GameState::Playing)) + .after(IndexSet::Index), ) - .add_system_to_stage( - GameStage::PostUpdate, + .add_system( update_draft_colour - .run_in_state(GameState::Playing) - .after(IndexLabel::Index), + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(GameState::Playing)) + .after(IndexSet::Index), ); } } @@ -77,8 +77,8 @@ impl DraftBundle { object_type: ObjectType::Active(ActiveObjectType::Building(building_type)), transform, global_transform: transform.into(), - visibility: Visibility::VISIBLE, - computed_visibility: ComputedVisibility::INVISIBLE, + visibility: Visibility::Inherited, + computed_visibility: ComputedVisibility::HIDDEN, draft: Draft::default(), } } diff --git a/crates/spawner/src/gameend.rs b/crates/spawner/src/gameend.rs index 261f48e29..e53290ed8 100644 --- a/crates/spawner/src/gameend.rs +++ b/crates/spawner/src/gameend.rs @@ -1,9 +1,8 @@ use bevy::prelude::*; use de_core::{ - gamestate::GameState, gconfig::GameConfig, gresult::GameResult, stages::GameStage, + baseset::GameSet, gamestate::GameState, gconfig::GameConfig, gresult::GameResult, state::AppState, }; -use iyes_loopless::prelude::*; use crate::ObjectCounter; @@ -11,15 +10,17 @@ pub(crate) struct GameEndPlugin; impl Plugin for GameEndPlugin { fn build(&self, app: &mut App) { - app.add_system_to_stage( - GameStage::PostUpdate, - game_end_detection_system.run_in_state(GameState::Playing), + app.add_system( + game_end_detection_system + .in_base_set(GameSet::PostUpdate) + .run_if(in_state(GameState::Playing)), ); } } fn game_end_detection_system( mut commands: Commands, + mut next_state: ResMut>, conf: Res, counter: Res, ) { @@ -35,6 +36,6 @@ fn game_end_detection_system( if let Some(result) = result { commands.insert_resource(result); - commands.insert_resource(NextState(AppState::InMenu)); + next_state.set(AppState::InMenu); } } diff --git a/crates/spawner/src/lib.rs b/crates/spawner/src/lib.rs index 04b76db50..ec489c5f7 100644 --- a/crates/spawner/src/lib.rs +++ b/crates/spawner/src/lib.rs @@ -29,7 +29,7 @@ impl PluginGroup for SpawnerPluginGroup { } } -#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemLabel)] -pub enum SpawnerLabels { +#[derive(Copy, Clone, Hash, Debug, PartialEq, Eq, SystemSet)] +pub enum SpawnerSet { Destroyer, } diff --git a/crates/spawner/src/spawner.rs b/crates/spawner/src/spawner.rs index 77975c9b3..8d6cd18f9 100644 --- a/crates/spawner/src/spawner.rs +++ b/crates/spawner/src/spawner.rs @@ -2,15 +2,14 @@ use bevy::prelude::*; use de_core::{ + baseset::GameSet, gamestate::GameState, gconfig::GameConfig, objects::{Active, ActiveObjectType, MovableSolid, ObjectType, Playable, StaticSolid}, player::Player, - stages::GameStage, }; use de_objects::{IchnographyCache, InitialHealths, ObjectCache}; use de_terrain::CircleMarker; -use iyes_loopless::prelude::*; use crate::ObjectCounter; @@ -18,7 +17,11 @@ pub(crate) struct SpawnerPlugin; impl Plugin for SpawnerPlugin { fn build(&self, app: &mut App) { - app.add_system_to_stage(GameStage::Update, spawn.run_in_state(GameState::Playing)); + app.add_system( + spawn + .in_base_set(GameSet::Update) + .run_if(in_state(GameState::Playing)), + ); } } @@ -38,8 +41,8 @@ impl SpawnBundle { object_type, transform, global_transform: transform.into(), - visibility: Visibility::VISIBLE, - computed_visibility: ComputedVisibility::INVISIBLE, + visibility: Visibility::Inherited, + computed_visibility: ComputedVisibility::HIDDEN, spawn: Spawn, } } diff --git a/crates/terrain/Cargo.toml b/crates/terrain/Cargo.toml index 0f54f7b69..7f4c6336c 100644 --- a/crates/terrain/Cargo.toml +++ b/crates/terrain/Cargo.toml @@ -19,7 +19,6 @@ de_objects.workspace = true # Other bevy.workspace = true -iyes_loopless.workspace = true iyes_progress.workspace = true glam.workspace = true parry3d.workspace = true diff --git a/crates/terrain/src/collider.rs b/crates/terrain/src/collider.rs index 9d4613e18..1cfe883fd 100644 --- a/crates/terrain/src/collider.rs +++ b/crates/terrain/src/collider.rs @@ -99,12 +99,12 @@ mod test { #[derive(Resource)] struct Vec3Wrap(Vec3); - let mut world = World::default(); + let mut app = App::new(); - world + app.world .spawn(TerrainBundle::flat(MapBounds::new(Vec2::new(100., 200.)))) .insert(Transform::from_translation(10000. * Vec3::ONE)); - world + app.world .spawn(TerrainBundle::flat(MapBounds::new(Vec2::new(100., 200.)))) .insert(Transform::from_xyz(-17., 3.2, -22.)); @@ -114,11 +114,11 @@ mod test { commands.insert_resource(Vec3Wrap(Vec3::from(ray.point_at(intersection.toi)))); } - let mut stage = SystemStage::parallel(); - stage.add_system(help_system); - stage.run(&mut world); + app.add_system(help_system); - let intersection = world.get_resource::().unwrap(); + app.update(); + + let intersection = app.world.get_resource::().unwrap(); assert!(Vec3::new(13.6, 3.2, 6.8).distance(intersection.0) < 0.00001); } } diff --git a/crates/terrain/src/marker.rs b/crates/terrain/src/marker.rs index c74d9842e..4f3d86997 100644 --- a/crates/terrain/src/marker.rs +++ b/crates/terrain/src/marker.rs @@ -12,7 +12,6 @@ use de_core::{ }; use de_objects::{ColliderCache, ObjectCache}; use glam::Vec3A; -use iyes_loopless::prelude::*; use crate::shader::{Circle, TerrainMaterial, CIRCLE_CAPACITY}; @@ -20,10 +19,10 @@ pub(crate) struct MarkerPlugin; impl Plugin for MarkerPlugin { fn build(&self, app: &mut App) { - app.add_system_to_stage( - CoreStage::PostUpdate, + app.add_system( update_markers - .run_in_state(GameState::Playing) + .in_base_set(CoreSet::PostUpdate) + .run_if(in_state(GameState::Playing)) .after(VisibilitySystems::CheckVisibility), ); } diff --git a/crates/terrain/src/plugin.rs b/crates/terrain/src/plugin.rs index 1ca668661..b9c528ab6 100644 --- a/crates/terrain/src/plugin.rs +++ b/crates/terrain/src/plugin.rs @@ -6,8 +6,7 @@ use bevy::{ texture::ImageSampler, }, }; -use de_core::{gamestate::GameState, stages::GameStage, state::AppState}; -use iyes_loopless::prelude::*; +use de_core::{baseset::GameSet, gamestate::GameState, state::AppState}; use iyes_progress::prelude::*; use crate::{shader::TerrainMaterial, terrain::Terrain}; @@ -19,14 +18,18 @@ pub(crate) struct TerrainPlugin; impl Plugin for TerrainPlugin { fn build(&self, app: &mut App) { app.add_plugin(MaterialPlugin::::default()) - .add_enter_system(AppState::InGame, load) - .add_exit_system(AppState::InGame, cleanup) + .add_system(load.in_schedule(OnEnter(AppState::InGame))) + .add_system(cleanup.in_schedule(OnExit(AppState::InGame))) .add_system( setup_textures .track_progress() - .run_in_state(GameState::Loading), + .in_base_set(GameSet::Update) + .run_if(in_state(GameState::Loading)), ) - .add_system_to_stage(GameStage::Update, init.run_in_state(AppState::InGame)); + .add_system( + init.in_base_set(GameSet::Update) + .run_if(in_state(AppState::InGame)), + ); } } diff --git a/src/main.rs b/src/main.rs index 7f24e3db1..85b39f909 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,5 +1,5 @@ #[cfg(not(target_os = "macos"))] -use bevy::window::CursorGrabMode; +use bevy::window::{CursorGrabMode, PrimaryWindow}; use bevy::{ diagnostic::{FrameTimeDiagnosticsPlugin, LogDiagnosticsPlugin}, prelude::*, @@ -22,20 +22,19 @@ use de_pathing::PathingPluginGroup; use de_signs::SignsPluginGroup; use de_spawner::SpawnerPluginGroup; use de_terrain::TerrainPluginGroup; -use iyes_loopless::prelude::*; const CARGO_PKG_VERSION: &str = env!("CARGO_PKG_VERSION"); const GIT_SHA: &str = env!("GIT_SHA"); fn main() { let mut app = App::new(); - app.insert_resource(Msaa { samples: 4 }) + app.insert_resource(Msaa::Sample4) .add_plugins(DefaultPlugins.set(WindowPlugin { - window: WindowDescriptor { + primary_window: Some(Window { title: "Digital Extinction".to_string(), mode: WindowMode::BorderlessFullscreen, ..Default::default() - }, + }), ..default() })) .add_plugin(LogDiagnosticsPlugin::default()) @@ -72,17 +71,17 @@ struct GamePlugin; impl Plugin for GamePlugin { fn build(&self, app: &mut App) { - app.add_loopless_state_before_stage(CoreStage::PreUpdate, AppState::AppLoading); + app.add_state::(); #[cfg(not(target_os = "macos"))] { - app.add_enter_system(AppState::AppLoading, cursor_grab_system); + app.add_system(cursor_grab_system.in_schedule(OnEnter(AppState::AppLoading))); } } } #[cfg(not(target_os = "macos"))] -fn cursor_grab_system(mut windows: ResMut) { - let window = windows.get_primary_mut().unwrap(); - window.set_cursor_grab_mode(CursorGrabMode::Confined); +fn cursor_grab_system(mut window_query: Query<&mut Window, With>) { + let mut window = window_query.single_mut(); + window.cursor.grab_mode = CursorGrabMode::Confined; }