We can finally move around!
[mudsync.git] / mudsync / game-master.scm
index f839931002fe663cabe8c62c2458be623407a4f7..732427850fc72b5e9601a112b95afd077b53cd01 100644 (file)
@@ -17,7 +17,6 @@
 ;;; along with Mudsync.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (mudsync game-master)
-  #:use-module (mudsync room)
   #:use-module (mudsync networking)
   #:use-module (8sync systems actors)
   #:use-module (8sync agenda)
 
 (define (gm-init-rooms gm rooms-spec)
   "Initialize the prebuilt rooms"
-  ;; @@: Would it be nicer to just allow passing in
-  ;;     #:exits to the room spec itself?
-  (define (exit-from-spec exit-spec)
-    "Take room exits syntax from the spec, turn it into exits"
-    (match exit-spec
-      ((name to-symbol desc)
-       (make <exit>
-         #:name name
-         #:to-symbol to-symbol
-         #:desc desc))))
-
   (define rooms
     (map
      (match-lambda
        ((room-symbol room-class
-                     room-args ...
-                     (room-exits ...))
+                     room-args ...)
         ;; initialize the room
         (let ((room
                (apply create-actor* gm room-class "room"
                       #:gm (actor-id gm)
-                      #:exits (map exit-from-spec room-exits)
                       room-args)))
           ;; register the room
           (hash-set! (gm-room-dir gm) room-symbol room)
   (format #t "DEBUG: From ~s: ~s\n" client-id input)
 
   (<- actor player 'handle-input
-      #:input input)
-
-  ;; TODO: Remove this shortly
-  (<- actor (gm-network-manager actor) 'send-to-client
-      #:client client-id
-      #:data "Thanks, we got it!\n"))
+      #:input input))
 
 (define-mhandler (gm-lookup-room actor message symbol)
-  (define room-id
-    (slot-ref (gm-room-dir actor) symbol))
-  (<-reply actor message room-id))
+  (<-reply actor message
+           #:room-id (hash-ref (slot-ref actor 'room-dir) symbol)))
 
 (define-mhandler (gm-write-home actor message text)
   (define client-id (hash-ref (gm-reverse-client-dir actor)
 (define (make-default-room-conn-handler default-room)
   "Make a handler for a GM that dumps people in a default room
 with an anonymous persona"
+  (display "right before breakage?\n")
   (let ((count 0))
     (lambda (gm client-id)
       (set! count (+ count 1))
@@ -203,10 +184,11 @@ with an anonymous persona"
                              #:username guest-name
                              #:gm (actor-id gm)
                              #:client client-id)))
+        (display "Are we broke yet?\n")
         ;; Register the player in our database of players -> connections
         (gm-register-client! gm client-id player)
         ;; Dump the player into the default room
-        (<-wait gm player 'set-loc! #:id room-id)
+        (<-wait gm player 'set-loc! #:loc room-id)
         ;; Initialize the player
         (<- gm player 'init)))))