X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=mudsync%2Fgame-master.scm;h=4576de31146cf54c33d9f64c56e195f27389ad16;hp=0a53389aef6865e24ae7ee5624e281022e03bed5;hb=bbf45570e7dfe20e132cc8e4601ccbf2de667ff3;hpb=6cff5b0062ef928204295ab4327bf2d417070421 diff --git a/mudsync/game-master.scm b/mudsync/game-master.scm index 0a53389..4576de3 100644 --- a/mudsync/game-master.scm +++ b/mudsync/game-master.scm @@ -18,7 +18,7 @@ (define-module (mudsync game-master) #:use-module (mudsync networking) - #:use-module (8sync systems actors) + #:use-module (8sync actors) #:use-module (8sync agenda) #:use-module (oop goops) #:use-module (ice-9 match) @@ -49,16 +49,17 @@ (new-conn-handler #:getter gm-new-conn-handler #:init-keyword #:new-conn-handler) - (message-handler + (actions + #:allocation #:each-subclass #:init-value - (make-action-dispatch - (init-world (wrap-apply gm-init-world)) - (client-input (wrap-apply gm-handle-client-input)) - (lookup-special (wrap-apply gm-lookup-special)) - (new-client (wrap-apply gm-new-client)) - (write-home (wrap-apply gm-write-home)) - (client-closed (wrap-apply gm-client-closed)) - (inject-special! (wrap-apply gm-inject-special!))))) + (build-actions + (init-world gm-init-world) + (client-input gm-handle-client-input) + (lookup-special gm-lookup-special) + (new-client gm-new-client) + (write-home gm-write-home) + (client-closed gm-client-closed) + (inject-special! gm-inject-special!)))) ;;; .. begin world init stuff .. @@ -105,7 +106,7 @@ (match-lambda ((special-obj . loc) (if loc - (<-wait gm special-obj 'set-loc! + (<-wait special-obj 'set-loc! #:loc (hash-ref (gm-special-dir gm) loc))))) set-locs) @@ -113,7 +114,7 @@ (for-each (lambda (special-obj) (format #t "Initializing ~s...\n" (address->string special-obj)) - (<-wait gm special-obj 'init)) + (<-wait special-obj 'init)) specials)) @@ -124,7 +125,7 @@ #:send-input-to (actor-id gm))) ;; TODO: Add host and port options - (<-wait gm (gm-network-manager gm) 'start-listening)) + (<-wait (gm-network-manager gm) 'start-listening)) (define (gm-setup-database gm) 'TODO) @@ -145,17 +146,16 @@ ;; debugging (format #t "DEBUG: From ~s: ~s\n" client data) - (<- actor player 'handle-input + (<- player 'handle-input #:input data)) (define* (gm-lookup-special actor message #:key symbol) - (<-reply actor message - #:val (hash-ref (slot-ref actor 'special-dir) symbol))) + (<-reply message (hash-ref (slot-ref actor 'special-dir) symbol))) (define* (gm-write-home actor message #:key text) (define client-id (hash-ref (gm-reverse-client-dir actor) (message-from message))) - (<- actor (gm-network-manager actor) 'send-to-client + (<- (gm-network-manager actor) 'send-to-client #:client client-id #:data text)) @@ -167,7 +167,7 @@ ;; room, if we have one. ;; (In some games, if the user never connected) (when actor-id - (<-wait gm actor-id 'disconnect-self-destruct) + (<-wait actor-id 'disconnect-self-destruct) ;; Unregister from the client directories. (gm-unregister-client! gm client))) @@ -192,19 +192,19 @@ using the gameobj-spec." #:gm (actor-id gm) args))) ;; Set the location - (<-wait gm special-obj 'set-loc! - #:loc (hash-ref (gm-special-dir gm) loc)) + (<-wait special-obj 'set-loc! + #:loc (hash-ref (gm-special-dir gm) loc)) ;; Initialize the object, and depending on if an object ;; already exists with this info, ask it to coordinate ;; replacing with the existing object. (if existing-obj - (<-wait gm special-obj 'init #:replace existing-obj) - (<-wait gm special-obj 'init)) + (<-wait special-obj 'init #:replace existing-obj) + (<-wait special-obj 'init)) ;; Register the object (hash-set! (gm-special-dir gm) symbol special-obj) ;; Destroy the original, if it exists. (if existing-obj - (<- gm existing-obj 'self-destruct #:why 'replaced)))))) + (<- existing-obj 'self-destruct #:why 'replaced)))))) ;;; GM utilities @@ -220,7 +220,7 @@ using the gameobj-spec." (hash-remove! (gm-reverse-client-dir gm) client-id) ;; Destroy player (if destroy-player - (<- gm player-id 'self-destruct))) + (<- player-id 'self-destruct))) (#f (throw 'no-client-to-unregister "Can't unregister a client that doesn't exist?" client-id)))) @@ -246,10 +246,10 @@ with an anonymous persona" ;; 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) + (<-wait player 'set-loc! #:loc room-id) ;; Initialize the player - (<-wait gm player 'init) - (<- gm room-id 'tell-room + (<-wait player 'init) + (<- room-id 'tell-room #:text (format #f "You see ~a materialize out of thin air!\n" guest-name) #:exclude player)))))