From 398266ea839511967fcabcb39adee73b16926376 Mon Sep 17 00:00:00 2001 From: yuni Date: Wed, 31 Jul 2024 05:04:21 +0200 Subject: [PATCH] add a chat for Luna, he now repairs suit and refills oxygen tank --- src/chat.rs | 5 +++++ src/chats/serenity.yaml | 29 ++++++++++++++++++++++++++--- src/data/defs.txt | 1 + 3 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/chat.rs b/src/chat.rs index 19c3083..0bd53ca 100644 --- a/src/chat.rs +++ b/src/chat.rs @@ -958,5 +958,10 @@ pub fn update_chat_variables( "player_oxygen_seconds", (suit.oxygen / nature::OXY_S).to_string(), ); + vars.set_in_scope( + "$", + "player_suit_health_percent", + ((suit.integrity * 100.0).round() as u8).to_string(), + ); } } diff --git a/src/chats/serenity.yaml b/src/chats/serenity.yaml index 63100e0..17691c4 100644 --- a/src/chats/serenity.yaml +++ b/src/chats/serenity.yaml @@ -345,10 +345,33 @@ - chat: Luna +- "if $$player_suit_health_percent < 100": + - Holy shit! + - Look at all those scratches and tears on your suit! + - Let me fix that! + - set: grateful + - script: repairsuit + - "if $$player_oxygen_seconds <= 2000": + - And I topped off your oxygen tank while I'm at it. + - script: refilloxygen 1 + - goto: mainnode +- "if $$player_oxygen_seconds <= 2000": + - Hey, do I see an empty oxygen tank? Have a refill, buddy! + - script: refilloxygen 1 + - set: grateful + - goto: mainnode - Oh hey you! -- include: generic_help_oxygen_entrypoint -- goto: EXIT -- include: generic_help_oxygen_handler +- label: mainnode +- if: "$grateful" + Thank you so much!: + - No problem at all! + - set: grateful 0 +- What are you up to?: + - I'm running a workshop here. Come by if you need any repairs! +- See you around!: + - Bye! + - goto: EXIT +- goto: mainnode --- diff --git a/src/data/defs.txt b/src/data/defs.txt index 50733d2..8d2f107 100644 --- a/src/data/defs.txt +++ b/src/data/defs.txt @@ -272,6 +272,7 @@ scene 10 -30 20 test relativeto player actor 700 -100 -1100 suitv2 + template person relativeto player name Luna id Luna