diff --git a/CHANGELOG.md b/CHANGELOG.md index de9b21f47f..881cbdb84f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added context-sensitive crosshair - Announce alias changes to all clients. - Dance animation +- Speech bubbles appear when nearby players talk +- NPCs call for help when attacked ### Changed diff --git a/assets/voxygen/element/frames/bubble/bottom.png b/assets/voxygen/element/frames/bubble/bottom.png new file mode 100644 index 0000000000..70f07ddd59 Binary files /dev/null and b/assets/voxygen/element/frames/bubble/bottom.png differ diff --git a/assets/voxygen/element/frames/bubble/bottom_left.png b/assets/voxygen/element/frames/bubble/bottom_left.png new file mode 100644 index 0000000000..6147effe8d Binary files /dev/null and b/assets/voxygen/element/frames/bubble/bottom_left.png differ diff --git a/assets/voxygen/element/frames/bubble/bottom_right.png b/assets/voxygen/element/frames/bubble/bottom_right.png new file mode 100644 index 0000000000..fd22bb9570 Binary files /dev/null and b/assets/voxygen/element/frames/bubble/bottom_right.png differ diff --git a/assets/voxygen/element/frames/bubble/left.png b/assets/voxygen/element/frames/bubble/left.png new file mode 100644 index 0000000000..6db85e6d83 Binary files /dev/null and b/assets/voxygen/element/frames/bubble/left.png differ diff --git a/assets/voxygen/element/frames/bubble/mid.png b/assets/voxygen/element/frames/bubble/mid.png new file mode 100644 index 0000000000..b8d6994245 Binary files /dev/null and b/assets/voxygen/element/frames/bubble/mid.png differ diff --git a/assets/voxygen/element/frames/bubble/right.png b/assets/voxygen/element/frames/bubble/right.png new file mode 100644 index 0000000000..583c736e5b Binary files /dev/null and b/assets/voxygen/element/frames/bubble/right.png differ diff --git a/assets/voxygen/element/frames/bubble/tail.png b/assets/voxygen/element/frames/bubble/tail.png new file mode 100644 index 0000000000..97085ba162 Binary files /dev/null and b/assets/voxygen/element/frames/bubble/tail.png differ diff --git a/assets/voxygen/element/frames/bubble/top.png b/assets/voxygen/element/frames/bubble/top.png new file mode 100644 index 0000000000..da43009598 Binary files /dev/null and b/assets/voxygen/element/frames/bubble/top.png differ diff --git a/assets/voxygen/element/frames/bubble/top_left.png b/assets/voxygen/element/frames/bubble/top_left.png new file mode 100644 index 0000000000..bf46400ff4 Binary files /dev/null and b/assets/voxygen/element/frames/bubble/top_left.png differ diff --git a/assets/voxygen/element/frames/bubble/top_right.png b/assets/voxygen/element/frames/bubble/top_right.png new file mode 100644 index 0000000000..a6600439b9 Binary files /dev/null and b/assets/voxygen/element/frames/bubble/top_right.png differ diff --git a/assets/voxygen/element/frames/bubble_dark/bottom.png b/assets/voxygen/element/frames/bubble_dark/bottom.png new file mode 100644 index 0000000000..8add83cd04 Binary files /dev/null and b/assets/voxygen/element/frames/bubble_dark/bottom.png differ diff --git a/assets/voxygen/element/frames/bubble_dark/bottom_left.png b/assets/voxygen/element/frames/bubble_dark/bottom_left.png new file mode 100644 index 0000000000..505b93ee35 Binary files /dev/null and b/assets/voxygen/element/frames/bubble_dark/bottom_left.png differ diff --git a/assets/voxygen/element/frames/bubble_dark/bottom_right.png b/assets/voxygen/element/frames/bubble_dark/bottom_right.png new file mode 100644 index 0000000000..e1ca9c56f7 Binary files /dev/null and b/assets/voxygen/element/frames/bubble_dark/bottom_right.png differ diff --git a/assets/voxygen/element/frames/bubble_dark/left.png b/assets/voxygen/element/frames/bubble_dark/left.png new file mode 100644 index 0000000000..171ab0e814 Binary files /dev/null and b/assets/voxygen/element/frames/bubble_dark/left.png differ diff --git a/assets/voxygen/element/frames/bubble_dark/mid.png b/assets/voxygen/element/frames/bubble_dark/mid.png new file mode 100644 index 0000000000..b17ac09bda Binary files /dev/null and b/assets/voxygen/element/frames/bubble_dark/mid.png differ diff --git a/assets/voxygen/element/frames/bubble_dark/right.png b/assets/voxygen/element/frames/bubble_dark/right.png new file mode 100644 index 0000000000..8c975f6904 Binary files /dev/null and b/assets/voxygen/element/frames/bubble_dark/right.png differ diff --git a/assets/voxygen/element/frames/bubble_dark/tail.png b/assets/voxygen/element/frames/bubble_dark/tail.png new file mode 100644 index 0000000000..a9a9f4e478 Binary files /dev/null and b/assets/voxygen/element/frames/bubble_dark/tail.png differ diff --git a/assets/voxygen/element/frames/bubble_dark/top.png b/assets/voxygen/element/frames/bubble_dark/top.png new file mode 100644 index 0000000000..afe8249bcb Binary files /dev/null and b/assets/voxygen/element/frames/bubble_dark/top.png differ diff --git a/assets/voxygen/element/frames/bubble_dark/top_left.png b/assets/voxygen/element/frames/bubble_dark/top_left.png new file mode 100644 index 0000000000..ab289c2329 Binary files /dev/null and b/assets/voxygen/element/frames/bubble_dark/top_left.png differ diff --git a/assets/voxygen/element/frames/bubble_dark/top_right.png b/assets/voxygen/element/frames/bubble_dark/top_right.png new file mode 100644 index 0000000000..d59b54308a Binary files /dev/null and b/assets/voxygen/element/frames/bubble_dark/top_right.png differ diff --git a/assets/voxygen/i18n/de_DE.ron b/assets/voxygen/i18n/de_DE.ron index 7825275b69..630a118ef3 100644 --- a/assets/voxygen/i18n/de_DE.ron +++ b/assets/voxygen/i18n/de_DE.ron @@ -383,5 +383,8 @@ Willenskraft "esc_menu.logout": "Ausloggen", "esc_menu.quit_game": "Desktop", /// End Escape Menu Section + }, + + vector_map: { } -) \ No newline at end of file +) diff --git a/assets/voxygen/i18n/en.ron b/assets/voxygen/i18n/en.ron index c2ce3c3618..0cea650ed6 100644 --- a/assets/voxygen/i18n/en.ron +++ b/assets/voxygen/i18n/en.ron @@ -238,6 +238,7 @@ Enjoy your stay in the World of Veloren."#, "hud.settings.cumulated_damage": "Cumulated Damage", "hud.settings.incoming_damage": "Incoming Damage", "hud.settings.cumulated_incoming_damage": "Cumulated Incoming Damage", + "hud.settings.speech_bubble_dark_mode": "Speech Bubble Dark Mode", "hud.settings.energybar_numbers": "Energybar Numbers", "hud.settings.values": "Values", "hud.settings.percentages": "Percentages", @@ -375,14 +376,52 @@ Fitness Willpower "#, - - - /// Start character window section + /// End character window section /// Start Escape Menu Section "esc_menu.logout": "Logout", "esc_menu.quit_game": "Quit Game", /// End Escape Menu Section + }, + + vector_map: { + "npc.speech.villager_under_attack": [ + "Help, I'm under attack!", + "Help! I'm under attack!", + "Ouch! I'm under attack!", + "Ouch! I'm under attack! Help!", + "Help me! I'm under attack!", + "I'm under attack! Help!", + "I'm under attack! Help me!", + "Help!", + "Help! Help!", + "Help! Help! Help!", + "I'm under attack!", + "AAAHHH! I'm under attack!", + "AAAHHH! I'm under attack! Help!", + "Help! We're under attack!", + "Help! Murderer!", + "Help! There's a murderer on the loose!", + "Help! They're trying to kill me!", + "Guards, I'm under attack!", + "Guards! I'm under attack!", + "I'm under attack! Guards!", + "Help! Guards! I'm under attack!", + "Guards! Come quick!", + "Guards! Guards!", + "Guards! There's a villain attacking me!", + "Guards, slay this foul villain!", + "Guards! There's a murderer!", + "Guards! Help me!", + "You won't get away with this! Guards!", + "You fiend!", + "Help me!", + "Help! Please!", + "Ouch! Guards! Help!", + "They're coming for me!", + "Help! Help! I'm being repressed", + "Ah, now we see the violence inherent in the system.", + ], } ) diff --git a/assets/voxygen/i18n/fr_FR.ron b/assets/voxygen/i18n/fr_FR.ron index 6d5c4d581c..89a2685dd4 100644 --- a/assets/voxygen/i18n/fr_FR.ron +++ b/assets/voxygen/i18n/fr_FR.ron @@ -323,5 +323,8 @@ Force Dexterité Intelligence"#, + }, + + vector_map: { } -) \ No newline at end of file +) diff --git a/assets/voxygen/i18n/it_IT.ron b/assets/voxygen/i18n/it_IT.ron index 5af28e1e58..5a14c15a9b 100644 --- a/assets/voxygen/i18n/it_IT.ron +++ b/assets/voxygen/i18n/it_IT.ron @@ -524,5 +524,8 @@ Volontà "esc_menu.logout": "Disconnettiti", "esc_menu.quit_game": "Esci dal Gioco", /// End Escape Menu Section - } + }, + + vector_map: { + } ) diff --git a/assets/voxygen/i18n/pt_PT.ron b/assets/voxygen/i18n/pt_PT.ron index a29d45f147..c4832499a9 100644 --- a/assets/voxygen/i18n/pt_PT.ron +++ b/assets/voxygen/i18n/pt_PT.ron @@ -368,5 +368,8 @@ Força de vontade "esc_menu.logout": "Desconectar", "esc_menu.quit_game": "Sair do jogo", /// End Escape Menu Section + }, + + vector_map: { } ) diff --git a/assets/voxygen/i18n/ru_RU.ron b/assets/voxygen/i18n/ru_RU.ron index 51ae278708..da55da407b 100644 --- a/assets/voxygen/i18n/ru_RU.ron +++ b/assets/voxygen/i18n/ru_RU.ron @@ -365,5 +365,8 @@ https://account.veloren.net."#, "esc_menu.logout": "Выйти в меню", "esc_menu.quit_game": "Выйти из игры", /// End Escape Menu Section + }, + + vector_map: { } ) diff --git a/assets/voxygen/i18n/tr_TR.ron b/assets/voxygen/i18n/tr_TR.ron index 17d62c5ce8..2f88227ad9 100644 --- a/assets/voxygen/i18n/tr_TR.ron +++ b/assets/voxygen/i18n/tr_TR.ron @@ -397,5 +397,8 @@ Hareket gücü "esc_menu.logout": "Çıkış yap", "esc_menu.quit_game": "Oyundan çık", /// End Escape Menu Section + }, + + vector_map: { } ) diff --git a/common/src/comp/agent.rs b/common/src/comp/agent.rs index be33b4bb49..dffde7484e 100644 --- a/common/src/comp/agent.rs +++ b/common/src/comp/agent.rs @@ -1,13 +1,19 @@ -use crate::path::Chaser; -use specs::{Component, Entity as EcsEntity}; +use crate::{path::Chaser, state::Time}; +use specs::{Component, Entity as EcsEntity, FlaggedStorage, HashMapStorage}; use specs_idvs::IDVStorage; use vek::*; #[derive(Copy, Clone, Debug, PartialEq)] pub enum Alignment { + /// Wild animals and gentle giants Wild, + /// Dungeon cultists and bandits Enemy, + /// Friendly folk in villages Npc, + /// Farm animals and pets of villagers + Tame, + /// Pets you've tamed with a collar Owned(EcsEntity), } @@ -27,6 +33,10 @@ impl Alignment { match (self, other) { (Alignment::Enemy, Alignment::Enemy) => true, (Alignment::Owned(a), Alignment::Owned(b)) if a == b => true, + (Alignment::Npc, Alignment::Npc) => true, + (Alignment::Npc, Alignment::Tame) => true, + (Alignment::Tame, Alignment::Npc) => true, + (Alignment::Tame, Alignment::Tame) => true, _ => false, } } @@ -40,6 +50,9 @@ impl Component for Alignment { pub struct Agent { pub patrol_origin: Option>, pub activity: Activity, + /// Does the agent talk when e.g. hit by the player + // TODO move speech patterns into a Behavior component + pub can_speak: bool, } impl Agent { @@ -47,6 +60,15 @@ impl Agent { self.patrol_origin = Some(origin); self } + + pub fn new(origin: Vec3, can_speak: bool) -> Self { + let patrol_origin = Some(origin); + Agent { + patrol_origin, + can_speak, + ..Default::default() + } + } } impl Component for Agent { @@ -85,3 +107,50 @@ impl Activity { impl Default for Activity { fn default() -> Self { Activity::Idle(Vec2::zero()) } } + +/// Default duration in seconds of speech bubbles +pub const SPEECH_BUBBLE_DURATION: f64 = 5.0; + +/// The contents of a speech bubble +#[derive(Clone, Debug, Serialize, Deserialize)] +pub enum SpeechBubbleMessage { + /// This message was said by a player and needs no translation + Plain(String), + /// This message was said by an NPC. The fields are a i18n key and a random + /// u16 index + Localized(String, u16), +} + +/// Adds a speech bubble to the entity +#[derive(Clone, Debug, Serialize, Deserialize)] +pub struct SpeechBubble { + pub message: SpeechBubbleMessage, + pub timeout: Option