diff --git a/.gitattributes b/.gitattributes index 975aef1..c0c4e47 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1 @@ -*.ktx filter=lfs diff=lfs merge=lfs -text -*.blend filter=lfs diff=lfs merge=lfs -text -*.ktx2 filter=lfs diff=lfs merge=lfs -text -*.wav filter=lfs diff=lfs merge=lfs -text +assets/ filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore index ea8c4bf..84d70ce 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +*.protobuf diff --git a/.woodpecker.yml b/.woodpecker.yml index e97fded..0019844 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -4,12 +4,7 @@ steps: commands: - apt-get -y update - apt-get -y install wayland-protocols wayland-utils libwayland-client0 libwayland-dev libasound2 libasound2-dev libudev-dev libudev1 - - wget https://github.com/mozilla/sccache/releases/download/v0.7.7/sccache-v0.7.7-x86_64-unknown-linux-musl.tar.gz - - tar xzf sccache-v0.7.7-x86_64-unknown-linux-musl.tar.gz - - mv sccache-v0.7.7-x86_64-unknown-linux-musl/sccache /usr/bin/sccache - - chmod +x /usr/bin/sccache - - sccache --start-server - - sccache --show-stats - cargo test --target-dir /var/woodpecker --features bevy/dynamic_linking + - cargo doc --target-dir /var/woodpecker --features bevy/dynamic_linking volumes: - /var/woodpecker:/var/woodpecker diff --git a/Cargo.lock b/Cargo.lock index 7bb3476..6bb2818 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3071,6 +3071,15 @@ dependencies = [ "byteorder", ] +[[package]] +name = "hash32" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d60b12902ba28e2730cd37e95b8c9223af2808df9e902d4df49588d1470606" +dependencies = [ + "byteorder", +] + [[package]] name = "hashbrown" version = "0.14.3" @@ -3104,13 +3113,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cdc6457c0eb62c71aac4bc17216026d8410337c4126773b9c5daba343f17964f" dependencies = [ "atomic-polyfill", - "hash32", + "hash32 0.2.1", "rustc_version", "serde", "spin 0.9.8", "stable_deref_trait", ] +[[package]] +name = "heapless" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bfb9eb618601c89945a70e254898da93b13be0388091d42117462b265bb3fad" +dependencies = [ + "hash32 0.3.1", + "stable_deref_trait", +] + [[package]] name = "heck" version = "0.4.1" @@ -4943,6 +4962,7 @@ dependencies = [ "flume", "futures", "futures-timer", + "heapless 0.8.0", "keyframe", "libp2p", "postcard", @@ -5014,7 +5034,7 @@ checksum = "a55c51ee6c0db07e68448e336cf8ea4131a620edefebf9893e759b2d793420f8" dependencies = [ "cobs", "embedded-io", - "heapless", + "heapless 0.7.17", "serde", ] diff --git a/Cargo.toml b/Cargo.toml index b8cb897..53d9ccc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ bevy_egui = { version = "0.25.0", features = ["manage_clipboard"] } flume = "0.11.0" futures = "0.3.30" futures-timer = "3.0.2" +heapless = "0.8.0" keyframe = { version = "1.1.1", default-features = false } libp2p = { version = "0.53.2", features = ["async-std", "dns", "dcutr", "identify", "macros", "noise", "ping", "relay", "rendezvous", "tcp", "yamux", "gossipsub"] } postcard = { version = "1.0.8", features = ["use-std"] } diff --git a/assets/logo.ktx2 b/assets/logo.ktx2 index a44afaf..b7205c3 100644 Binary files a/assets/logo.ktx2 and b/assets/logo.ktx2 differ diff --git a/assets/logo_bw.ktx2 b/assets/logo_bw.ktx2 index a33ac44..71ffaf6 100644 Binary files a/assets/logo_bw.ktx2 and b/assets/logo_bw.ktx2 differ diff --git a/assets/plane_map.ktx2 b/assets/plane_map.ktx2 new file mode 100644 index 0000000..0d5cbd1 Binary files /dev/null and b/assets/plane_map.ktx2 differ diff --git a/assets/scene.glb b/assets/scene.glb new file mode 100644 index 0000000..87c3faa Binary files /dev/null and b/assets/scene.glb differ diff --git a/assets/sounds/balloon_explosion0.wav b/assets/sounds/balloon_explosion0.wav index 430d5a2..f36757f 100644 Binary files a/assets/sounds/balloon_explosion0.wav and b/assets/sounds/balloon_explosion0.wav differ diff --git a/assets/sounds/balloon_explosion1.wav b/assets/sounds/balloon_explosion1.wav index 7f5d4dd..44d16cd 100644 Binary files a/assets/sounds/balloon_explosion1.wav and b/assets/sounds/balloon_explosion1.wav differ diff --git a/assets/sounds/balloon_explosion2.wav b/assets/sounds/balloon_explosion2.wav index 7c307b7..70d5742 100644 Binary files a/assets/sounds/balloon_explosion2.wav and b/assets/sounds/balloon_explosion2.wav differ diff --git a/assets/sounds/baloon_explosion_nuke.wav b/assets/sounds/baloon_explosion_nuke.wav index 77b7b52..22a21a1 100644 Binary files a/assets/sounds/baloon_explosion_nuke.wav and b/assets/sounds/baloon_explosion_nuke.wav differ diff --git a/assets/sounds/bell.wav b/assets/sounds/bell.wav index 1937cde..80e32c0 100644 Binary files a/assets/sounds/bell.wav and b/assets/sounds/bell.wav differ diff --git a/assets/sounds/cannon_fire.wav b/assets/sounds/cannon_fire.wav index a37f5ec..88fdcfb 100644 Binary files a/assets/sounds/cannon_fire.wav and b/assets/sounds/cannon_fire.wav differ diff --git a/assets/sounds/cashier.wav b/assets/sounds/cashier.wav index 232752b..ecd4c94 100644 Binary files a/assets/sounds/cashier.wav and b/assets/sounds/cashier.wav differ diff --git a/assets/sounds/chest_breaking.wav b/assets/sounds/chest_breaking.wav index 6adb0ff..ad7c7c2 100644 Binary files a/assets/sounds/chest_breaking.wav and b/assets/sounds/chest_breaking.wav differ diff --git a/assets/sounds/chest_poof.wav b/assets/sounds/chest_poof.wav index 5a34d0e..1bc2f33 100644 Binary files a/assets/sounds/chest_poof.wav and b/assets/sounds/chest_poof.wav differ diff --git a/assets/sounds/chime_loop.wav b/assets/sounds/chime_loop.wav index 67613b1..61a3058 100644 Binary files a/assets/sounds/chime_loop.wav and b/assets/sounds/chime_loop.wav differ diff --git a/assets/sounds/click_end.wav b/assets/sounds/click_end.wav index a0ef997..9f2a3c5 100644 Binary files a/assets/sounds/click_end.wav and b/assets/sounds/click_end.wav differ diff --git a/assets/sounds/click_start.wav b/assets/sounds/click_start.wav index 3c04765..628971d 100644 Binary files a/assets/sounds/click_start.wav and b/assets/sounds/click_start.wav differ diff --git a/assets/sounds/cloth.wav b/assets/sounds/cloth.wav index 16e293e..11fdaf7 100644 Binary files a/assets/sounds/cloth.wav and b/assets/sounds/cloth.wav differ diff --git a/assets/sounds/coins_counting.wav b/assets/sounds/coins_counting.wav index 7a65647..357d089 100644 Binary files a/assets/sounds/coins_counting.wav and b/assets/sounds/coins_counting.wav differ diff --git a/assets/sounds/coins_thief.wav b/assets/sounds/coins_thief.wav index 24a26fa..83be47d 100644 Binary files a/assets/sounds/coins_thief.wav and b/assets/sounds/coins_thief.wav differ diff --git a/assets/sounds/combo.wav b/assets/sounds/combo.wav index b11ccaf..4e54d85 100644 Binary files a/assets/sounds/combo.wav and b/assets/sounds/combo.wav differ diff --git a/assets/sounds/combo_sound.wav b/assets/sounds/combo_sound.wav index 1c663f9..11bd5c2 100644 Binary files a/assets/sounds/combo_sound.wav and b/assets/sounds/combo_sound.wav differ diff --git a/assets/sounds/crack.wav b/assets/sounds/crack.wav index f9f603a..6267d65 100644 Binary files a/assets/sounds/crack.wav and b/assets/sounds/crack.wav differ diff --git a/assets/sounds/dargon_crack.wav b/assets/sounds/dargon_crack.wav index 06e9629..10fdc81 100644 Binary files a/assets/sounds/dargon_crack.wav and b/assets/sounds/dargon_crack.wav differ diff --git a/assets/sounds/dark_knight0.wav b/assets/sounds/dark_knight0.wav index d15da2b..be0f17f 100644 Binary files a/assets/sounds/dark_knight0.wav and b/assets/sounds/dark_knight0.wav differ diff --git a/assets/sounds/dragon_roar.wav b/assets/sounds/dragon_roar.wav index d453e99..8c993ae 100644 Binary files a/assets/sounds/dragon_roar.wav and b/assets/sounds/dragon_roar.wav differ diff --git a/assets/sounds/drawing_sound.wav b/assets/sounds/drawing_sound.wav index 76e3b87..deed34c 100644 Binary files a/assets/sounds/drawing_sound.wav and b/assets/sounds/drawing_sound.wav differ diff --git a/assets/sounds/explosion.wav b/assets/sounds/explosion.wav index d3f20af..5cae780 100644 Binary files a/assets/sounds/explosion.wav and b/assets/sounds/explosion.wav differ diff --git a/assets/sounds/fast_spell.wav b/assets/sounds/fast_spell.wav index a70fc8d..7ac498a 100644 Binary files a/assets/sounds/fast_spell.wav and b/assets/sounds/fast_spell.wav differ diff --git a/assets/sounds/fire.wav b/assets/sounds/fire.wav index 74838db..8f6e738 100644 Binary files a/assets/sounds/fire.wav and b/assets/sounds/fire.wav differ diff --git a/assets/sounds/fire2.wav b/assets/sounds/fire2.wav index 8ab390c..09157eb 100644 Binary files a/assets/sounds/fire2.wav and b/assets/sounds/fire2.wav differ diff --git a/assets/sounds/fire_ignite.wav b/assets/sounds/fire_ignite.wav index 43889ab..fb5d8c2 100644 Binary files a/assets/sounds/fire_ignite.wav and b/assets/sounds/fire_ignite.wav differ diff --git a/assets/sounds/fireball.wav b/assets/sounds/fireball.wav index ff28bc9..25af9d6 100644 Binary files a/assets/sounds/fireball.wav and b/assets/sounds/fireball.wav differ diff --git a/assets/sounds/flap.wav b/assets/sounds/flap.wav index 05863ae..7bf7d57 100644 Binary files a/assets/sounds/flap.wav and b/assets/sounds/flap.wav differ diff --git a/assets/sounds/flash.wav b/assets/sounds/flash.wav index 59ebc30..a9a9c2d 100644 Binary files a/assets/sounds/flash.wav and b/assets/sounds/flash.wav differ diff --git a/assets/sounds/frog1.wav b/assets/sounds/frog1.wav index d342a55..e1ac755 100644 Binary files a/assets/sounds/frog1.wav and b/assets/sounds/frog1.wav differ diff --git a/assets/sounds/frog2.wav b/assets/sounds/frog2.wav index c5bd735..dbebe87 100644 Binary files a/assets/sounds/frog2.wav and b/assets/sounds/frog2.wav differ diff --git a/assets/sounds/golden_knight_grunt0.wav b/assets/sounds/golden_knight_grunt0.wav index 57a9aa6..edce682 100644 Binary files a/assets/sounds/golden_knight_grunt0.wav and b/assets/sounds/golden_knight_grunt0.wav differ diff --git a/assets/sounds/golden_knight_grunt1.wav b/assets/sounds/golden_knight_grunt1.wav index 1544ada..3a18b53 100644 Binary files a/assets/sounds/golden_knight_grunt1.wav and b/assets/sounds/golden_knight_grunt1.wav differ diff --git a/assets/sounds/hat_on.wav b/assets/sounds/hat_on.wav index 9a7496a..2f5e767 100644 Binary files a/assets/sounds/hat_on.wav and b/assets/sounds/hat_on.wav differ diff --git a/assets/sounds/impact.wav b/assets/sounds/impact.wav index fcc92ae..9fc9c27 100644 Binary files a/assets/sounds/impact.wav and b/assets/sounds/impact.wav differ diff --git a/assets/sounds/impact2.wav b/assets/sounds/impact2.wav index fa88c66..c071e29 100644 Binary files a/assets/sounds/impact2.wav and b/assets/sounds/impact2.wav differ diff --git a/assets/sounds/impact3.wav b/assets/sounds/impact3.wav index d2ed26b..ab32b5f 100644 Binary files a/assets/sounds/impact3.wav and b/assets/sounds/impact3.wav differ diff --git a/assets/sounds/impact4.wav b/assets/sounds/impact4.wav index cdd07f6..41835cd 100644 Binary files a/assets/sounds/impact4.wav and b/assets/sounds/impact4.wav differ diff --git a/assets/sounds/impact5.wav b/assets/sounds/impact5.wav index b309e78..432abcb 100644 Binary files a/assets/sounds/impact5.wav and b/assets/sounds/impact5.wav differ diff --git a/assets/sounds/king_laugh.wav b/assets/sounds/king_laugh.wav index 4ab3b4e..775756a 100644 Binary files a/assets/sounds/king_laugh.wav and b/assets/sounds/king_laugh.wav differ diff --git a/assets/sounds/king_surprise.wav b/assets/sounds/king_surprise.wav index 9a37432..9e74e04 100644 Binary files a/assets/sounds/king_surprise.wav and b/assets/sounds/king_surprise.wav differ diff --git a/assets/sounds/knight_cheer.wav b/assets/sounds/knight_cheer.wav index f8a8795..5b89286 100644 Binary files a/assets/sounds/knight_cheer.wav and b/assets/sounds/knight_cheer.wav differ diff --git a/assets/sounds/knight_landed.wav b/assets/sounds/knight_landed.wav index 696a05d..8a9bf63 100644 Binary files a/assets/sounds/knight_landed.wav and b/assets/sounds/knight_landed.wav differ diff --git a/assets/sounds/knight_landed2.wav b/assets/sounds/knight_landed2.wav index 47ca2cd..672cd3f 100644 Binary files a/assets/sounds/knight_landed2.wav and b/assets/sounds/knight_landed2.wav differ diff --git a/assets/sounds/knight_surprise.wav b/assets/sounds/knight_surprise.wav index f6732a8..68ae839 100644 Binary files a/assets/sounds/knight_surprise.wav and b/assets/sounds/knight_surprise.wav differ diff --git a/assets/sounds/knight_surprise0.wav b/assets/sounds/knight_surprise0.wav index b3b0b7c..532b3c4 100644 Binary files a/assets/sounds/knight_surprise0.wav and b/assets/sounds/knight_surprise0.wav differ diff --git a/assets/sounds/knight_surprise1.wav b/assets/sounds/knight_surprise1.wav index 4752941..f0b564c 100644 Binary files a/assets/sounds/knight_surprise1.wav and b/assets/sounds/knight_surprise1.wav differ diff --git a/assets/sounds/knight_surprise2.wav b/assets/sounds/knight_surprise2.wav index c06fa6e..2aabb8f 100644 Binary files a/assets/sounds/knight_surprise2.wav and b/assets/sounds/knight_surprise2.wav differ diff --git a/assets/sounds/knigth_smash.wav b/assets/sounds/knigth_smash.wav index 10af18e..82ad726 100644 Binary files a/assets/sounds/knigth_smash.wav and b/assets/sounds/knigth_smash.wav differ diff --git a/assets/sounds/magic_chime_title.wav b/assets/sounds/magic_chime_title.wav index 27925b7..a80c6b7 100644 Binary files a/assets/sounds/magic_chime_title.wav and b/assets/sounds/magic_chime_title.wav differ diff --git a/assets/sounds/menu_down.wav b/assets/sounds/menu_down.wav index e5da209..3463f37 100644 Binary files a/assets/sounds/menu_down.wav and b/assets/sounds/menu_down.wav differ diff --git a/assets/sounds/new_best_score.wav b/assets/sounds/new_best_score.wav index 0d70385..4bf3e22 100644 Binary files a/assets/sounds/new_best_score.wav and b/assets/sounds/new_best_score.wav differ diff --git a/assets/sounds/new_best_score2.wav b/assets/sounds/new_best_score2.wav index d6bd17c..1d0c23e 100644 Binary files a/assets/sounds/new_best_score2.wav and b/assets/sounds/new_best_score2.wav differ diff --git a/assets/sounds/nitrome.wav b/assets/sounds/nitrome.wav index d3276c0..0e3abc4 100644 Binary files a/assets/sounds/nitrome.wav and b/assets/sounds/nitrome.wav differ diff --git a/assets/sounds/potion_chimes.wav b/assets/sounds/potion_chimes.wav index 828dd35..858ab3d 100644 Binary files a/assets/sounds/potion_chimes.wav and b/assets/sounds/potion_chimes.wav differ diff --git a/assets/sounds/scribbling.wav b/assets/sounds/scribbling.wav index d28c618..6230737 100644 Binary files a/assets/sounds/scribbling.wav and b/assets/sounds/scribbling.wav differ diff --git a/assets/sounds/slowdown.wav b/assets/sounds/slowdown.wav index d9f256b..08b5d03 100644 Binary files a/assets/sounds/slowdown.wav and b/assets/sounds/slowdown.wav differ diff --git a/assets/sounds/speed_up_loop.wav b/assets/sounds/speed_up_loop.wav index b11eda8..a9b57b8 100644 Binary files a/assets/sounds/speed_up_loop.wav and b/assets/sounds/speed_up_loop.wav differ diff --git a/assets/sounds/speedup.wav b/assets/sounds/speedup.wav index 68644ac..e2200b9 100644 Binary files a/assets/sounds/speedup.wav and b/assets/sounds/speedup.wav differ diff --git a/assets/sounds/spell_unlocked.wav b/assets/sounds/spell_unlocked.wav index 6a17c18..0f3e78d 100644 Binary files a/assets/sounds/spell_unlocked.wav and b/assets/sounds/spell_unlocked.wav differ diff --git a/assets/sounds/spidersqueak.wav b/assets/sounds/spidersqueak.wav index 6dce1a2..e74970c 100644 Binary files a/assets/sounds/spidersqueak.wav and b/assets/sounds/spidersqueak.wav differ diff --git a/assets/sounds/squeak0.wav b/assets/sounds/squeak0.wav index 1c129b7..38259d9 100644 Binary files a/assets/sounds/squeak0.wav and b/assets/sounds/squeak0.wav differ diff --git a/assets/sounds/squeak1.wav b/assets/sounds/squeak1.wav index f2cbb8c..9dfa3f1 100644 Binary files a/assets/sounds/squeak1.wav and b/assets/sounds/squeak1.wav differ diff --git a/assets/sounds/squeak2.wav b/assets/sounds/squeak2.wav index 7b4f153..d022a0d 100644 Binary files a/assets/sounds/squeak2.wav and b/assets/sounds/squeak2.wav differ diff --git a/assets/sounds/thief_grunt.wav b/assets/sounds/thief_grunt.wav index ede4209..18c1b46 100644 Binary files a/assets/sounds/thief_grunt.wav and b/assets/sounds/thief_grunt.wav differ diff --git a/assets/sounds/thief_happy.wav b/assets/sounds/thief_happy.wav index efd47e3..df8faaf 100644 Binary files a/assets/sounds/thief_happy.wav and b/assets/sounds/thief_happy.wav differ diff --git a/assets/sounds/thunder.wav b/assets/sounds/thunder.wav index a28df76..e49cbba 100644 Binary files a/assets/sounds/thunder.wav and b/assets/sounds/thunder.wav differ diff --git a/assets/sounds/tick0.wav b/assets/sounds/tick0.wav index c349ba4..1bd7970 100644 Binary files a/assets/sounds/tick0.wav and b/assets/sounds/tick0.wav differ diff --git a/assets/sounds/tick1.wav b/assets/sounds/tick1.wav index 5c89861..0f4a4d4 100644 Binary files a/assets/sounds/tick1.wav and b/assets/sounds/tick1.wav differ diff --git a/assets/sounds/tick2.wav b/assets/sounds/tick2.wav index dc4f2e6..0fc04a1 100644 Binary files a/assets/sounds/tick2.wav and b/assets/sounds/tick2.wav differ diff --git a/assets/sounds/tick3.wav b/assets/sounds/tick3.wav index ec53a5e..116169a 100644 Binary files a/assets/sounds/tick3.wav and b/assets/sounds/tick3.wav differ diff --git a/assets/sounds/title_intro.wav b/assets/sounds/title_intro.wav index 25e6239..6aa6108 100644 Binary files a/assets/sounds/title_intro.wav and b/assets/sounds/title_intro.wav differ diff --git a/assets/sounds/turn_balloons_into bombs.wav b/assets/sounds/turn_balloons_into bombs.wav index 5b0a296..bcd83e6 100644 Binary files a/assets/sounds/turn_balloons_into bombs.wav and b/assets/sounds/turn_balloons_into bombs.wav differ diff --git a/assets/sounds/turret.wav b/assets/sounds/turret.wav index da4b08a..ac4de56 100644 Binary files a/assets/sounds/turret.wav and b/assets/sounds/turret.wav differ diff --git a/assets/sounds/unicorn_chime.wav b/assets/sounds/unicorn_chime.wav index 547d904..0c647f1 100644 Binary files a/assets/sounds/unicorn_chime.wav and b/assets/sounds/unicorn_chime.wav differ diff --git a/assets/sounds/unicorn_loop.wav b/assets/sounds/unicorn_loop.wav index c63213a..23c43b6 100644 Binary files a/assets/sounds/unicorn_loop.wav and b/assets/sounds/unicorn_loop.wav differ diff --git a/assets/sounds/unicorn_off.wav b/assets/sounds/unicorn_off.wav index 3dd0acc..467b88e 100644 Binary files a/assets/sounds/unicorn_off.wav and b/assets/sounds/unicorn_off.wav differ diff --git a/assets/sounds/vortex_dragon.wav b/assets/sounds/vortex_dragon.wav index 38ffbb5..a3a333e 100644 Binary files a/assets/sounds/vortex_dragon.wav and b/assets/sounds/vortex_dragon.wav differ diff --git a/assets/sounds/windingclock.wav b/assets/sounds/windingclock.wav index 258d26c..edb1b6c 100644 Binary files a/assets/sounds/windingclock.wav and b/assets/sounds/windingclock.wav differ diff --git a/assets/sounds/wizard_jump.wav b/assets/sounds/wizard_jump.wav index 14ee28a..382b378 100644 Binary files a/assets/sounds/wizard_jump.wav and b/assets/sounds/wizard_jump.wav differ diff --git a/assets/sounds/woosh.wav b/assets/sounds/woosh.wav index fc631b9..b0a2740 100644 Binary files a/assets/sounds/woosh.wav and b/assets/sounds/woosh.wav differ diff --git a/assets/sounds/woosh2.wav b/assets/sounds/woosh2.wav index 8d1e555..146d62c 100644 Binary files a/assets/sounds/woosh2.wav and b/assets/sounds/woosh2.wav differ diff --git a/src/cards.rs b/src/cards.rs new file mode 100644 index 0000000..5746731 --- /dev/null +++ b/src/cards.rs @@ -0,0 +1,47 @@ +use std::borrow::Cow; + +use yoke::Yokeable; + +use super::player::Position; + +/// A card in a players deck which can be played to solve +/// a situation card +#[derive(Yokeable)] +pub struct ActionCard<'a> { + /// How much influence the card will cost to play + influence: i32, + /// The effect the card will have on the game once it's played + effect: Effect, + /// The image on the card + image: Cow<'a, str>, + /// The name of the card + name: Cow<'a, str>, + /// A description of what the card does + description: Cow<'a, str>, +} + +/// A card which must be solved by someone on the politburo +#[derive(Yokeable)] +pub struct SituationCard<'a> { + /// Points associated with the card + points: i32, + /// Solving this card benefits the player in this position + benefactor: Position, + /// The image on the card + image: Cow<'a, str>, + /// The name of the card + name: Cow<'a, str>, + /// A description of the situation the card entails + description: Cow<'a, str>, +} + +pub enum CardType { + /// A card which can be used by anyone + General, + /// A card which can only be used by the given + /// poisition + Position(Position), +} + +/// ?? +pub enum Effect {} diff --git a/src/logo.rs b/src/logo.rs index 94da503..5e56cec 100644 --- a/src/logo.rs +++ b/src/logo.rs @@ -24,6 +24,7 @@ pub struct LogoAssets { #[derive(Resource)] struct LogoData { logo_entity: Entity, + camera_entity: Entity, } impl Plugin for LogoPlugin { @@ -67,9 +68,10 @@ fn load_logo(mut commands: Commands, assets: Res) { ), )) .id(); - commands.spawn(Camera2dBundle::default()); + let camera_entity = commands.spawn(Camera2dBundle::default()).id(); commands.insert_resource(LogoData { logo_entity: sprite_entity, + camera_entity, }); } @@ -111,6 +113,7 @@ fn fade_in_logo( fn cleanup_logo(mut commands: Commands, logo_data: Res) { commands.entity(logo_data.logo_entity).despawn_recursive(); + commands.entity(logo_data.camera_entity).despawn_recursive(); commands.remove_resource::(); commands.remove_resource::(); } diff --git a/src/main.rs b/src/main.rs index ecc6a3c..7c9f554 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,12 +1,17 @@ +//! A social deduction, historically based card game + use bevy::prelude::*; use bevy_asset_loader::loading_state::{ config::ConfigureLoadingState, LoadingState, LoadingStateAppExt, }; +// use bevy_editor_pls::prelude::*; use tracing_subscriber::EnvFilter; +mod cards; mod logo; mod menu; mod networking; +mod player; mod rooms; #[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)] diff --git a/src/menu.rs b/src/menu.rs index 83bedcc..a48a8dd 100644 --- a/src/menu.rs +++ b/src/menu.rs @@ -1,4 +1,4 @@ -use bevy::{app::AppExit, prelude::*}; +use bevy::{app::AppExit, pbr::Lightmap, prelude::*}; use bevy_asset_loader::asset_collection::AssetCollection; use crate::AppState; @@ -9,6 +9,10 @@ pub struct MenuPlugin; pub struct MenuAssets { #[asset(path = "logo_bw.ktx2")] pub logo: Handle, + #[asset(path = "plane_map.ktx2")] + pub plane_lightmap: Handle, + #[asset(path = "scene.glb#Scene0")] + pub scene: Handle, } const NORMAL_BUTTON: Color = Color::BLACK; @@ -59,8 +63,29 @@ fn setup_menu( mut commands: Commands, assets: Res, mut clear_color: ResMut, + mut materials: ResMut>, + meshes: Query< + (Entity, &Name, &Handle), + (With>, Without), + >, ) { - clear_color.0 = Color::GRAY; + let exposure = 250.0; + clear_color.0 = Color::BLACK; + for (entity, name, material) in meshes.iter() { + if &**name == "Light" { + materials.get_mut(material).unwrap().emissive = Color::WHITE * exposure; + continue; + } + + if &**name == "Plane" { + materials.get_mut(material).unwrap().lightmap_exposure = exposure; + commands.entity(entity).insert(Lightmap { + image: assets.plane_lightmap.clone(), + ..default() + }); + continue; + } + } let logo_bw_entity = commands .spawn(NodeBundle { style: Style { @@ -168,6 +193,12 @@ fn setup_menu( }); }) .id(); + commands.spawn(Camera3dBundle { + transform: Transform::from_xyz(0.0, -585.9, 193.0), + // .with_rotation(Quat::from_rotation_x(71.0)), + ..Default::default() + }); + commands.insert_resource(AmbientLight::NONE); commands.insert_resource(MenuData { button_entity, logo_bw_entity, diff --git a/src/player.rs b/src/player.rs new file mode 100644 index 0000000..b72fbff --- /dev/null +++ b/src/player.rs @@ -0,0 +1,36 @@ +use yoke::Yoke; + +use crate::cards::ActionCard; + +/// The players position on the Politburo +pub enum Position { + /// Very direct, aggressive. Focuses on generating influence. + /// Public opinion suffers as a result. + MilitaryChief, + /// Opposite of Military. Mostly high public opinion, low influence. + /// Generates influence from public opinion + PropogandaCheif, + /// Backroom backstabber. Half of your influence is refunded if you + /// fail to shut down or support a bill. + InternalSecurityCheif, + /// ?? + EconomicPlanningCheif, + /// ?? + PositionFive, + /// ?? + PositionSix, + /// ?? + PositionSeven, + /// ?? + PositionEight, +} + +/// A player participating in the Politburo +pub struct Player { + /// The player's position on the Politburo + position: Position, + /// The display name of the player + name: String, + /// The action cards in a player's hand + cards: heapless::Vec, Vec>, 7>, +} diff --git a/src/rooms.rs b/src/rooms.rs index ebc6942..3147dac 100644 --- a/src/rooms.rs +++ b/src/rooms.rs @@ -5,7 +5,10 @@ use bevy_egui::egui::Align2; use bevy_egui::EguiContexts; use bevy_egui::{egui, EguiClipboard}; use libp2p::{relay, swarm::SwarmEvent, PeerId}; +use yoke::Yoke; +use crate::cards::SituationCard; +use crate::player::Player; use crate::{ menu::{MenuAssets, MenuData}, networking::{BehaviourEvent, NetworkEvent, NetworkManager}, @@ -35,6 +38,15 @@ struct ChatBuffer { history: String, } +/// A virtual table all the players sit around +pub struct SituationTable { + /// The situation currently on the table + situation: Yoke, Vec>, + /// The players sitting around the table and participating + /// in the Politburo + players: heapless::Vec, +} + fn rooms( mut next_state: ResMut>, mut text_buffer: ResMut,