mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Only NPCs speak when hit. Farm animal alignment changed from NPC to Tame
This commit is contained in:

committed by
Pfauenauge90
parent
3cea76b82f
commit
78a06550d0
@ -5,9 +5,15 @@ 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<Vec3<f32>>,
|
||||
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<f32>, can_speak: bool) -> Self {
|
||||
let patrol_origin = Some(origin);
|
||||
Agent {
|
||||
patrol_origin,
|
||||
can_speak,
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Component for Agent {
|
||||
|
Reference in New Issue
Block a user