Compare commits

..

46 commits

Author SHA1 Message Date
yuni a670778fb0 WIP new pizza dialogue 2024-04-14 05:09:34 +02:00
yuni 8c12d96774 cleanup 2024-04-14 04:56:34 +02:00
yuni f5c397dfe1 typos 2024-04-14 04:56:28 +02:00
yuni c44c22e658 update cheat teleport destinations 2024-04-14 04:40:42 +02:00
yuni a9ebaf0a5f fix delay with showing responses for Bus Stop Clippy 2024-04-14 04:14:04 +02:00
yuni 69fce751d9 move Oscillation Station to a more scenic place for now 2024-04-14 04:13:51 +02:00
yuni dad7fc8fc4 add safety check 2024-04-14 03:37:33 +02:00
yuni 86217d121e Merge branch 'yamlchat' 2024-04-14 03:32:56 +02:00
yuni 01453e46f8 implement "include" token for chats 2024-04-14 03:24:06 +02:00
yuni 43f67877a2 delete src/chat_old.rs (\o/) 2024-04-14 01:20:22 +02:00
yuni 0b22494751 fix conversation timings, seek past choices when dropping out of branches 2024-04-14 01:16:37 +02:00
yuni 39a74582fc implement specifying custom chat sounds per message with "sound" token 2024-04-13 23:35:59 +02:00
yuni 4b4be21ade cleanup 2024-04-13 23:22:00 +02:00
yuni 699bb4f563 implement chat sounds 2024-04-13 23:21:53 +02:00
yuni b06e54a0d9 implement sleep token for chats 2024-04-13 23:03:41 +02:00
yuni fbc6dea13e implement goto token in chats 2024-04-13 22:43:58 +02:00
yuni 9176caa372 implement chat scripts 2024-04-13 22:10:13 +02:00
yuni 08ec42c043 handle msg/system/warn tokens 2024-04-13 21:45:05 +02:00
yuni cc72fa1b31 cleanup, fixes 2024-04-13 21:14:46 +02:00
yuni 5bc76a3e2f proper exiting of conversation branches 2024-04-13 20:59:55 +02:00
yuni e7df698225 implement choice selection 2024-04-13 20:23:51 +02:00
yuni 8df6914dba WIP choices 2024-04-13 18:57:23 +02:00
yuni e8302833da implement stack-based conversation position 2024-04-13 17:59:52 +02:00
yuni d990726932 switched from yaml_rust to serde_yaml 2024-04-13 17:33:14 +02:00
yuni 57f0e94bc6 WIP stack-based conversation position 2024-04-13 16:03:15 +02:00
yuni ef9d9c8fcc cleanup 2024-04-13 16:03:07 +02:00
yuni 826638416f detect choice selection keys 2024-04-13 15:44:23 +02:00
yuni 2b0de07427 remove TIMEOUT "choices", handle it with labels instead 2024-04-13 15:40:19 +02:00
yuni 9698dcdfee render choices 2024-04-13 15:26:45 +02:00
yuni 9cd1cf19e2 WIP choice spawning 2024-04-13 12:24:56 +02:00
yuni 1fd0481ec4 implement chat speed setting 2024-04-13 01:34:18 +02:00
yuni c0672f0ad8 implement showing names of conversation partners 2024-04-13 01:25:57 +02:00
yuni eff6306a93 implement showing all first-level messages of a chat 2024-04-13 01:22:01 +02:00
yuni b41891ba3b implement showing the first message of a chat 2024-04-13 00:39:21 +02:00
yuni 45d3408f0c cleanup 2024-04-13 00:11:32 +02:00
yuni 2aaecdc113 start implementing ChatDB.advance_chat() 2024-04-13 00:05:42 +02:00
yuni ca709080eb spawn chat entity. limit number of chats to 1 2024-04-12 23:28:15 +02:00
yuni 14ef824b17 actual nice code 2024-04-12 23:18:07 +02:00
yuni ad8efd60d5 an attempt at nicer code... 2024-04-12 23:13:55 +02:00
yuni a572959df3 implement looking up chat id 2024-04-12 23:06:31 +02:00
yuni 253604e9aa cleanup 2024-04-12 21:45:36 +02:00
yuni 0117a6d4d2 load chat yaml files 2024-04-12 21:26:23 +02:00
yuni b9528b3637 split off startrans chats into separate yaml file 2024-04-12 21:25:59 +02:00
yuni 56385b257d rip out existing chat implementation
(this was SO satisfying)
2024-04-12 20:49:26 +02:00
yuni 5ca31fda65 add chat definitions in YAML format (integration still needed) 2024-04-12 20:37:19 +02:00
yuni b53545ce2c minor tweaks to conversations 2024-04-12 20:10:10 +02:00
10 changed files with 1145 additions and 645 deletions

21
Cargo.lock generated
View file

@ -2776,6 +2776,8 @@ dependencies = [
"bevy_xpbd_3d", "bevy_xpbd_3d",
"fastrand", "fastrand",
"regex", "regex",
"serde",
"serde_yaml",
] ]
[[package]] [[package]]
@ -3266,6 +3268,19 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "serde_yaml"
version = "0.9.34+deprecated"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47"
dependencies = [
"indexmap",
"itoa",
"ryu",
"serde",
"unsafe-libyaml",
]
[[package]] [[package]]
name = "sharded-slab" name = "sharded-slab"
version = "0.1.7" version = "0.1.7"
@ -3673,6 +3688,12 @@ version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c"
[[package]]
name = "unsafe-libyaml"
version = "0.2.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861"
[[package]] [[package]]
name = "uuid" name = "uuid"
version = "1.7.0" version = "1.7.0"

View file

@ -15,6 +15,8 @@ bevy = { version = "0.13.1", default-features = false, features = ["jpeg", "bevy
bevy_xpbd_3d = { version = "0.4.2", default-features = false, features = ["3d", "f64", "parry-f64", "parallel", "async-collider"] } bevy_xpbd_3d = { version = "0.4.2", default-features = false, features = ["3d", "f64", "parry-f64", "parallel", "async-collider"] }
bevy_embedded_assets = "0.10.2" bevy_embedded_assets = "0.10.2"
fastrand = "2.0.2" fastrand = "2.0.2"
serde = "1.0"
serde_yaml = "0.9"
[features] [features]
dev = ["bevy/dynamic_linking", "bevy/file_watcher"] dev = ["bevy/dynamic_linking", "bevy/file_watcher"]

File diff suppressed because it is too large Load diff

200
src/chats/serenity.yaml Normal file
View file

@ -0,0 +1,200 @@
- chat: Drifter
- system: "Error: No response"
- system: No life signs detected
- Damn, it's gotta be moldy in that suit. How long has it been drifting?:
- Harvest some oxygen:
- script: refilloxygen 1 Drifter
---
- chat: SubduedClippy
- At your service!
---
- chat: Icarus
- Oh hey, you're awake!
- I found you drifting out cold, and thought, I better watch over you.
- Took us here behind that moonlet, to shield you from the micros.
- Thank you!:
- label: thx
- No worries. Folks are stretched thin around this corner, we gotta watch out for each other.
- How are you feeling?
- goto: howru
- I didn't ask for this.:
- label: didntask
- "Sure, 'cause you were unconscious. I just did what felt right. Is there a problem?"
- Nevermind. Thank you.:
- goto: thx
- Leave me alone!:
- goto: EXIT
- Micros? What's that?:
- Micrometeorites. Those tiny 混蛋 that fly right through you, leaving holes in your suit. And your body.
- Ouch! Thank you so much.:
- goto: thx
- Whatever... I didn't ask for this.:
- goto: didntask
- How are you feeling?
- label: howru
- I feel quite cozy, this space suit feels like a second skin.:
- set: friends
- Hah, it does, doesn't it?
- But take care, your suit seems to be leaking. I'd patch it up if I were you.
- I'm all out of SuitPatch™ SuperGlue™ right now, otherwise I'd share.
- Can I help you with anything else, maybe?
- I got this apocalyptic headache...:
- set: friends
- Heh, probably related to why you were passed out.
- Go easy on yourself, I'm sure things will turn for the better.
- Meanwhile, can I help you with anything?
- I... don't know, I'm pretty disoriented.:
- set: friends
- Oh no. Do you need a lowdown on reality?
- I just want to be alone right now:
- Oh, sure. Ping me if you need anything. I'll go back to playing my VR game.
- goto: EXIT
- label: help
- Where are we?:
- This is space, my friend.
- That massive crescent over there, that's Jupiter.
- We're about 150,000km away from its surface, on the very outside of it's rings.
- This area is called the Thebe gossamer ring.
- The moon Thebe is actually pretty close right now, flinging all those micros at us.
- Micros? What's that?:
- Micrometeorites. Those tiny 混蛋 that fly right through you, leaving holes in your suit. And your body.
- goto: help
- What year is this?:
- Oh, is your Augmented Reality deactivated?
- Push the TAB button, your space suit's AR will show you the date and time.
- goto: help
- Why am I here?:
- That's a very philosophical question.
- I don't know.
- It's probably related to the choices you made in your life so far.
- goto: help
- What should I do?:
- Ah, that's the beauty of life.
- You can just do whatever you want.
- So long as you have the means, and respect people's boundaries.
- I'm here mostly for the view and the peace.
- Just look at Jupiter, it's mesmerizing, isn't it?
- So far away from everything, nobody expects anything from you.
- If you want, you can take my sports racing capsule MeteorAceGT™ for a ride. It's right over there.
- It rides like a punch in the face, don't hurt yourself, ok?
- You're too kind!:
- Ah, don't mention it!
- There's also a half-decent pizza restaurant over there, look for the neon sign.
- goto: help
- Do you have some money for me?:
- Huh? What is money?
- Currency? Flat round things that you can exchange for goods and services?:
- Uhm... are you talking about pizza?
- I don't have any pizza with me right now.
- But there's a pizza place right over there, look for the neon sign.
- goto: help
- Well, anyway, need anything else?
- goto: help
- I think I'm good for now:
- goto: chocolate
- Well, I hope you're ok.
- label: chocolate
- I got some left-over instant hot chocolate, would you like some?
- Oh yes! Please!:
- Here you go, my friend!
- system: Received 1x ChuggaChug™ Instant Hot Chocolate
- goto: pizzaplace
- No, thank you.:
- Well. I think I'll go back to playing my VR game. Ping me if you need anything.
- label: pizzaplace
- Oh and make sure to check out the pizza place!
- Will do, bye!:
---
- chat: SpacePizzaChef
- Welcome to Space Pizza™, best pizza around the rings!
- Great to see a customer, we don't get many lately
- Would you like to order today's special?
- label: offer
- What's the special?:
- Suspicious Spacefunghi
- With free pineapple imitation
- Our pizza smoothies are freshly blended every day
- Wait... pizza smoothie?:
- Huh? Of course, smoothie! How else do you want to get that pizza down your spacesuit feeding tube?
- An emulsion of deliciousness!
- I think I'll pass...:
- Your loss, mate
- goto: EXIT
- Wh... what's a pizzeria doing here?:
- Hah, beautiful, right? I carved it out this asteroid myself!
- You know how much work it was to neutralize the rotation of the asteroid, so my valued customers don't bang against the walls while drinking my pizza?
- Now would you like today's special or not?
- goto: offer
- My head hurts, my suit leaks, I think I'm dying...:
- Seriously? Let me have a look. Just press the 'Grant Access' button please.
- "[GRANT ACCESS TO SPACESUIT WIFI]":
- label: hack
- warn: MALWARE DETECTED
- warn: BITCOIN MINER DETECTED
- nowait: true
Hey, what are you doing with me?:
- Just checking your systems, hang on tight
- Yeah, suit's fucked, I'd look out for a repair shop
- Anyway, wanna order today's special?
- goto: offer
- "[DENY ACCESS TO SPACESUIT WIFI]":
- Oh come on, do you want my help or not?
- "[GRANT ACCESS TO SPACESUIT WIFI]":
- goto: hack
- "[DENY ACCESS TO SPACESUIT WIFI]":
- Great, the first customer in ages, and they're brain damaged...
- Fuck off!:
- Great, the first customer in ages, and they're brain damaged...
- goto: EXIT
- Hey, are you still there? Is this a prank?
---
- chat: PizzaChef
- Oh hey, you found your way to the legendary Old Earth Pizza!
- Please find yourself a cozy place to drift.
- Do you have a reservation?
- label: reservation
- Reservation? Is there not enough space for everybody?:
- Ah, space there is.
- But I can't get overworked, can I?
- I'm running this joint all by myself, after all.
- Apart of good ol' Clippy.
- goto: reservation
- No reservation. Can I still buy something?:
- '"Buy"? Ah, this old earth thing.'
- I see you have been reading up on history.
- Trying to catch the Old Earth Pizza vibe.
- Amazing.
- Sure, you can "buy" something, watcha want?
- goto: eat
- Can I ask you some... weird questions?:
- Of course. Just hold on, let me load my gun.
- Alright, shoot.
- goto: questions
- I guess not.
- But I can't you leave hungry, can I?
- So far away from everything.
- Just let me know if you want something.
- label: eat
- label: questions

88
src/chats/startrans.yaml Normal file
View file

@ -0,0 +1,88 @@
- chat: NPCinCryoStasis
- system: "Error: No response"
- system: Lifeform in cryostasis detected
---
- chat: ClippyTransSerenity
- set: busstop serenity
- Welcome at StarTrans Cargo Services! You have reached Serenity Station.
- "Ready for a trip? Available bus stops: Oscillation Station, Metis Prime Station"
- label: startransbusstop
- include: BusStops
- label: interesting
- Serenity Station is famous for the best pizza across the Jovian Rings.
- Look for the neon sign of the pizzeria nearby.
---
- chat: ClippyTransMetis
- set: busstop metis
- Welcome at StarTrans Cargo Services! You have reached Metis Prime Station.
- "Ready for a trip? Available bus stops: Oscillation Station, Serenity Station"
- label: startransbusstop
- include: BusStops
- label: interesting
- This area is an industrial paradise for asteroid miners.
- Though it has been recently abandoned due to the excessive particle radiation.
- I advise you to minimize the duration of your stay here.
---
- chat: ClippyTransOscillation
- set: busstop oscillation
- Welcome at StarTrans Cargo Services! You have reached Oscillation Station.
- "Ready for a trip? Available bus stops: Serenity Station, Metis Prime Station"
- label: startransbusstop
- include: BusStops
- label: interesting
- The main attraction around here is the gorgeous view onto Jupiter from far up ahead.
---
- chat: BusStops
- Bus stop?! How does this work?:
- StarTrans Cargo Services is the most convenient way to travel the vast distances of space.
- Just activate your suit's built-in cryostasis. A StarTrans carrier will pick you up and you will wake up at your destination in the blink of an eye.
- Of course we will supply you with free oxygen and ensure your safety.
- goto: startransbusstop
- Can I take a spacecraft with me?:
- Absolutely.
- goto: startransbusstop
- if: busstop != "oscillation"
Take me to Oscillation Station, please.:
- StarTrans wishes you a pleasant journey.
- script: cryofadeout
- sleep: 5
- script: cryotrip oscillation
- goto: EXIT
- if: busstop != "metis"
Take me to Metis Prime Station, please.:
- StarTrans wishes you a pleasant journey.
- script: cryofadeout
- sleep: 5
- script: cryotrip metisprime
- goto: EXIT
- if: busstop != "serenity"
Take me to Serenity Station, please.:
- StarTrans wishes you a pleasant journey.
- script: cryofadeout
- sleep: 5
- script: cryotrip serenity
- goto: EXIT
- Can you please fill up my oxygen tank without taking me anywhere?:
- Of course, you can count on StarTrans!
- script: refilloxygen 1000
- Is there anything interesting to do around here?:
- goto: interesting
- No, thank you.:
- Feel free to come back any time.
- goto: EXIT

View file

@ -22,7 +22,6 @@ impl Plugin for CommandsPlugin {
#[derive(PartialEq, Clone)] #[derive(PartialEq, Clone)]
enum DefClass { enum DefClass {
Actor, Actor,
Chat,
None, None,
} }
@ -69,18 +68,18 @@ struct ParserState {
light_color: Option<Color>, light_color: Option<Color>,
ar_model: Option<String>, ar_model: Option<String>,
// Chat fields // // Chat fields
delay: f64, // delay: f64,
text: String, // text: String,
level: String, // level: String,
label: String, // label: String,
goto: String, // goto: String,
is_choice: bool, // is_choice: bool,
stores_item: bool, // stores_item: bool,
script: String, // script: String,
script_parameter: String, // script_parameter: String,
script_parameter2: String, // script_parameter2: String,
sound: Option<String>, // sound: Option<String>,
} }
impl Default for ParserState { impl Default for ParserState {
fn default() -> Self { fn default() -> Self {
@ -125,50 +124,50 @@ impl Default for ParserState {
light_color: None, light_color: None,
ar_model: None, ar_model: None,
delay: 0.0, // delay: 0.0,
text: "".to_string(), // text: "".to_string(),
level: "chat".to_string(), // level: "chat".to_string(),
label: "".to_string(), // label: "".to_string(),
goto: "".to_string(), // goto: "".to_string(),
is_choice: false, // is_choice: false,
stores_item: false, // stores_item: false,
script: "".to_string(), // script: "".to_string(),
script_parameter: "".to_string(), // script_parameter: "".to_string(),
script_parameter2: "".to_string(), // script_parameter2: "".to_string(),
sound: Some("chat".to_string()), // sound: Some("chat".to_string()),
} }
} }
} }
impl ParserState { impl ParserState {
fn reset_message(&mut self) { // fn reset_message(&mut self) {
let default = ParserState::default(); // let default = ParserState::default();
self.label = default.label; // self.label = default.label;
self.delay = default.delay; // self.delay = default.delay;
self.goto = default.goto; // self.goto = default.goto;
self.level = default.level; // self.level = default.level;
self.text = default.text; // self.text = default.text;
self.is_choice = default.is_choice; // self.is_choice = default.is_choice;
self.script = default.script; // self.script = default.script;
self.script_parameter = default.script_parameter; // self.script_parameter = default.script_parameter;
self.script_parameter2 = default.script_parameter2; // self.script_parameter2 = default.script_parameter2;
self.sound = default.sound; // self.sound = default.sound;
} // }
fn as_chatbranch(&self) -> chat::ChatBranch { // fn as_chatbranch(&self) -> chat::ChatBranch {
return chat::ChatBranch { // return chat::ChatBranch {
id: self.chat.clone(), // id: self.chat.clone(),
name: self.name.clone().unwrap_or("".to_string()), // name: self.name.clone().unwrap_or("".to_string()),
label: self.label.clone(), // label: self.label.clone(),
delay: self.delay.clone(), // delay: self.delay.clone(),
sound: if self.is_choice || self.sound.is_none() { "".to_string() } else { "chat".to_string() }, // sound: if self.is_choice || self.sound.is_none() { "".to_string() } else { "chat".to_string() },
level: self.level.clone(), // level: self.level.clone(),
reply: if self.is_choice { "".to_string() } else { self.text.clone() }, // reply: if self.is_choice { "".to_string() } else { self.text.clone() },
choice: if self.is_choice { self.text.clone() } else { "".to_string() }, // choice: if self.is_choice { self.text.clone() } else { "".to_string() },
goto: self.goto.clone(), // goto: self.goto.clone(),
script: self.script.clone(), // script: self.script.clone(),
script_parameter: self.script_parameter.clone(), // script_parameter: self.script_parameter.clone(),
script_parameter2: self.script_parameter2.clone(), // script_parameter2: self.script_parameter2.clone(),
} // }
} // }
} }
pub fn load_defs( pub fn load_defs(
@ -217,6 +216,11 @@ pub fn load_defs(
} }
match parts.as_slice() { match parts.as_slice() {
["name", name] => {
debug!("Registering name: {}", name);
state.name = Some(name.to_string());
}
// Parsing actors // Parsing actors
["actor", x, y, z, model] => { ["actor", x, y, z, model] => {
ew_spawn.send(SpawnEvent(state)); ew_spawn.send(SpawnEvent(state));
@ -468,106 +472,102 @@ pub fn load_defs(
} }
// Parsing chats // Parsing chats
["chat", chat_name] => { // ["chat", chat_name] => {
debug!("Registering chat: {}", chat_name); // debug!("Registering chat: {}", chat_name);
ew_spawn.send(SpawnEvent(state)); // ew_spawn.send(SpawnEvent(state));
state = ParserState::default(); // state = ParserState::default();
state.class = DefClass::Chat; // state.class = DefClass::Chat;
state.chat = chat_name.to_string(); // state.chat = chat_name.to_string();
} // }
["name", name] => { // ["msg", sleep, text] => {
debug!("Registering name: {}", name); // debug!("Registering message (sleep={}): {}", sleep, text);
state.name = Some(name.to_string()); // ew_spawn.send(SpawnEvent(state.clone()));
} // if let Ok(sleep_float) = sleep.parse::<f64>() {
["msg", sleep, text] => { // state.delay = sleep_float;
debug!("Registering message (sleep={}): {}", sleep, text); // state.text = text.to_string();
ew_spawn.send(SpawnEvent(state.clone())); // state.stores_item = true;
if let Ok(sleep_float) = sleep.parse::<f64>() { // state.is_choice = false;
state.delay = sleep_float; // } else {
state.text = text.to_string(); // error!("The 'sleep' value for this message is not a float: {}", line);
state.stores_item = true; // continue;
state.is_choice = false; // }
} else { // }
error!("The 'sleep' value for this message is not a float: {}", line); // ["msg", sleep, label, goto, text] => {
continue; // debug!("Registering message (sleep={}): {}", sleep, text);
} // ew_spawn.send(SpawnEvent(state.clone()));
} // state.reset_message();
["msg", sleep, label, goto, text] => { // if let Ok(sleep_float) = sleep.parse::<f64>() {
debug!("Registering message (sleep={}): {}", sleep, text); // state.delay = sleep_float;
ew_spawn.send(SpawnEvent(state.clone())); // state.text = text.to_string();
state.reset_message(); // state.stores_item = true;
if let Ok(sleep_float) = sleep.parse::<f64>() { // state.is_choice = false;
state.delay = sleep_float; // state.goto = goto.to_string();
state.text = text.to_string(); // state.label = label.to_string();
state.stores_item = true; // } else {
state.is_choice = false; // error!("The 'sleep' value for this message is not a float: {}", line);
state.goto = goto.to_string(); // continue;
state.label = label.to_string(); // }
} else { // }
error!("The 'sleep' value for this message is not a float: {}", line); // ["choice", sleep, text] => {
continue; // debug!("Registering choice (sleep={}): {}", sleep, text);
} // ew_spawn.send(SpawnEvent(state.clone()));
} // state.reset_message();
["choice", sleep, text] => { // if let Ok(sleep_float) = sleep.parse::<f64>() {
debug!("Registering choice (sleep={}): {}", sleep, text); // state.delay = sleep_float;
ew_spawn.send(SpawnEvent(state.clone())); // state.text = text.to_string();
state.reset_message(); // state.stores_item = true;
if let Ok(sleep_float) = sleep.parse::<f64>() { // state.is_choice = true;
state.delay = sleep_float; // } else {
state.text = text.to_string(); // error!("The 'sleep' value for this message is not a float: {}", line);
state.stores_item = true; // continue;
state.is_choice = true; // }
} else { // }
error!("The 'sleep' value for this message is not a float: {}", line); // ["choice", sleep, label, goto, text] => {
continue; // debug!("Registering choice (sleep={}): {}", sleep, text);
} // ew_spawn.send(SpawnEvent(state.clone()));
} // state.reset_message();
["choice", sleep, label, goto, text] => { // if let Ok(sleep_float) = sleep.parse::<f64>() {
debug!("Registering choice (sleep={}): {}", sleep, text); // state.delay = sleep_float;
ew_spawn.send(SpawnEvent(state.clone())); // state.text = text.to_string();
state.reset_message(); // state.stores_item = true;
if let Ok(sleep_float) = sleep.parse::<f64>() { // state.is_choice = true;
state.delay = sleep_float; // state.goto = goto.to_string();
state.text = text.to_string(); // state.label = label.to_string();
state.stores_item = true; // } else {
state.is_choice = true; // error!("The 'sleep' value for this message is not a float: {}", line);
state.goto = goto.to_string(); // continue;
state.label = label.to_string(); // }
} else { // }
error!("The 'sleep' value for this message is not a float: {}", line); // ["goto", label] => {
continue; // debug!("Registering goto: {}", label);
} // state.goto = label.to_string();
} // }
["goto", label] => { // ["label", label] => {
debug!("Registering goto: {}", label); // debug!("Registering label: {}", label);
state.goto = label.to_string(); // state.label = label.to_string();
} // }
["label", label] => { // ["lvl", level] => {
debug!("Registering label: {}", label); // debug!("Registering level: {}", level);
state.label = label.to_string(); // state.level = level.to_string();
} // }
["lvl", level] => { // ["script", scriptname] => {
debug!("Registering level: {}", level); // state.script = scriptname.to_string();
state.level = level.to_string(); // state.script_parameter = "".to_string();
} // state.script_parameter2 = "".to_string();
["script", scriptname] => { // }
state.script = scriptname.to_string(); // ["script", scriptname, parameter] => {
state.script_parameter = "".to_string(); // state.script = scriptname.to_string();
state.script_parameter2 = "".to_string(); // state.script_parameter = parameter.to_string();
} // state.script_parameter2 = "".to_string();
["script", scriptname, parameter] => { // }
state.script = scriptname.to_string(); // ["script", scriptname, parameter, parameter2] => {
state.script_parameter = parameter.to_string(); // state.script = scriptname.to_string();
state.script_parameter2 = "".to_string(); // state.script_parameter = parameter.to_string();
} // state.script_parameter2 = parameter2.to_string();
["script", scriptname, parameter, parameter2] => { // }
state.script = scriptname.to_string(); // ["sound", "none"] => {
state.script_parameter = parameter.to_string(); // state.sound = None;
state.script_parameter2 = parameter2.to_string(); // }
}
["sound", "none"] => {
state.sound = None;
}
_ => { _ => {
error!("No match for [{}]", parts.join(",")); error!("No match for [{}]", parts.join(","));
} }
@ -585,13 +585,7 @@ fn spawn_entities(
) { ) {
for state_wrapper in er_spawn.read() { for state_wrapper in er_spawn.read() {
let state = &state_wrapper.0; let state = &state_wrapper.0;
if state.class == DefClass::Chat { if state.class == DefClass::Actor {
if state.stores_item {
let mut chat = commands.spawn(state.as_chatbranch());
chat.insert(world::DespawnOnPlayerDeath);
}
}
else if state.class == DefClass::Actor {
let actor_entity; let actor_entity;
{ {
let mut actor = commands.spawn_empty(); let mut actor = commands.spawn_empty();
@ -699,7 +693,9 @@ fn spawn_entities(
if !state.chat.is_empty() { if !state.chat.is_empty() {
actor.insert(chat::Talker { actor.insert(chat::Talker {
conv_id: state.chat.clone(), conv_id: state.chat.clone(),
..default() name: state.name.clone(),
pronoun: Some(state.pronoun.clone()),
talking_speed: 1.0,
}); });
} }
if state.is_vehicle { if state.is_vehicle {

View file

@ -179,15 +179,12 @@ actor -3300 10 0 pizzeria
thrust 15 6 3 400 0.5 thrust 15 6 3 400 0.5
rotationy -0.5 rotationy -0.5
scale 3 scale 3
chatid pizzaclippy chatid SubduedClippy
chat pizzaclippy
name "Clippy™ Convenience Companion"
msg 4 INIT EXIT "At your service!"
actor -35 0 0 suit actor -35 0 0 suit
relativeto pizzeria relativeto pizzeria
name "Space Pizza™" name "Space Pizza™"
chatid pizzeria chatid SpacePizzaChef
armodel suit_ar_chefhat armodel suit_ar_chefhat
alive yes alive yes
scale 2 scale 2
@ -198,55 +195,11 @@ actor -3300 10 0 pizzeria
rotationy 1 rotationy 1
angularmomentum 0 0 0 angularmomentum 0 0 0
pronoun he pronoun he
chat pizzeria
name "Space Pizza™"
msg 4 INIT cool "Welcome to Space Pizza™, best pizza around the rings!"
msg 4 cool order "Great to see a customer, we don't get many lately"
msg 50 order special "Would you like to order today's special?"
choice 3 special whatsthespecial "What's the special?"
msg 4 whatsthespecial pineapple "Suspicious Spacefunghi"
msg 4 pineapple smoothie "With free pineapple imitation"
msg 7 smoothie tube "Our pizza smoothies are freshly blended every day"
choice 3 tube wtftube "Wait... pizza smoothie?"
msg 6 wtftube anyway "Huh? Of course, smoothie! How else do you want to get that pizza down your spacesuit feeding tube?"
msg 6 anyway pass "An emulsion of deliciousness!"
msg 30 tube pass "Deliciousness for your spacesuit feeding tube!"
choice 3 pass yourloss "I think I'll pass..."
msg 3 yourloss end "Your loss, mate"
msg 3 pass prank "Hey? Are you still there?"
choice 3 special carved "Wh... what's a pizzeria doing here?"
msg 6 carved work "Hah, beautiful, right? I carved it out this asteroid myself!"
msg 7 work nowwannaorder "You know how much work it was to neutralize the rotation of the asteroid, so my valued customers don't bang against the walls while drinking my pizza?"
msg 20 nowwannaorder special "Now would you like today's special or not?"
choice 3 special ohno "My head hurts, my suit leaks, I think I'm dying..."
msg 20 ohno pressok "Seriously? Let me have a look. Just press the 'Grant Access' button please."
choice 3 pressok virus "[GRANT ACCESS TO SPACESUIT WIFI]"
msg 3 virus bitcoin "MALWARE DETECTED"
lvl warn
msg 6 bitcoin wtf "BITCOIN MINER DETECTED"
lvl warn
choice 5 wtf justchecking "Hey, what are you doing with me?"
msg 6 justchecking suitfucked "Just checking your systems, hang on tight"
msg 5 suitfucked wtfanyway "Yeah, suit's fucked, I'd look out for a repair shop"
msg 5 wtf wtfanyway "Yeah, suit's fucked, I'd look out for a repair shop"
msg 5 wtfanyway special "Anyway, wanna order today's special?"
choice 3 pressok deny "[DENY ACCESS TO SPACESUIT WIFI]"
msg 5 deny pressok2 "Oh come on, do you want my help or not?"
choice 3 pressok2 virus "[GRANT ACCESS TO SPACESUIT WIFI]"
choice 3 pressok2 deny2 "[DENY ACCESS TO SPACESUIT WIFI]"
choice 3 pressok2 deny2 "Fuck off!"
msg 2 deny2 end "Great, the first customer in ages, and they're brain damaged..."
msg 3 pressok2 prank "Hey? Are you still there?"
msg 3 pressok prank "Hey? Are you still there?"
msg 3 special prank "Hey? Are you still there?"
msg 4 prank end "This a prank?"
msg 0 end EXIT "Disconnected."
lvl info
actor 60 -15 -40 suit actor 60 -15 -40 suit
relativeto player relativeto player
name Icarus name Icarus
chatid hi_icarus chatid Icarus
alive yes alive yes
scale 2 scale 2
collider capsule 1 0.5 collider capsule 1 0.5
@ -257,109 +210,15 @@ actor 60 -15 -40 suit
wants maxrotation 0.5 wants maxrotation 0.5
wants maxvelocity 0 wants maxvelocity 0
pronoun it pronoun it
chat hi_icarus
name Icarus
msg 4 INIT hi1 "Oh hey, you're awake!"
msg 6 hi1 hi2 "I found you drifting out cold, and decided to watch over you until you get better."
msg 40 hi2 hireply "Took us here behind that moonlet, to shield you from the micros."
choice 1 hireply thx "Thank you!"
msg 6 thx feeling "No worries. Folks are stretched thin around this corner, we gotta watch out for each other."
msg 40 feeling howru "How are you feeling?"
choice 1 hireply didntask "Eh... I didn't ask for this."
msg 6 didntask problem "Sure, 'cause you were unconscious. I just did what felt right. Is there a problem?"
choice 1 problem thx "Nevermind. Thank you."
choice 1 problem end "Leave me alone!"
choice 1 hireply micros "Micros? What's that?"
msg 40 micros microsexplained "Micrometeorites. Those tiny 混蛋 that fly right through you, leaving holes in your suit. And your body."
choice 1 microsexplained thx "Ouch! Thank you so much."
choice 1 microsexplained didntask "Whatever... I didn't ask for this."
msg 40 microsexplained howru "How are you feeling?"
msg 40 hireply howru "How are you feeling?"
choice 1 howru good1 "I feel quite cozy, this space suit feels like a second skin."
msg 4 good1 good2 "Hah, it does, doesn't it?"
msg 4 good2 good3 "But take care, your suit seems to be leaking. I'd patch it up if I were you."
msg 4 good3 good4 "I'm all out of SuitPatch™ SuperGlue™ right now, otherwise i'd share."
msg 40 good4 canihelp "Can I help you with anything else, maybe?"
choice 1 howru headache1 "I got this apocalyptic headache..."
msg 4 headache1 headache2 "Heh, probably related to why you were passed out."
msg 4 headache2 headache3 "Go easy on yourself, I'm sure things will turn for the better."
msg 40 headache3 canihelp "Meanwhile, can I help you with anything?"
choice 1 howru disoriented "I... don't know, I'm pretty disoriented."
msg 40 disoriented canihelp "Oh no. Do you need a lowdown on reality?"
choice 1 canihelp where1 "Where are we?"
msg 4 where1 where2 "This is space, my friend."
msg 4 where2 where3 "That massive crescent over there, that's Juptiter."
msg 4 where3 where4 "We're about 150,000km away from it, on the very outside of it's rings."
msg 4 where4 where5 "This area is called the Thebe gossamer ring."
msg 4 where5 where6 "The moon Thebe is actually pretty close right now, flinging all those micros at us."
choice 4 where6 where6micros "Micros? What's that?"
msg 4 where6micros canihelp "Micrometeorites. Those tiny 混蛋 that fly right through you, leaving holes in your suit. And your body."
msg 40 where6 canihelp "Anything else?"
choice 1 canihelp year1 "What year is this?"
msg 4 year1 year2 "Oh, is your Augmented Reality deactivated?"
msg 40 year2 canihelp "Push the TAB button, your space suit's AR will show you the date and time."
choice 1 canihelp why1 "Why am I here?"
msg 4 why1 why2 "That's a very philosophical question."
msg 4 why2 why3 "I don't know."
msg 40 why3 canihelp "It's probably related to the choices you made so far."
choice 1 canihelp whatnow1 "What should I do?"
msg 4 whatnow1 whatnow2 "Ah, that's the beauty of life."
msg 4 whatnow2 whatnow3 "You can just do whatever you want."
msg 6 whatnow3 whatnow4 "So long as you have the means, and respect people's boundaries."
msg 4 whatnow4 whatnow5 "I'm here mostly for the view and the peace."
msg 4 whatnow5 whatnow6 "Just look at Jupiter, it's mesmerizing, isn't it?"
msg 7 whatnow6 whatnow7 "So far away from everything, nobody expects anything from you."
msg 6 whatnow7 whatnow8 "If you want, you can take my sports racing capsule MeteorAce™ for a ride. It's right over there."
msg 8 whatnow8 whatnow9 "It rides like a punch in the face, don't hurt yourself, ok?"
choice 1 whatnow9 whatnow9tookind "You're too kind!"
msg 4 whatnow9tookind whatnow10 "Ah, don't mention it!"
msg 40 whatnow10 canihelp "There's also a half-decent pizza restaurant over there, look for the neon sign."
msg 40 whatnow9 canihelp "There's also a half-decent pizza restaurant over there, look for the neon sign."
choice 1 canihelp money1 "Do you have some money for me?"
msg 40 money1 money2 "Huh? What is money?"
choice 1 money2 money2currency "Currency? Flat round things that you can exchange for goods and services?"
msg 4 money2currency money2currency2 "Uhm... are you talking about pizza?"
msg 4 money2currency2 money2currency3 "I don't have any pizza with me right now."
msg 4 money2currency3 canihelp "But there's a pizza place right over there, look for the neon sign."
msg 40 money2 canihelp "Well, anyway, need anything else?"
choice 1 canihelp chocolate "I think I'm good for now"
msg 4 canihelp chocolate "Well, anyway."
choice 1 howru alone "I just want to be alone right now"
msg 4 alone end_pizza "Oh, sure. Ping me if you need anything. I'll go back to playing my VR game."
msg 4 howru chocolate "Well, I hope you're ok."
msg 40 chocolate wantchocolate "I got some left-over instant hot chocolate, would you like some?"
choice 1 wantchocolate yeschocolate "Oh yes! Please!"
msg 4 yeschocolate chocolatehere "Here you go, my friend!"
msg 4 chocolatehere pizza "Received 1x ChuggaChug™ Instant Hot Chocolate"
lvl info
msg 4 wantchocolate pizza "I guess not. Well. I think I'll go back to playing my VR game. Ping me if you need anything."
msg 10 pizza end_pizza "Oh and make sure to check out the pizza place!"
choice 1 end_pizza end2 "Will do, bye!"
msg 0 end2 EXIT "Disconnected."
lvl info
msg 0 end_pizza EXIT "Disconnected."
lvl info
msg 0 end EXIT "Disconnected."
lvl info
actor -300 0 40 suit actor -300 0 40 suit
relativeto player relativeto player
id drifter id Drifter
name "Drifter" name "Drifter"
chatid drifter chatid Drifter
oxygen 0.08 oxygen 0.08
scale 2 scale 2
collider capsule 1 0.5 collider capsule 1 0.5
chat drifter
name "Drifter"
msg 2 INIT dead "Error: No response"
lvl info
msg 15 dead outcold "No life signs detected"
lvl info
choice 0 outcold EXIT "Damn, it's gotta be moldy in that suit. How long has it been drifting?"
choice 0 outcold EXIT "Harvest some oxygen"
script refilloxygen 1 drifter
msg 0 outcold EXIT ""
actor 100 -18000 2000 "orb_busstop" actor 100 -18000 2000 "orb_busstop"
relativeto player relativeto player
@ -379,42 +238,7 @@ actor 100 -18000 2000 "orb_busstop"
thrust 15 6 3 400 0.5 thrust 15 6 3 400 0.5
rotationy -0.5 rotationy -0.5
scale 3 scale 3
chatid "busstopclippy" chatid ClippyTransSerenity
chat "busstopclippy"
name "StarTrans Clippy™"
msg 2 INIT question "Welcome at StarTrans Cargo Services!"
msg 2 question wait "Ready for a trip? Available bus stops: Oscillation Station, Metis Prime Station"
msg 40 wait answer ""
sound none
choice 2 answer how1 "Bus stop?! How does this work?"
msg 6 how1 how2 "StarTrans Cargo Services is the most convenient way to travel the vast distances of space."
msg 6 how2 how3 "Just activate your suit's built-in cryostasis. A StarTrans carrier will pick you up and you will wake up at your destination in the blink of an eye."
msg 40 how3 answer "Of course we will supply you with free oxygen and ensure your safety."
choice 2 answer vehicle "Can I take a spacecraft with me?"
msg 40 vehicle answer "Absolutely."
choice 1 answer stopA1 "Take me to Oscillation Station, please."
msg 5 stopA1 stopA2 "StarTrans wishes you a pleasant journey."
script cryofadeout
msg 0 stopA2 EXIT ""
script cryotrip oscillation
sound none
choice 1 answer stopB1 "Take me to Metis Prime Station, please."
msg 5 stopB1 stopB2 "StarTrans wishes you a pleasant journey."
script cryofadeout
msg 0 stopB2 EXIT ""
script cryotrip metisprime
choice 1 answer stopC1 "Take me to Serenity Station, please."
msg 5 stopC1 stopC2 "StarTrans wishes you a pleasant journey."
script cryofadeout
msg 0 stopC2 EXIT ""
script cryotrip serenity
choice 1 answer oxy "Can you please fill up my oxygen tank without taking me anywhere?"
msg 2 oxy EXIT "Acceptable."
script refilloxygen 1000
sound none
choice 2 answer bye "No, thank you."
msg 2 bye EXIT "Feel free to come back any time."
msg 0 answer EXIT "Connection terminated."
actor 40 10 40 "orb_busstop" actor 40 10 40 "orb_busstop"
name "Light Orb" name "Light Orb"
relativeto busstopclippy relativeto busstopclippy
@ -439,15 +263,9 @@ actor 100 -18000 2000 "orb_busstop"
thrust 1.2 1 1 400 1.5 thrust 1.2 1 1 400 1.5
scale 2 scale 2
collider capsule 1 0.5 collider capsule 1 0.5
chatid "busstop1clippynpc1" chatid NPCinCryoStasis
chat "busstop1clippynpc1"
name "Rudy"
msg 3 INIT cryo "Error: No response"
lvl info
msg 0 cryo EXIT "Lifeform in cryostasis detected."
lvl info
actor 147002e3 165001e3 336e6 "orb_busstop" actor -184971e3 149410e3 -134273e3 "orb_busstop"
relativeto jupiter relativeto jupiter
id "busstop2" id "busstop2"
name "StarTrans Bus Station 'Oscillation Station'" name "StarTrans Bus Station 'Oscillation Station'"
@ -465,8 +283,7 @@ actor 147002e3 165001e3 336e6 "orb_busstop"
thrust 15 6 3 400 0.5 thrust 15 6 3 400 0.5
rotationy -0.5 rotationy -0.5
scale 3 scale 3
chatid "busstopclippy" chatid ClippyTransOscillation
chat "busstopclippy"
actor 40 10 40 "orb_busstop" actor 40 10 40 "orb_busstop"
name "Light Orb" name "Light Orb"
relativeto busstopclippy2 relativeto busstopclippy2
@ -502,8 +319,7 @@ actor 27643e3 -44e3 -124434e3 "orb_busstop"
thrust 15 6 3 400 0.5 thrust 15 6 3 400 0.5
rotationy -0.5 rotationy -0.5
scale 3 scale 3
chatid "busstopclippy" chatid ClippyTransMetis
chat "busstopclippy"
actor 40 10 40 "orb_busstop" actor 40 10 40 "orb_busstop"
name "Light Orb" name "Light Orb"
relativeto busstopclippy3 relativeto busstopclippy3
@ -520,7 +336,3 @@ actor 27643e3 -44e3 -124434e3 "orb_busstop"
name "Light Orb" name "Light Orb"
relativeto busstopclippy3 relativeto busstopclippy3
light "47FF00" 1000000 light "47FF00" 1000000
chat error
name ERROR
msg 0 INIT EXIT "Unspecified conversation ID"

View file

@ -11,7 +11,6 @@ pub const HUD_REFRESH_TIME: f32 = 0.1;
pub const FONT: &str = "fonts/Yupiter-Regular.ttf"; pub const FONT: &str = "fonts/Yupiter-Regular.ttf";
pub const LOG_MAX: usize = 20; pub const LOG_MAX: usize = 20;
pub const LOG_MAX_TIME_S: u64 = 20; pub const LOG_MAX_TIME_S: u64 = 20;
pub const CHOICE_NONE: &str = "";
pub const AMBIENT_LIGHT: f32 = 0.0; // Space is DARK pub const AMBIENT_LIGHT: f32 = 0.0; // Space is DARK
pub const AMBIENT_LIGHT_AR: f32 = 15.0; pub const AMBIENT_LIGHT_AR: f32 = 15.0;
//pub const REPLY_NUMBERS: [char; 10] = ['❶', '❷', '❸', '❹', '❺', '❻', '❼', '❽', '❾', '⓿']; //pub const REPLY_NUMBERS: [char; 10] = ['❶', '❷', '❸', '❹', '❺', '❻', '❼', '❽', '❾', '⓿'];
@ -412,7 +411,7 @@ fn update_hud(
q_camera: Query<(&Position, &LinearVelocity), With<actor::PlayerCamera>>, q_camera: Query<(&Position, &LinearVelocity), With<actor::PlayerCamera>>,
mut timer: ResMut<FPSUpdateTimer>, mut timer: ResMut<FPSUpdateTimer>,
mut query: Query<&mut Text, With<GaugesText>>, mut query: Query<&mut Text, With<GaugesText>>,
q_choices: Query<&chat::ChoiceAvailable>, q_choices: Query<&chat::Choice>,
mut query_chat: Query<&mut Text, (With<ChatText>, Without<GaugesText>)>, mut query_chat: Query<&mut Text, (With<ChatText>, Without<GaugesText>)>,
query_all_actors: Query<&actor::Actor>, query_all_actors: Query<&actor::Actor>,
settings: Res<settings::Settings>, settings: Res<settings::Settings>,
@ -522,7 +521,7 @@ fn update_hud(
if count > 9 { if count > 9 {
break; break;
} }
let press_this = REPLY_NUMBERS[count]; let press_this = REPLY_NUMBERS[choice.key];
let reply = &choice.text; let reply = &choice.text;
//let recipient = &choice.recipient; //let recipient = &choice.recipient;
// TODO: indicate recipients if there's more than one // TODO: indicate recipients if there's more than one

View file

@ -1,6 +1,8 @@
use bevy::prelude::*; use bevy::prelude::*;
use std::env; use std::env;
pub const DEFAULT_CHAT_SPEED: f32 = 10.0;
#[derive(Resource)] #[derive(Resource)]
pub struct Settings { pub struct Settings {
pub dev_mode: bool, pub dev_mode: bool,
@ -16,6 +18,7 @@ pub struct Settings {
pub zoom_sensitivity_factor: f32, pub zoom_sensitivity_factor: f32,
pub font_size_hud: f32, pub font_size_hud: f32,
pub font_size_conversations: f32, pub font_size_conversations: f32,
pub chat_speed: f32,
pub hud_active: bool, pub hud_active: bool,
pub is_zooming: bool, pub is_zooming: bool,
pub third_person: bool, pub third_person: bool,
@ -87,7 +90,7 @@ impl Default for Settings {
} }
Settings { Settings {
dev_mode: dev_mode, dev_mode,
god_mode: false, god_mode: false,
mute_sfx: default_mute_sfx, mute_sfx: default_mute_sfx,
mute_music: default_mute_music, mute_music: default_mute_music,
@ -100,6 +103,7 @@ impl Default for Settings {
zoom_sensitivity_factor: 0.25, zoom_sensitivity_factor: 0.25,
font_size_hud: 32.0, font_size_hud: 32.0,
font_size_conversations: 32.0, font_size_conversations: 32.0,
chat_speed: DEFAULT_CHAT_SPEED,
hud_active: false, hud_active: false,
is_zooming: false, is_zooming: false,
third_person: false, third_person: false,

View file

@ -425,15 +425,15 @@ fn handle_cheats(
} }
if key_input.just_pressed(settings.key_cheat_pizza) { if key_input.just_pressed(settings.key_cheat_pizza) {
pos.0 = DVec3::new(-303370.0, 0.0, -500000.0); pos.0 = DVec3::new(-121100218.0, 593057.0, -190818113.0);
gforce.ignore_gforce_seconds = 1.0; gforce.ignore_gforce_seconds = 1.0;
} }
if key_input.just_pressed(settings.key_cheat_farview1) { if key_input.just_pressed(settings.key_cheat_farview1) {
pos.0 = DVec3::new(-1000.0e6, 1000.0e6, -500.0e6); pos.0 = DVec3::new(27643e3, -47e3, -124434e3);
gforce.ignore_gforce_seconds = 1.0; gforce.ignore_gforce_seconds = 1.0;
} }
if key_input.just_pressed(settings.key_cheat_farview2) { if key_input.just_pressed(settings.key_cheat_farview2) {
pos.0 = DVec3::new(1000.0e6, 1000.0e6, -500.0e6); pos.0 = DVec3::new(-184968e3, 149410e3, -134273e3);
gforce.ignore_gforce_seconds = 1.0; gforce.ignore_gforce_seconds = 1.0;
} }
if key_input.pressed(settings.key_cheat_adrenaline_zero) { if key_input.pressed(settings.key_cheat_adrenaline_zero) {