From ca709080ebe977a61293647c216d4e60583ef637 Mon Sep 17 00:00:00 2001 From: hut Date: Fri, 12 Apr 2024 23:28:15 +0200 Subject: [PATCH] spawn chat entity. limit number of chats to 1 --- src/chat.rs | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index a8f0c9e..2141bf8 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -1,7 +1,7 @@ extern crate yaml_rust; use bevy::prelude::*; use yaml_rust::{Yaml, YamlLoader}; -use crate::{audio}; +use crate::{audio, world}; pub const CHATS: &[&str] = &[ include_str!("chats/serenity.yaml"), @@ -22,6 +22,13 @@ impl Plugin for ChatPlugin { } } +#[derive(Component)] +pub struct Chat { + pub id: u32, + pub position: u32, + pub timer: f64, +} + #[derive(Resource)] pub struct ChatDB(Vec); impl ChatDB { @@ -68,17 +75,29 @@ pub fn load_chats(mut chatdb: ResMut) { } pub fn handle_new_conversations( - //mut commands: Commands, + mut commands: Commands, mut er_conv: EventReader, mut ew_sfx: EventWriter, chatdb: Res, - //time: Res