From b5b3f2c424342ce7e6feb5147171524e457cc2cd Mon Sep 17 00:00:00 2001 From: hut Date: Tue, 19 Mar 2024 23:44:00 +0100 Subject: [PATCH] implement chat levels (like log levels) in conversations.scn.ron --- assets/scenes/conversations.scn.ron | 11 +++++++++++ src/actor.rs | 9 ++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/assets/scenes/conversations.scn.ron b/assets/scenes/conversations.scn.ron index 869cdbb..203acd8 100644 --- a/assets/scenes/conversations.scn.ron +++ b/assets/scenes/conversations.scn.ron @@ -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", ), diff --git a/src/actor.rs b/src/actor.rs index df4d832..6dd4af8 100644 --- a/src/actor.rs +++ b/src/actor.rs @@ -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; }