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>,
>,
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 ew_sfx: EventWriter<audio::PlaySfxEvent>,
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.");
}
}
"installlunabackup" => {
prefs.luna_backup = true;
prefs.save()
}
_ => {
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", "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
FASTravel:
- goto: travel
- if: phone$luna
Luna:
- goto: luna
- "[Cancel]":
- goto: EXIT
# ---------------------------------------------------------
# ---------------------------------------------------------
# ---------------------------------------------------------
- label: travel
- script: changename FASTravel
- Welcome to FASTravel™, how can I help you today?
@ -63,3 +70,15 @@
- goto: EXIT
- "[Hang up]":
- 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
- if phone$luna:
- set: begged
- set: believe
- set: timetravel
- "if $$player_suit_health_percent < 100":
- Holy shit! Look at all those scratches and tears on your suit!
- script: repairsuit
@ -398,6 +402,17 @@
- goto: mainnode
- if: "$$chefhat"
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:
- ...
- Yes, indeed.
@ -407,7 +422,6 @@
- So you are proving nothing.
- Go kill yourself, magically rewind time, and *then* tell me the phrase with the chef hat on.
- goto: mainnode
- if ~$explained:
- Ooooh.
- Now why would you say that?
- I... don't really know.:
@ -432,6 +446,7 @@
- goto: EXIT
- goto: mainnode
- What are you up to?:
- set: grateful 0
- Tinkering on various projects and running a workshop. Come by if you need any repairs!
- What kind of projects?:
- A tuned MotorAce spaceship, an impact dampener, and... a secret project.
@ -504,14 +519,14 @@
- There was something else I wanted...:
- goto: mainnode
- Bye.:
- So long, drifter!
- goto: EXIT
- goto: bye
- goto: timeout
- Good luck with that!:
- Thanks!
- goto: mainnode
- goto: timeout
- What brings you here?:
- set: grateful 0
- if $thinking:
- As said, I don't like people.
- if ~$thinking:
@ -526,8 +541,22 @@
- 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 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"
You're wearing cat ears!:
- set: grateful 0
- msg: Meowwww!
sound: cat
- Yes.
@ -535,6 +564,7 @@
- goto: mainnode
- if: "$timetravel"
Do you think time travel into the past is possible?:
- set: grateful 0
- if $believe:
- Well, you just proved it to me, didn't you?
- How else would you know the phrase and the chef hat thing?
@ -542,7 +572,6 @@
- Sad that we don't know *how* or *why* this is happening.
- This will give me a lot to think about. Thank you!
- goto: mainnode
- if ~$believe:
- No.
- Well, theoretically, there's all sorts of way to do this but none of them are feasible.
- Why do you ask?
@ -582,11 +611,15 @@
- Thank you.
- goto: mainnode
- Bye!:
- set: grateful 0
- label: bye
- if $believe:
- So long, time traveler!
- goto: EXIT
- So long, drifter!
- goto: EXIT
- label: timeout
- Hm? Is your transmitter borked?
- goto: EXIT
- goto: mainnode
- label: node_ask
- 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.
- There are just so many bullshitters in the world and I don't have the patience anymore.
- 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
- Leave me alone.:
- goto: gtfo
@ -613,6 +659,40 @@
- 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 thruster_boost: usize, // 0-2
pub contacts: Vec<String>,
pub luna_backup: bool,
#[serde(skip)]
pub source_file: Option<String>,