X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=mudsync%2Fgame-master.scm;h=3583f95662cc68a25abb72f8ddeaa4d82f689d9b;hp=bb8756a5e2ca96563d0d594760d1051e0691b5bc;hb=8a2341e98f75a5df295f49c08485eb6339dda19e;hpb=d13325f5f6eba20c808636948432dcdff4e138f6
diff --git a/mudsync/game-master.scm b/mudsync/game-master.scm
index bb8756a..3583f95 100644
--- a/mudsync/game-master.scm
+++ b/mudsync/game-master.scm
@@ -17,8 +17,6 @@
;;; along with Mudsync. If not, see .
(define-module (mudsync game-master)
- #:use-module (mudsync room)
- #:use-module (mudsync player)
#:use-module (mudsync networking)
#:use-module (8sync systems actors)
#:use-module (8sync agenda)
@@ -87,7 +85,7 @@
"Take room exits syntax from the spec, turn it into exits"
(match exit-spec
((name to-symbol desc)
- (make
+ (make (@@ (mudsync room) )
#:name name
#:to-symbol to-symbol
#:desc desc))))
@@ -141,10 +139,14 @@
"Handle input from a client."
(define client-id (message-ref message 'client))
(define input (message-ref message 'data))
- (format #t "From ~s: ~s\n" client-id input)
- (<- actor (gm-network-manager actor) 'send-to-client
- #:client client-id
- #:data "Thanks, we got it!\n"))
+ ;; Look up player
+ (define player (hash-ref (gm-client-dir actor) client-id))
+
+ ;; debugging
+ (format #t "DEBUG: From ~s: ~s\n" client-id input)
+
+ (<- actor player 'handle-input
+ #:input input))
(define-mhandler (gm-lookup-room actor message symbol)
(define room-id
@@ -184,21 +186,21 @@
with an anonymous persona"
(let ((count 0))
(lambda (gm client-id)
- (define guest-name (string-append "Guest-"
+ (set! count (+ count 1))
+ (let* ((guest-name (string-append "Guest-"
(number->string count)))
- (define room-id
- (hash-ref (gm-room-dir gm) default-room))
- ;; create and register the player
- (define player
- (create-actor* gm "player"
- #:username guest-name
- #:gm (actor-id gm)
- #:client client-id))
-
- ;; 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)
- ;; Initialize the player
- (<- gm player 'init))))
+ (room-id
+ (hash-ref (gm-room-dir gm) default-room))
+ ;; create and register the player
+ (player
+ (create-actor* gm (@@ (mudsync player) ) "player"
+ #:username guest-name
+ #:gm (actor-id gm)
+ #:client client-id)))
+ ;; 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! #:loc room-id)
+ ;; Initialize the player
+ (<- gm player 'init)))))