implement chat levels (like log levels) in conversations.scn.ron

This commit is contained in:
yuni 2024-03-19 23:44:00 +01:00
parent d6291061c9
commit b5b3f2c424
2 changed files with 19 additions and 1 deletions

View file

@ -9,6 +9,7 @@
label: "INIT",
delay: 2.0,
sound: "ping",
level: "info",
reply: "Requesting permission to communicate...",
goto: "requested",
),
@ -22,6 +23,7 @@
label: "requested",
delay: 4.0,
sound: "chat",
level: "chat",
reply: "Oh hey there!",
goto: "sup",
),
@ -35,6 +37,7 @@
label: "sup",
delay: 8.0,
sound: "chat",
level: "chat",
reply: "Didn't even notice you! Was playing some VR game! What's up?",
goto: "reply1",
),
@ -48,6 +51,7 @@
label: "reply1",
delay: 3.5,
sound: "chat",
level: "chat",
reply: "Not so chatty, huh? That's ok. See you around.",
goto: "pizza",
),
@ -61,6 +65,7 @@
label: "pizza",
delay: 1.5,
sound: "chat",
level: "chat",
reply: "Make sure to check out the Pizza place.",
goto: "disco",
),
@ -74,6 +79,7 @@
label: "disco",
delay: 0.0,
sound: "ping",
level: "info",
reply: "Disconnected.",
goto: "EXIT",
),
@ -87,6 +93,7 @@
label: "INIT",
delay: 1.0,
sound: "ping",
level: "chat",
reply: "Requesting permission to communicate...",
goto: "requested",
),
@ -100,6 +107,7 @@
label: "requested",
delay: 5.0,
sound: "chat",
level: "chat",
reply: "Welcome to Space Pizza™, best pizza all across the Jovian rings!",
goto: "ask",
),
@ -113,6 +121,7 @@
label: "ask",
delay: 10.0,
sound: "chat",
level: "chat",
reply: "Would you like to order today's special Miracle Spacefungi? Freshly blended pizza smoothie ready for your space suit feeding tube!",
goto: "hello?",
),
@ -126,6 +135,7 @@
label: "hello?",
delay: 10.0,
sound: "chat",
level: "chat",
reply: "Hello? Are you still there?",
goto: "disco",
),
@ -139,6 +149,7 @@
label: "disco",
delay: 0.0,
sound: "ping",
level: "info",
reply: "Disconnected.",
goto: "EXIT",
),

View file

@ -59,6 +59,7 @@ pub struct ChatBranch {
pub label: String,
pub delay: f64,
pub sound: String,
pub level: String,
pub reply: String,
pub goto: String,
}
@ -229,7 +230,13 @@ pub fn handle_conversations(
continue;
}
let branch = branches[0];
log.chat(branch.reply.clone(), branch.name.clone());
match branch.level.as_str() {
"chat" => log.chat(branch.reply.clone(), branch.name.clone()),
"info" => log.info(branch.reply.clone()),
_ => (),
}
if chat.label == "EXIT" {
continue;
}