From: Christopher Allan Webber Date: Sat, 30 Apr 2016 02:44:54 +0000 (-0500) Subject: Move game-master methods beneath it, use wrap-apply on them X-Git-Tag: fosdem-2017~210 X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=commitdiff_plain;h=a49c96e631da387ea77d281e91c743b27bf538b3;hp=f96e5f3c95dd19e79dde36097379cb1c388cea83 Move game-master methods beneath it, use wrap-apply on them --- diff --git a/mudsync.scm b/mudsync.scm index 544dc3a..fca151a 100644 --- a/mudsync.scm +++ b/mudsync.scm @@ -181,12 +181,31 @@ ;; (define-method (nm-close-port (nm ))) + ;;; The game master! Runs the world. ;;; ================================= ;; @@: We could call this a "world builder" instead... ;; I kinda like calling it a GM though. +(define-class () + ;; The directory is a "namespaced" directory of all "special" content + ;; in the game, identifiable by some special key. + ;; (The namespace is simply a cons of (namespace . special-symbol)) + (directory #:init-thunk make-hash-table) + ;; A mapping of client ids to in-game actors + (client-to-actor #:init-thunk make-hash-table) + ;; Network manager + (network-manager #:accessor gm-network-manager + #:init-val #f) + + (message-handler + #:init-value + (make-action-dispatch + (init-world (wrap-apply gm-init-world)) + (client-input (wrap-apply gm-handle-client-input))))) + + (define (gm-init-world gm message) ;; Load database ;; TODO @@ -218,24 +237,6 @@ #:client client-id #:data "Thanks, we got it!\n")) -(define-class () - ;; The directory is a "namespaced" directory of all "special" content - ;; in the game, identifiable by some special key. - ;; (The namespace is simply a cons of (namespace . special-symbol)) - (directory #:init-thunk make-hash-table) - ;; A mapping of client ids to in-game actors - (client-to-actor #:init-thunk make-hash-table) - ;; Network manager - (network-manager #:accessor gm-network-manager - #:init-val #f) - - (message-handler - #:init-value - (make-action-dispatch - (init-world gm-init-world) - (client-input gm-handle-client-input)))) - - (define-method (gm-setup-database (gm )) 'TODO)