remove feature to unlock phone numbers, unlock all from the start

This commit is contained in:
yuni 2024-11-18 00:20:55 +01:00
parent 7d55e5a9a8
commit ddb79c343f
7 changed files with 5 additions and 113 deletions

View file

@ -2,7 +2,7 @@
- Implement an ACTUAL QUEST!
- Implement phone calls
- Implement fast travel (must be unlocked by getting phone number of FASTravel)
- Implement fast travel
- Implement factory reset
- Chats don't automatically advance now, the player has to press "Continue"
- Add Outrun Radio, featuring "Outrun" BGM by Andrew Vice

View file

@ -26,10 +26,6 @@ pub const CHATS: &[&str] = &[
include_str!("chats/thebe.yaml"),
];
pub const CONTACTS: &[&str] = &["travel", "tinker", "pig"];
pub const CONTACTS_PRETTY: &[&str] = &["FASTravel", "Luna", "Mudley"];
pub const CONTACTS_UNKNOWN: &str = "[Unknown]";
pub const TEXT_CONTINUE: &str = "Continue...";
pub const TOKEN_CHAT: &str = "chat";
@ -909,7 +905,6 @@ pub fn handle_chat_scripts(
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
mut ew_effect: EventWriter<visual::SpawnEffectEvent>,
mut ew_achievement: EventWriter<game::AchievementEvent>,
mut log: ResMut<hud::Log>,
id2pos: Res<game::Id2Pos>,
id2v: Res<game::Id2V>,
mut prefs: ResMut<Preferences>,
@ -1049,28 +1044,6 @@ pub fn handle_chat_scripts(
}
}
}
"registercontact" => {
if CONTACTS.contains(&param1) {
let param1_string = param1.to_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.save();
}
} else {
error!("Can't register contact `{param1}', it doesn't exist in the chat::CONTACTS constant.");
}
}
"installlunabackup" => {
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Achieve));
prefs.luna_backup = true;
@ -1110,18 +1083,7 @@ pub fn update_chat_variables(
0
};
vars.set_in_scope("$", "chefhat", wears_chefhat.to_string());
// Set phone variables
let mut any = false;
for contact in CONTACTS {
let value = prefs.contacts.contains(&contact.to_string());
if value {
any = true;
}
vars.set_in_scope("phone", contact, bool2chatvar(value));
}
vars.set_in_scope("phone", "any", bool2chatvar(any));
vars.set_in_scope("luna", "backupinstalled", bool2chatvar(prefs.luna_backup));
vars.set_in_scope("$", "backupinstalled", bool2chatvar(prefs.luna_backup));
}
}

View file

@ -64,11 +64,7 @@
- chat: BusStops
- I wish I could use this shuttle service from anywhere!:
- Actually, you can!
- if phone$travel:
- Just give us a phone call, we'll pick you up!
- goto: fastravel
- script: registercontact travel
- Here's our phone number, call us any time and we'll pick you up!
- Just give us a phone call, we'll pick you up!
- goto: fastravel
- if: $busstop != serenity
Take me to Serenity Station, please.:

View file

@ -9,25 +9,11 @@
# + ▀████████████████████████████████████████████████████▀
- chat: phone
- if ~phone$any:
- "Error: Phonebook empty."
- goto: EXIT
- Select contact to call.
- if: phone$travel
FASTravel:
- FASTravel:
- sound: phone
msg: Dialing...
- goto: travel
- if: phone$tinker
Luna:
- sound: phone
msg: Dialing...
- goto: luna
- if: phone$pig
Mudley:
- sound: phone
msg: Dialing...
- goto: pig
- "[Cancel]":
- goto: EXIT

View file

@ -552,7 +552,7 @@
- chat: Luna
- if phone$luna:
- if $$backupinstalled:
- set: begged
- set: believe
- set: timetravel
@ -724,19 +724,6 @@
- I just want to get away from all this insanity...
- Just want to tinker without anyone bothering me.
- goto: mainnode
- if: "~phone$luna"
Can I have your phone number?:
- set: grateful 0
- if $backupinstalled:
- Of course, time traveler! Anything!
- script: registercontact tinker
- goto: mainnode
- if $believe:
- Hm... I trust you, but... I want you to do me a favor first.
- Let me install my backup software on your space suit.
- goto: node_spyware
- No.
- How do I know you're not a scammer?
- if: "$$ar"
You're wearing cat ears!:
- set: grateful 0
@ -1174,14 +1161,6 @@
- But the helmet is blocking your mouth, right?
- So first, open the space suit menu [press ESC] and take off your helmet.
- goto: EXIT
- if: "~phone$pig"
Can I get your phone number?:
- if $annoyed:
- No.
- goto: entrypoint
- Sure, buddy!
- script: registercontact pig
- goto: entrypoint
- Gotta go!:
- Bye!
- goto: EXIT

View file

@ -276,16 +276,6 @@ pub fn setup(
sections.extend(Vec::from_iter(
(0..achievement_count).map(|_| TextSection::new("", style_achievement.clone())),
));
sections.push(TextSection::new(
"\nPhonebook\n",
style_achievement_header.clone(),
));
sections.extend(Vec::from_iter((0..chat::CONTACTS.len()).map(|_| {
TextSection::new(
chat::CONTACTS_UNKNOWN.to_string() + "\n",
style_achievement.clone(),
)
})));
builder.spawn((
MenuAchievements,
TextBundle {
@ -512,22 +502,6 @@ pub fn update_menu(
};
text.sections[i + 1].value = rendered[i].clone();
}
// Phonebook
for (i, contact) in chat::CONTACTS.iter().enumerate() {
let text_index = i + achievement_bools.len() + 2;
let registered = prefs.contacts.contains(&contact.to_string());
text.sections[text_index].style.color = if registered {
settings.hud_color_phonebook_unlocked
} else {
settings.hud_color_phonebook_locked
};
text.sections[text_index].value = if registered {
chat::CONTACTS_PRETTY[i].to_string() + "\n"
} else {
String::from(chat::CONTACTS_UNKNOWN.to_string() + "\n")
}
}
}
// Menu

View file

@ -81,8 +81,6 @@ pub struct Settings {
pub hud_color_achievement: Color,
pub hud_color_achievement_header: Color,
pub hud_color_achievement_accomplished: Color,
pub hud_color_phonebook_locked: Color,
pub hud_color_phonebook_unlocked: Color,
pub hud_color_death: Color,
pub hud_color_death_achievements: Color,
pub hud_color_keybindings: Color,
@ -227,8 +225,6 @@ impl Default for Settings {
hud_color_achievement: Srgba::hex(COLOR_DIM).unwrap().into(),
hud_color_achievement_accomplished: Srgba::hex(COLOR_SUCCESS).unwrap().into(),
hud_color_achievement_header: Srgba::hex(COLOR_PRIMARY).unwrap().into(),
hud_color_phonebook_locked: Srgba::hex(COLOR_DIM).unwrap().into(),
hud_color_phonebook_unlocked: Srgba::hex(COLOR_SECONDARY).unwrap().into(),
hud_color_death: Srgba::hex(COLOR_SECONDARY).unwrap().into(),
hud_color_death_achievements: Srgba::hex(COLOR_SECONDARY).unwrap().into(),
hud_color_keybindings: Srgba::hex(COLOR_DIM).unwrap().into(),
@ -485,7 +481,6 @@ pub struct Preferences {
#[serde(default = "Preferences::default_flashlight_power")]
pub flashlight_power: usize, // 0-2
pub thruster_boost: usize, // 0-2
pub contacts: Vec<String>,
pub luna_backup: bool,
#[serde(skip)]