save game state about Luna's introduction
This commit is contained in:
parent
03be6d176c
commit
2337da40ae
11
src/chat.rs
11
src/chat.rs
|
@ -834,6 +834,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 prefs: ResMut<var::Preferences>,
|
||||||
id2pos: Res<game::Id2Pos>,
|
id2pos: Res<game::Id2Pos>,
|
||||||
id2v: Res<game::Id2V>,
|
id2v: Res<game::Id2V>,
|
||||||
) {
|
) {
|
||||||
|
@ -941,6 +942,10 @@ pub fn handle_chat_scripts(
|
||||||
"drinkpizza" => {
|
"drinkpizza" => {
|
||||||
ew_achievement.send(game::AchievementEvent::DrinkPizza);
|
ew_achievement.send(game::AchievementEvent::DrinkPizza);
|
||||||
}
|
}
|
||||||
|
"save_state_luna_intro" => {
|
||||||
|
prefs.state_luna_intro = true;
|
||||||
|
prefs.save();
|
||||||
|
}
|
||||||
_ => {
|
_ => {
|
||||||
error!("Error, undefined chat script {name}");
|
error!("Error, undefined chat script {name}");
|
||||||
}
|
}
|
||||||
|
@ -951,6 +956,7 @@ pub fn handle_chat_scripts(
|
||||||
pub fn update_chat_variables(
|
pub fn update_chat_variables(
|
||||||
mut vars: ResMut<var::GameVars>,
|
mut vars: ResMut<var::GameVars>,
|
||||||
q_player: Query<&actor::Suit, With<actor::Player>>,
|
q_player: Query<&actor::Suit, With<actor::Player>>,
|
||||||
|
prefs: ResMut<var::Preferences>,
|
||||||
) {
|
) {
|
||||||
if let Ok(suit) = q_player.get_single() {
|
if let Ok(suit) = q_player.get_single() {
|
||||||
vars.set_in_scope(
|
vars.set_in_scope(
|
||||||
|
@ -963,5 +969,10 @@ pub fn update_chat_variables(
|
||||||
"player_suit_health_percent",
|
"player_suit_health_percent",
|
||||||
((suit.integrity * 100.0).round() as u8).to_string(),
|
((suit.integrity * 100.0).round() as u8).to_string(),
|
||||||
);
|
);
|
||||||
|
vars.set_in_scope(
|
||||||
|
"$",
|
||||||
|
"state_luna_intro",
|
||||||
|
if prefs.state_luna_intro { 1 } else { 0 }.to_string(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -364,6 +364,24 @@
|
||||||
- No problem at all!
|
- No problem at all!
|
||||||
- set: grateful 0
|
- set: grateful 0
|
||||||
- goto: mainnode
|
- goto: mainnode
|
||||||
|
- if: "$$state_luna_intro"
|
||||||
|
Outer Woods:
|
||||||
|
- if $explained:
|
||||||
|
- ...
|
||||||
|
- Yes, Outer Woods.
|
||||||
|
- At some point in my life, I made up various phrases which I can tell someone who claims to be able to travel back in time.
|
||||||
|
- The idea is, if someone will ever tell me one of those phrase *before* I tell them, it proves their time travel story.
|
||||||
|
- But... You're telling me the phrase *after* I told you.
|
||||||
|
- So you are proving nothing.
|
||||||
|
- Go kill yourself, show me how you magically wake up, and *then* tell me the phrase.
|
||||||
|
- goto: mainnode
|
||||||
|
- if ~$explained:
|
||||||
|
- Wh...
|
||||||
|
- How?
|
||||||
|
- YOU'RE AN ACTUAL TIME TRAVELER!
|
||||||
|
- Ok, I believe you now.
|
||||||
|
- My script is not finished though, so I won't do anything about it. *shrug*
|
||||||
|
- goto: mainnode
|
||||||
- What are you up to?:
|
- What are you up to?:
|
||||||
- I'm running a workshop. Come by if you need any repairs!
|
- I'm running a workshop. Come by if you need any repairs!
|
||||||
- Tinkering on various projects.
|
- Tinkering on various projects.
|
||||||
|
@ -458,7 +476,7 @@
|
||||||
- I just want to get away. From all this insanity, triviality, stupor...
|
- I just want to get away. From all this insanity, triviality, stupor...
|
||||||
- Just want to create, without anyone standing in my way.
|
- Just want to create, without anyone standing in my way.
|
||||||
- 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?:
|
||||||
- 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.
|
||||||
|
@ -474,6 +492,8 @@
|
||||||
- Fascinating.
|
- Fascinating.
|
||||||
- I don't believe you.
|
- I don't believe you.
|
||||||
- But there is obviously one way we can easily validate this.
|
- But there is obviously one way we can easily validate this.
|
||||||
|
- set: $explained
|
||||||
|
- script: save_state_luna_intro
|
||||||
- "Kill yourself. Then come back to me, and make the first thing you say to me: Outer Woods."
|
- "Kill yourself. Then come back to me, and make the first thing you say to me: Outer Woods."
|
||||||
- That's genius.:
|
- That's genius.:
|
||||||
- Thank you!
|
- Thank you!
|
||||||
|
|
|
@ -455,6 +455,9 @@ pub struct Preferences {
|
||||||
pub shadows_sun: bool,
|
pub shadows_sun: bool,
|
||||||
pub avatar: usize,
|
pub avatar: usize,
|
||||||
|
|
||||||
|
// permanent game state
|
||||||
|
pub state_luna_intro: bool,
|
||||||
|
|
||||||
#[serde(skip)]
|
#[serde(skip)]
|
||||||
pub source_file: Option<String>,
|
pub source_file: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue