notifications and SFX on phone registry and luna's backup software install

This commit is contained in:
yuni 2024-10-27 02:14:28 +01:00
parent 989b6cfb17
commit 6f4d44febc

View file

@ -902,6 +902,7 @@ pub fn handle_chat_scripts(
mut ew_sfx: EventWriter<audio::PlaySfxEvent>, mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
mut ew_effect: EventWriter<visual::SpawnEffectEvent>, mut ew_effect: EventWriter<visual::SpawnEffectEvent>,
mut ew_achievement: EventWriter<game::AchievementEvent>, mut ew_achievement: EventWriter<game::AchievementEvent>,
mut log: ResMut<hud::Log>,
id2pos: Res<game::Id2Pos>, id2pos: Res<game::Id2Pos>,
id2v: Res<game::Id2V>, id2v: Res<game::Id2V>,
mut prefs: ResMut<Preferences>, mut prefs: ResMut<Preferences>,
@ -1045,6 +1046,17 @@ pub fn handle_chat_scripts(
if CONTACTS.contains(&param1) { if CONTACTS.contains(&param1) {
let param1_string = param1.to_string(); let param1_string = param1.to_string();
if !prefs.contacts.contains(&param1_string) { if !prefs.contacts.contains(&param1_string) {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Achieve));
let name = if let Some(index) = CONTACTS.iter().position(|&x| x == param1) {
CONTACTS_PRETTY[index]
} else {
"ERROR"
};
log.add(
format!("Unlocked phone number: {name}!"),
"".to_string(),
hud::LogLevel::Achievement,
);
prefs.contacts.push(param1_string); prefs.contacts.push(param1_string);
prefs.save(); prefs.save();
} }
@ -1053,6 +1065,7 @@ pub fn handle_chat_scripts(
} }
} }
"installlunabackup" => { "installlunabackup" => {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Achieve));
prefs.luna_backup = true; prefs.luna_backup = true;
prefs.save() prefs.save()
} }