Add the entrance to the hive
[mudsync.git] / worlds / bricabrac.scm
index 1f1c06936e2aa80037144aff26c11037fb47ea2b..c423051b8ad3395b383818c334cfc3082d5e0272 100644 (file)
 ;;; -----
 
 (define (npc-chat-randomly actor message . _)
+  (define catchphrase
+    (random-choice (slot-ref actor 'catchphrases)))
   (define text-to-send
-    (format #f "~a says: \"~a\"\n"
-            (slot-ref actor 'name)
-            (random-choice (slot-ref actor 'catchphrases))))
+    ((slot-ref actor 'chat-format) actor catchphrase))
   (<- (message-from message) 'tell
       #:text text-to-send))
 
@@ -117,6 +117,10 @@ or 'skribe'?  Now *that's* composition!"))
 (define-class <chatty-npc> (<gameobj>)
   (catchphrases #:init-value '("Blarga blarga blarga!")
                 #:init-keyword #:catchphrases)
+  (chat-format #:init-value (lambda (npc catchphrase)
+                              `(,(slot-ref npc 'name) " says: \""
+                                ,catchphrase "\""))
+               #:init-keyword #:chat-format)
   (commands
    #:allocation #:each-subclass
    #:init-thunk (build-commands
@@ -1349,7 +1353,10 @@ is a map detailing the layout of the underground structure."))
             (lambda (exit room whos-exiting)
               (values #t '("You head west through a fancy-looking entrance. "
                            "A security guard steps aside for you to pass through, "
-                           "into the room, then stands in front of the door."))))))
+                           "into the room, then stands in front of the door."))))
+          (make <exit>
+            #:name "north"
+            #:to 'hive-entrance)))
 
    ;; map
    ('underground-lab:map
@@ -1555,6 +1562,84 @@ as well as an exit leading to the south."))
                #:name "north"
                #:to 'async-museum)))))
 
+\f
+;;; Hive entrance
+
+(define actor-descriptions
+  '("This one is fused to the side of the hive.  It isn't receiving any
+messages, and it seems to be in hibernation."
+    "A chat program glows in front of this actor's face.  They seem to
+be responding to chat messages and forwarding them to some other actors,
+and forwarding messages from other actors back to the chat."
+    "This actor is bossing around other actors, delegating tasks to them
+as it receives requests, and providing reports on the worker actors'
+progress."
+    "This actor is trying to write to some device, but the device keeps
+alternating between saying \"BUSY\" or \"READY\".  Whenever it says
+\"BUSY\" the actor falls asleep, and whenever it says \"READY\" it
+seems to wake up again and starts writing to the device."
+    "Whoa, this actor is totally wigging out!  It seems to be throwing
+some errors.  It probably has some important work it should be doing
+but you're relieved to see that it isn't grinding the rest of the Hive
+to a halt."))
+
+(define hive-entrance
+  (lol
+   ('hive-entrance
+    <room> #f
+    #:name "Entrance to the 8sync Hive"
+    #:desc
+    '((p "Towering before you is the great dome-like 8sync Hive, or at least
+one of them.  You've heard about this... the Hive is itself the actor that all
+the other actors attach themselves to.  It's shaped like a spherical half-dome.
+There are some actors milling about, and some seem fused to the side of the
+hive itself, but all of them have an umbellical cord attached to the hive from
+which you see flashes of light comunicating what must be some sort of messaging
+protocol.")
+      (p "To the south is a door leading back to the underground lab.
+North leads into the Hive itself."))
+    #:exits
+    (list (make <exit>
+            #:name "south"
+            #:to 'underground-lab)
+          (make <exit>
+            #:name "north"
+            #:to 'hive-inside)))
+   ('hive-entrance:hive
+    <gameobj> 'hive-entrance
+    #:name "the Hive"
+    #:goes-by '("hive")
+    #:desc
+    '((p "It's shaped like half a sphere embedded in the ground.
+Supposedly, while all actors are autonomous and control their own state,
+they communicate through the hive itself, which is a sort of meta-actor.
+There are rumors that actors can speak to each other even across totally
+different hives.  Could that possibly be true?")))
+   ('hive-entrance:actor
+    <chatty-npc> 'hive-entrance
+    #:name "some actors"
+    #:goes-by '("actor" "actors" "some actors")
+    #:chat-format (lambda (npc catchphrase)
+                    `((p "You pick one actor out of the mix and chat with it. ")
+                      (p "It says: \"" ,catchphrase "\"")))
+    #:desc
+    (lambda _
+      `((p "There are many actors, but your eyes focus on one in particular.")
+        (p ,(random-choice actor-descriptions))))
+    #:catchphrases
+    '("Yeah we go through a lot of sleep/awake cycles around here.
+If you aren't busy processing a message, what's the point of burning
+valuable resources?"
+      "I know I look like I'm some part of dreary collective, but
+really we have a lot of independence.  It's a shared nothing environment,
+after all.  (Well, except for CPU cycles, and memory, and...)"
+      "Shh!  I've got another message coming in and I've GOT to
+handle it!"
+      "I just want to go to 8sleep already."
+      "What a lousy scheduler we're using!  I hope someone upgrades
+that thing soon."))))
+
+;;; 
 
 \f
 ;;; Game
@@ -1563,7 +1648,7 @@ as well as an exit leading to the south."))
 (define (game-spec)
   (append lobby grand-hallway smoking-parlor
           playroom break-room computer-room underground-lab
-          async-museum gift-shop))
+          async-museum gift-shop hive-entrance))
 
 ;; TODO: Provide command line args
 (define (run-game . args)