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

View file

@ -59,6 +59,7 @@ pub struct ChatBranch {
pub label: String, pub label: String,
pub delay: f64, pub delay: f64,
pub sound: String, pub sound: String,
pub level: String,
pub reply: String, pub reply: String,
pub goto: String, pub goto: String,
} }
@ -229,7 +230,13 @@ pub fn handle_conversations(
continue; continue;
} }
let branch = branches[0]; 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" { if chat.label == "EXIT" {
continue; continue;
} }