From 90223f4a4caff889b839484ddef56001fe8d7d1a Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Sat, 24 Jun 2023 19:49:18 -0500 Subject: [PATCH] Flexibly edit entity data in dialogue MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … including way better ^_^ dialogue :D face! \o/ editing! --- dialogue.lisp | 33 +++++++++++++++++++++--- flora-search-aurora.lisp | 54 +++++++++++++++++++++------------------- 2 files changed, 58 insertions(+), 29 deletions(-) diff --git a/dialogue.lisp b/dialogue.lisp index eff92f8..1b38c15 100644 --- a/dialogue.lisp +++ b/dialogue.lisp @@ -52,9 +52,21 @@ If not, have some tea on me: I’m paying. =w=" dialogue-tree)) -(defun face (speaker face) - (list - (list :speaker speaker :face face))) +(defun face (speaker face &optional (talking-face nil)) + (if talking-face + (list + (list :speaker speaker + :face face + :set :normal-face + :to face) + (list :speaker speaker + :set :talking-face + :to talking-face)) + (list + (list :speaker speaker + :face face + :set :normal-face + :to face)))) (defun say (speaker &rest keys) @@ -62,7 +74,7 @@ If not, have some tea on me: I’m paying. =w=" (list :speaker speaker :progress 0 :face (or (getf keys :face) 'talking-face) :text (…:getf-lang keys)) - (car (face speaker 'normal-face)))) + (list :speaker speaker :face 'normal-face))) (defun mumble (speaker &rest keys) @@ -119,6 +131,18 @@ talking-face or the face given by the DIALOGUE." (setf (🌍:getf-entity-data map speaker :face) new-face)))) +(defun update-entity-data (map dialogue) + "Given a plist of DIALOGUE, update an arbitrary bit of data in the speaker's +data, using :SET and :TO of the DIALOGUE." + (let* ((speaker (intern (string-upcase (getf dialogue :speaker)))) + (key (getf dialogue :set)) + (data (getf dialogue :to))) + (when (and key data) + (format *error-output* "[~A] ~A → ~A???~%" dialogue key data) + (setf (🌍:getf-entity-data map speaker key) data) + (format *error-output* "~A!!!!~%" (🌍:getf-entity-data map speaker :normal-face))))) + + (defun progress-line-delivery (dialogue) "Progress the delivery of a line (plist) of DIALOGUE. That is, increment the “said character-count” :PROGRESS, which dictates the portion of the message that @@ -162,6 +186,7 @@ coordinates listed in the DIALOGUE’s :COORDS property. … If applicable, ofc. Progress through the lines of dialogue when the user hits ENTER, etc. Returns the state for use with STATE-LOOP, pay attention!" (update-speaking-face map (car dialogue-list)) + (update-entity-data map (car dialogue-list)) (progress-line-delivery (car dialogue-list)) ;; Progress to the next line of dialogue as appropriate. (let* ((dialogue (car dialogue-list)) diff --git a/flora-search-aurora.lisp b/flora-search-aurora.lisp index 603b464..0a82002 100644 --- a/flora-search-aurora.lisp +++ b/flora-search-aurora.lisp @@ -63,31 +63,30 @@ (💬:mumble sasha :en "...") (💬:say "player" :eo "Kielas apud la mar'?" :en "How's the view?") - (💬:face "player" "<.<") + (💬:face "player" "<.<" "o<") + (face "player" "=w=" "=u=") (mumble "player" :eo "Eee.. pardonu." :en "Well... sorry."))) (3 @@ -146,7 +145,7 @@ (:eo "Lasu panjon instrui vin *hik* boooone" :en "Let momma show you a good *hic* timeee") (:eo "kaj mi diris RIKAŜIKA! DIN-DON!" - :en "and then I said BAZINGA! CA-CHOW!")))) + :en "and I said BAZINGA! CA-CHOW!")))) (start-dialogue (apply #'say (append '("boozy-lady") (nth (random (length messages)) messages)))))) @@ -181,20 +180,22 @@ (face gambler "xD ") (mumble gambler :en "Hahaha... haha.") (say gambler :eo "Kia spektalo! Hahaha!" - :en "Good one! Hahaha!" - :face "xDD") + :en "Good one! Hahaha!" + :face "xDD") (say gambler :en "Hahahaha! Hahahahaha!" - :face "x'D") - (face gambler ">V<") + :face "x'D") + (face 'player "^^'") + (face gambler ">V<" ">O<") (say gambler :eo "Tiom amuze! Bona ŝerco!" :en "Shit that's funny!" :face ">V<") + (face 'player "^^\"") (say gambler :eo "Mi tute ruinigis mian vivon! MDR!" :en "I totally fucked my life! LMAO!" :face ">V<") - (say gambler :en "HAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHAHAHAHAHAHAHA" - :face ">O<") - (face gambler "=w=") + (face 'player "o-o" "ouo") + (say gambler :en "HAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAAHAHAHAHAHAHAHAHAHAHAHAHA") + (face gambler "=w=" "=w=") (mumble gambler :en "...") (mumble gambler :eo "Fek'." :en "Fuck."))) @@ -217,7 +218,8 @@ (say gambler :eo "... danke al kiu mia filino povas edukiĝi bone." :en "... thanks to which my daughter can receive a good education.") (say gambler :eo "Kial mi vetis la monprunton tie ĉi?! Fek!!" - :en "Why'd I bet the payment here?! FUCK!!"))) + :en "Why'd I bet the payment here?! FUCK!!" + :face ">O<"))) (2 (start-dialogue (say gambler :eo "Nu, ĉio enordas! Ni simple perdos la domon, jen ĉio." @@ -234,14 +236,16 @@ :en "No life!"))) (3 (start-dialogue - (say gambler :eo "Mi cedu al la mallumo! Tro malfruas al mi!" - :en "I'm giving into the void! It's too late for me!") - (say gambler :eo "Mi memmortigu, ĉu ne, kara amiko? Ĉu neeee?" - :en "I should let go, right, pal? Righttt?") - (say 'player :eo "Ja ne! Je la dioj! Sinjoro, restas al vi fuĝvojo, sendube!" - :en "Of course not! Jesus! Guy, there's still hope for you, somewhere!") - (say gambler :eo "Mi ideas IAN fuĝvojon..." - :en "Five feet under, maybe...")))))) + (say gambler :eo "Mi cedu al la vakuo. Tre komfortas ĉe la fundo, kamarado." + :en "I'm giving into the void. It's quite peaceful down here, pal.") + (say gambler :eo "Mi lasu min falu entute, ĉu ne, kara amiko? Ĉu neee?" + :en "I should let go, right, pal? Righttt?") + (face 'player ";w;" ";o;") + (say 'player :eo "Ne tro senesperu -- sinjoro, restas al vi fuĝvojo, sendube!" + :en "Guy, there's still hope for you, somewhere!") + (face gambler "=v=" "=v=") + (say gambler :eo "Mi ideas IAN fuĝvojon..." + :en "Five feet under, maybe...")))))) (defun bad-gambler-partings (&optional map)