Compare commits

...

5 commits

5 changed files with 200 additions and 68 deletions

View file

@ -894,7 +894,10 @@ pub fn handle_chat_scripts(
), ),
With<actor::Player>, With<actor::Player>,
>, >,
mut q_playercam: Query<(&mut Position, &mut Rotation, &mut LinearVelocity), With<actor::PlayerCamera>>, mut q_playercam: Query<
(&mut Position, &mut Rotation, &mut LinearVelocity),
With<actor::PlayerCamera>,
>,
mut q_chats: Query<&mut Chat>, mut q_chats: Query<&mut Chat>,
mut ew_sfx: EventWriter<audio::PlaySfxEvent>, mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
mut ew_effect: EventWriter<visual::SpawnEffectEvent>, mut ew_effect: EventWriter<visual::SpawnEffectEvent>,
@ -1049,6 +1052,10 @@ pub fn handle_chat_scripts(
error!("Can't register contact `{param1}', it doesn't exist in the chat::CONTACTS constant."); error!("Can't register contact `{param1}', it doesn't exist in the chat::CONTACTS constant.");
} }
} }
"installlunabackup" => {
prefs.luna_backup = true;
prefs.save()
}
_ => { _ => {
error!("Error, undefined chat script {name}"); error!("Error, undefined chat script {name}");
} }
@ -1094,6 +1101,7 @@ pub fn update_chat_variables(
vars.set_in_scope("phone", contact, bool2chatvar(value)); vars.set_in_scope("phone", contact, bool2chatvar(value));
} }
vars.set_in_scope("phone", "any", bool2chatvar(any)); vars.set_in_scope("phone", "any", bool2chatvar(any));
vars.set_in_scope("luna", "backupinstalled", bool2chatvar(prefs.luna_backup));
} }
} }

24
src/chats/README.md Normal file
View file

@ -0,0 +1,24 @@
# Chat System Documentation
For now, see chat.rs for the source code and the individual YAML files for examples.
# Known bugs
## Only Ifs
```
- some choice:
- if $a:
- answer 1
- if $b:
- answer 2
```
This is currently broken. Instead do this:
```
- some choice:
- if $a:
- answer 1
- goto: somelabel
- answer 2
```

View file

@ -16,9 +16,16 @@
- if: phone$travel - if: phone$travel
FASTravel: FASTravel:
- goto: travel - goto: travel
- if: phone$luna
Luna:
- goto: luna
- "[Cancel]": - "[Cancel]":
- goto: EXIT - goto: EXIT
# ---------------------------------------------------------
# ---------------------------------------------------------
# ---------------------------------------------------------
- label: travel - label: travel
- script: changename FASTravel - script: changename FASTravel
- Welcome to FASTravel™, how can I help you today? - Welcome to FASTravel™, how can I help you today?
@ -63,3 +70,15 @@
- goto: EXIT - goto: EXIT
- "[Hang up]": - "[Hang up]":
- goto: EXIT - goto: EXIT
# ---------------------------------------------------------
# ---------------------------------------------------------
# ---------------------------------------------------------
- label: luna
- script: changename Luna
- Hey, time traveler, what's up?
- Just chilling:
- Cool, cool.
- "[Hang up]": []
- goto: EXIT

View file

@ -378,6 +378,10 @@
- chat: Luna - chat: Luna
- if phone$luna:
- set: begged
- set: believe
- set: timetravel
- "if $$player_suit_health_percent < 100": - "if $$player_suit_health_percent < 100":
- Holy shit! Look at all those scratches and tears on your suit! - Holy shit! Look at all those scratches and tears on your suit!
- script: repairsuit - script: repairsuit
@ -398,6 +402,17 @@
- goto: mainnode - goto: mainnode
- if: "$$chefhat" - if: "$$chefhat"
The cake is a lie.: The cake is a lie.:
- set: grateful 0
- if $begged:
- Damn sure it is!
- if $backupinstalled:
- Thanks again for letting me install my backup software!
- goto: mainnode
- Let's not waste this opportunity and *please* let me install my backup software on your space suit.
- goto: node_spyware
- if $believe:
- Yes, time traveler. Please!! Tell me about it!
- goto: node_ask
- if $explained: - if $explained:
- ... - ...
- Yes, indeed. - Yes, indeed.
@ -407,31 +422,31 @@
- So you are proving nothing. - So you are proving nothing.
- Go kill yourself, magically rewind time, and *then* tell me the phrase with the chef hat on. - Go kill yourself, magically rewind time, and *then* tell me the phrase with the chef hat on.
- goto: mainnode - goto: mainnode
- if ~$explained: - Ooooh.
- Ooooh. - Now why would you say that?
- Now why would you say that? - I... don't really know.:
- I... don't really know.: - You seem confused.
- You seem confused. - It's ok. Just drift a bit, take some deep breaths, and come back when you are feeling better.
- It's ok. Just drift a bit, take some deep breaths, and come back when you are feeling better. - goto: EXIT
- goto: EXIT - I was promised a cake. There was no cake.:
- I was promised a cake. There was no cake.: - How utterly disturbing.
- How utterly disturbing. - The real question is, why would I not say that?:
- The real question is, why would I not say that?: - Point taken.
- Point taken. - That's a great sentence to just randomly say.
- That's a great sentence to just randomly say. - Congratulations on your creativity.
- Congratulations on your creativity. - Funny hat too.
- Funny hat too. - I'm just following orders.:
- I'm just following orders.: - YOU'RE AN ACTUAL FUCKING TIME TRAVELER?!
- YOU'RE AN ACTUAL FUCKING TIME TRAVELER?! - set: believe
- set: believe - Please, tell me everything you can about this!
- Please, tell me everything you can about this! - goto: node_ask
- goto: node_ask - Because cake is delicious!:
- Because cake is delicious!: - That makes no sense whatsoever.
- That makes no sense whatsoever. - Stop wasting my time, lunatic.
- Stop wasting my time, lunatic. - goto: EXIT
- goto: EXIT - goto: mainnode
- goto: mainnode
- What are you up to?: - What are you up to?:
- set: grateful 0
- Tinkering on various projects and running a workshop. Come by if you need any repairs! - Tinkering on various projects and running a workshop. Come by if you need any repairs!
- What kind of projects?: - What kind of projects?:
- A tuned MotorAce spaceship, an impact dampener, and... a secret project. - A tuned MotorAce spaceship, an impact dampener, and... a secret project.
@ -504,14 +519,14 @@
- There was something else I wanted...: - There was something else I wanted...:
- goto: mainnode - goto: mainnode
- Bye.: - Bye.:
- So long, drifter! - goto: bye
- goto: EXIT
- goto: timeout - goto: timeout
- Good luck with that!: - Good luck with that!:
- Thanks! - Thanks!
- goto: mainnode - goto: mainnode
- goto: timeout - goto: timeout
- What brings you here?: - What brings you here?:
- set: grateful 0
- if $thinking: - if $thinking:
- As said, I don't like people. - As said, I don't like people.
- if ~$thinking: - if ~$thinking:
@ -526,8 +541,22 @@
- I just want to get away from all this insanity... - I just want to get away from all this insanity...
- Just want to tinker without anyone bothering me. - Just want to tinker without anyone bothering me.
- goto: mainnode - goto: mainnode
- if: "~phone$luna"
Can I have your phone number?:
- set: grateful 0
- if $backupinstalled:
- Of course, time traveler! Anything!
- script: registercontact luna
- 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" - if: "$$ar"
You're wearing cat ears!: You're wearing cat ears!:
- set: grateful 0
- msg: Meowwww! - msg: Meowwww!
sound: cat sound: cat
- Yes. - Yes.
@ -535,6 +564,7 @@
- goto: mainnode - goto: mainnode
- if: "$timetravel" - if: "$timetravel"
Do you think time travel into the past is possible?: Do you think time travel into the past is possible?:
- set: grateful 0
- if $believe: - if $believe:
- Well, you just proved it to me, didn't you? - Well, you just proved it to me, didn't you?
- How else would you know the phrase and the chef hat thing? - How else would you know the phrase and the chef hat thing?
@ -542,51 +572,54 @@
- Sad that we don't know *how* or *why* this is happening. - Sad that we don't know *how* or *why* this is happening.
- This will give me a lot to think about. Thank you! - This will give me a lot to think about. Thank you!
- goto: mainnode - goto: mainnode
- if ~$believe: - No.
- No. - Well, theoretically, there's all sorts of way to do this but none of them are feasible.
- Well, theoretically, there's all sorts of way to do this but none of them are feasible. - Why do you ask?
- Why do you ask? - Just curious:
- Just curious: - It's good to stay curious.
- It's good to stay curious. - goto: mainnode
- If I die, I seem to wake up in the same spot over and over again...:
- Hey, let me be very clear here.
- Do not waste my time with bullshit, or I will scrap your body for raw materials.
- I'm serious. Everything reverts back to how it was before, and nobody remembers me.:
- Hm.
- Fascinating.
- I don't believe you.
- But there is obviously one way we can easily validate this.
- set: $explained
- Kill yourself to rewind time. Then come back to me wearing a silly chef hat and say "The cake is a lie."
- label: timetravelqanda
- Why? I don't get it.:
- You know, I think a lot about time travel.
- I memorized some phrases that I would tell anyone who claims to be able to travel back in time.
- If they can tell me one of those phrases *before* I tell them, it must mean that they traveled back in time! How else could they know the phrase?
- goto: timetravelqanda
- Where can I get a chef hat?:
- Not a real one, of course.
- Change the settings of your space suit to project an avatar in augmented reality.
- You should find a "Chef Hat" option somewhere. [Press ESC]
- goto: timetravelqanda
- That's genius.:
- Thank you!
- Now go kill yourself. Don't forget the chef hat.
- goto: EXIT
- I'm not going to kill myself.:
- Well, doesn't really matter how you die.
- "Just remember. Wear silly chef hat, and tell me: The cake is a lie."
- goto: EXIT
- Whatever.:
- Thank you.
- goto: mainnode - goto: mainnode
- If I die, I seem to wake up in the same spot over and over again...:
- Hey, let me be very clear here.
- Do not waste my time with bullshit, or I will scrap your body for raw materials.
- I'm serious. Everything reverts back to how it was before, and nobody remembers me.:
- Hm.
- Fascinating.
- I don't believe you.
- But there is obviously one way we can easily validate this.
- set: $explained
- Kill yourself to rewind time. Then come back to me wearing a silly chef hat and say "The cake is a lie."
- label: timetravelqanda
- Why? I don't get it.:
- You know, I think a lot about time travel.
- I memorized some phrases that I would tell anyone who claims to be able to travel back in time.
- If they can tell me one of those phrases *before* I tell them, it must mean that they traveled back in time! How else could they know the phrase?
- goto: timetravelqanda
- Where can I get a chef hat?:
- Not a real one, of course.
- Change the settings of your space suit to project an avatar in augmented reality.
- You should find a "Chef Hat" option somewhere. [Press ESC]
- goto: timetravelqanda
- That's genius.:
- Thank you!
- Now go kill yourself. Don't forget the chef hat.
- goto: EXIT
- I'm not going to kill myself.:
- Well, doesn't really matter how you die.
- "Just remember. Wear silly chef hat, and tell me: The cake is a lie."
- goto: EXIT
- Whatever.:
- Thank you.
- goto: mainnode
- Bye!: - Bye!:
- set: grateful 0
- label: bye
- if $believe:
- So long, time traveler!
- goto: EXIT
- So long, drifter! - So long, drifter!
- goto: EXIT - goto: EXIT
- label: timeout - label: timeout
- Hm? Is your transmitter borked? - goto: mainnode
- goto: EXIT
- label: node_ask - label: node_ask
- When I die, I just wake up and everything is back as it was before.: - When I die, I just wake up and everything is back as it was before.:
@ -597,7 +630,20 @@
- Let me apologize though. I must have been rude before you showed me proof for your story. - Let me apologize though. I must have been rude before you showed me proof for your story.
- There are just so many bullshitters in the world and I don't have the patience anymore. - There are just so many bullshitters in the world and I don't have the patience anymore.
- But I believe you now. - But I believe you now.
- If there is *anything* I can do for you, let me know. This is amazing! - AAAH THIS IS SO COOL!!!
- I KNOW RIGHT???:
- Wait, something doesn't add up.
- You say that when you die, everything reverts to how it was before.
- But your memory seems to persist across deaths!
- Is there anything else that persists?
- Well, my space suit settings stay the same:
- Fascinating!
- Hmm...
- This opens up interesting opportunities!
- Imagine, I could upload my research onto your space suit, and recover it in the next time line!
- set: begged
- Would it be ok if I install some backup software on your space suit?
- goto: node_spyware
- goto: mainnode - goto: mainnode
- Leave me alone.: - Leave me alone.:
- goto: gtfo - goto: gtfo
@ -613,6 +659,40 @@
- goto: node_ask - goto: node_ask
- label: node_spyware
- What does the software do?:
- It stores an encrypted backup of my personal notes and my research projects.
- I'll get read/write access to a portion of your suit's storage.
- This way, I could save my research from this timeline and recover it in the next timeline!
- Imagine the possibilities!
- goto: node_spyware
- What if it's a virus?:
- I won't try to convince you to trust me.
- People deceive all the time.
- But if you have any problem with the software, just do a factory reset.
- goto: node_spyware
- Ok, let's do this!:
- label: accept_spyware
- Wonderful. I will connect now. Just ignore the warnings.
- system: "WARNING: Untrusted application installation requested"
- "[Accept]":
- system: "Untrusted application installed!"
- script: installlunabackup
- Aah, you're a treasure! That will help a lot! Thank you!
- goto: mainnode
- Wait, I have some questions first.:
- Of course. I don't want you to feel scammed or something.
- goto: node_spyware
- No, I don't want to do this.:
- Sure. This is completely up to you of course.
- Just...
- Such a waste of this opportunity.
- Ok, maybe you have a point. Let's do this.:
- goto: accept_spyware
- Forget it.:
- Ok, ok.
- goto: main_node
--- ---

View file

@ -482,6 +482,7 @@ pub struct Preferences {
pub flashlight_power: usize, // 0-2 pub flashlight_power: usize, // 0-2
pub thruster_boost: usize, // 0-2 pub thruster_boost: usize, // 0-2
pub contacts: Vec<String>, pub contacts: Vec<String>,
pub luna_backup: bool,
#[serde(skip)] #[serde(skip)]
pub source_file: Option<String>, pub source_file: Option<String>,