From 2b711f12d6a3f9eab3caae43dc838bebe6bf2daa Mon Sep 17 00:00:00 2001 From: mikeder Date: Wed, 14 Jun 2023 16:01:32 -0400 Subject: [PATCH] add npc goose, release 0.8.0 --- Cargo.lock | 2 +- Cargo.toml | 4 +- assets/textures/goose.png | Bin 0 -> 1912 bytes src/debug/components.rs | 4 + src/debug/console.rs | 47 ++++++----- src/debug/plugin.rs | 14 +++- src/graphics.rs | 21 ++++- src/lib.rs | 15 ++-- src/loading.rs | 2 + src/main.rs | 17 ++-- src/npc/components.rs | 15 ++++ src/npc/mod.rs | 3 + src/npc/plugin.rs | 38 +++++++++ src/npc/systems.rs | 167 ++++++++++++++++++++++++++++++++++++++ src/player/components.rs | 29 ++++--- src/player/plugin.rs | 12 ++- src/player/round.rs | 37 ++++++++- src/player/systems.rs | 114 ++++++++++++++++---------- 18 files changed, 435 insertions(+), 106 deletions(-) create mode 100644 assets/textures/goose.png create mode 100644 src/npc/components.rs create mode 100644 src/npc/mod.rs create mode 100644 src/npc/plugin.rs create mode 100644 src/npc/systems.rs diff --git a/Cargo.lock b/Cargo.lock index 8997931..9fed945 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5055,7 +5055,7 @@ dependencies = [ [[package]] name = "turtle_time" -version = "0.7.3" +version = "0.8.0" dependencies = [ "bevy", "bevy-inspector-egui", diff --git a/Cargo.toml b/Cargo.toml index de973dc..d54b23a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,8 @@ [package] name = "turtle_time" -version = "0.7.3" +version = "0.8.0" publish = false -authors = ["Mike Eder "] # ToDo: you are the author +authors = ["Mike Eder "] edition = "2021" exclude = ["dist", "build", "assets", "credits"] diff --git a/assets/textures/goose.png b/assets/textures/goose.png new file mode 100644 index 0000000000000000000000000000000000000000..67af23f8a1668cfd4180f950fc07d81eb8934110 GIT binary patch literal 1912 zcmV-;2Z#8HP)EX>4Tx04R}tkv&MmKpe$iTT4YM4t6Nw5TrU;5EXUQDionYs1;guFuC*#n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fx*XfAHV#Hz(vDqx7k|_iMY&Hvhz1^72MwALA zsZ{d5*XyrZh{x;BUmW3+Pfx7*^0I7@)=&`m`msT=V_PfFJl%&@rzIE&F+1ns@1e^? zV=;`iwb<*ds8lMHN(FYi4V_lYCUrGxwVITeVr=X#3-LIAT^Qo@H$N2p9E5C;&afur zYe!!c>ugrqS{(#KVQLI|yj~yic!Fdqg+{Z9t(zMcuk#!9c)fla>g(_a0))a5MlM}t zej(1u(`QP4NJchDV^}lv<-x<^j@~Xz##*A$7;1Gj=PwS^-PKN=&4R(8Cm0NoOr}UA z5?sGIikK3KC*qtqb>@jYJtZ3|Zzu`;(TDGgfnXRA@p}CjjkS1vJ}hPvUaucP5cuM& z@5=f}oorY?hJv@CbG_dv2Dugm?lczq?Eh}a*Y8HI#i|`w3YD*)jTn$})TF0000) { ..Default::default() }, visibility: Visibility::Hidden, - background_color: BackgroundColor(Color::BLACK), + background_color: BackgroundColor(Color::Rgba { + red: 0., + green: 0., + blue: 0., + alpha: 0.7, + }), ..Default::default() }) .with_children(|parent| { @@ -71,24 +78,14 @@ pub fn setup_ui(mut commands: Commands, font_assets: Res) { ..Default::default() }, text: Text { - sections: vec![ - TextSection { - value: "Peer Info: ".to_owned(), - style: TextStyle { - font: font_assets.fira_sans.clone(), - font_size: 15.0, - color: Color::GREEN, - }, + sections: vec![TextSection { + value: "".to_owned(), + style: TextStyle { + font: font_assets.fira_sans.clone(), + font_size: 15.0, + color: Color::GREEN, }, - TextSection { - value: "".to_owned(), - style: TextStyle { - font: font_assets.fira_sans.clone(), - font_size: 15.0, - color: Color::GREEN, - }, - }, - ], + }], ..Default::default() }, ..Default::default() @@ -100,14 +97,22 @@ pub fn setup_ui(mut commands: Commands, font_assets: Res) { .insert(ConsoleUI); commands.insert_resource(PeerInfo("".to_string())); + commands.insert_resource(EdibleCount(0)); commands.insert_resource(ConsoleUpdateTimer(Timer::from_seconds( 1.0, TimerMode::Repeating, ))) } -pub fn set_peer_info(peer_info: ResMut, mut query: Query<&mut Text, With>) { +pub fn update_console_text( + edible_count: ResMut, + peer_info: ResMut, + mut query: Query<&mut Text, With>, +) { for mut text in query.iter_mut() { - text.sections[1].value = peer_info.0.to_string(); + text.sections[0].value = format!( + "Edible count: {}\nPeer Info: \n{}", + edible_count.0, peer_info.0 + ); } } diff --git a/src/debug/plugin.rs b/src/debug/plugin.rs index 6c84e06..0569965 100644 --- a/src/debug/plugin.rs +++ b/src/debug/plugin.rs @@ -5,15 +5,16 @@ use bevy_inspector_egui::quick::WorldInspectorPlugin; use crate::{ menu::connect::LocalHandle, + npc::components::EdibleTarget, player::input::GGRSConfig, player::{ checksum::Checksum, - components::{EdibleSpawnTimer, Player, PlayerHealth}, + components::{Edible, EdibleSpawnTimer, Player, PlayerHealth}, }, AppState, GameState, }; -use super::components::{ConsoleReady, ConsoleUpdateTimer, PeerInfo}; +use super::components::{ConsoleReady, ConsoleUpdateTimer, EdibleCount, PeerInfo}; use super::console::*; pub struct DebugPlugin; @@ -25,6 +26,8 @@ impl Plugin for DebugPlugin { .register_type::() .register_type::() .register_type::() + .register_type::() + .register_type::() .register_type::() .register_type::() .register_type::(); @@ -39,12 +42,17 @@ impl Plugin for ConsolePlugin { app.add_system(setup_ui.in_schedule(OnExit(AppState::Loading))) .add_system(log_ggrs_events.in_set(OnUpdate(GameState::Playing))) .add_system(open_console) - .add_system(set_peer_info.run_if(resource_exists::())) + .add_system(count_edibles.run_if(resource_exists::())) + .add_system(update_console_text.run_if(resource_exists::())) .add_system(reset_console_ready.run_if(resource_exists::())) .add_system(update_peer_info.run_if(resource_exists::>())); } } +pub fn count_edibles(mut edible_count: ResMut, edible_query: Query<&Edible>) { + edible_count.0 = edible_query.iter().collect::>().len(); +} + pub fn update_peer_info( session: Res>, time: Res