head database for aim and ai
This commit is contained in:
@@ -9,6 +9,7 @@ use crate::{
|
||||
},
|
||||
global_observer,
|
||||
head::ActiveHead,
|
||||
head_asset::HeadsDatabase,
|
||||
heads::HeadChanged,
|
||||
hitpoints::Hitpoints,
|
||||
loading_assets::GameAssets,
|
||||
@@ -251,6 +252,7 @@ fn on_update_head(
|
||||
asset_server: Res<AssetServer>,
|
||||
head: Query<Entity, With<PlayerHeadMesh>>,
|
||||
mut player_head: Query<&mut ActiveHead, With<Player>>,
|
||||
head_db: Res<HeadsDatabase>,
|
||||
) {
|
||||
let Ok(head) = head.get_single() else {
|
||||
return;
|
||||
@@ -262,7 +264,7 @@ fn on_update_head(
|
||||
|
||||
player.0 = trigger.0;
|
||||
|
||||
let head_str = head_id_to_str(trigger.0);
|
||||
let head_str = head_db.head_key(trigger.0);
|
||||
|
||||
commands.trigger(PlaySound::Head(head_str.to_string()));
|
||||
|
||||
@@ -271,27 +273,3 @@ fn on_update_head(
|
||||
|
||||
commands.entity(head).insert(SceneRoot(mesh));
|
||||
}
|
||||
|
||||
pub fn head_id_to_str(head: usize) -> &'static str {
|
||||
match head {
|
||||
0 => "angry demonstrator",
|
||||
1 => "carnival knife thrower",
|
||||
2 => "chicago gangster",
|
||||
3 => "commando",
|
||||
4 => "field medic",
|
||||
5 => "geisha",
|
||||
6 => "goblin",
|
||||
7 => "green grocer",
|
||||
8 => "highland hammer thrower",
|
||||
9 => "legionnaire",
|
||||
10 => "mig pilot",
|
||||
11 => "nanny",
|
||||
12 => "panic attack",
|
||||
13 => "salty sea dog",
|
||||
14 => "snow plough operator",
|
||||
15 => "soldier ant",
|
||||
16 => "super market shopper",
|
||||
17 => "troll",
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user