X-Git-Url: https://jxself.org/git/?p=mudsync.git;a=blobdiff_plain;f=mudsync%2Frun-game.scm;h=f3035d33cd2a3c7eee1b0e14554ed4ef2eb1733d;hp=daedf180dfcdee055fff85b604049ed44e378b14;hb=701425bc611abaa8b4140942d995d5f32d24e2d7;hpb=36042544b6defa138f348f093f895722a472e1ba diff --git a/mudsync/run-game.scm b/mudsync/run-game.scm index daedf18..f3035d3 100644 --- a/mudsync/run-game.scm +++ b/mudsync/run-game.scm @@ -20,18 +20,18 @@ #:use-module (mudsync game-master) #:use-module (8sync agenda) #:use-module (8sync repl) - #:use-module (8sync systems actors) - #:use-module (8sync systems actors debug) + #:use-module (8sync actors) + #:use-module (8sync debug) #:use-module (srfi srfi-1) #:use-module (ice-9 receive) #:use-module (ice-9 q) #:export (run-demo - inject-special! + do-inject-special! make-special-injector ;; Debug stuff, might go away %live-gm %live-hive - inject!)) + inject-gameobj!)) ;;; Debugging stuff @@ -46,7 +46,7 @@ ;; "quasi-evil for productivity's sake" anyway). You can set up your own ;; solution which doesn't use a global though. -(define (inject! game-spec special-symbol) +(define (inject-gameobj! game-spec special-symbol) (display "Game hasn't been started...\n")) @@ -61,33 +61,33 @@ (define gm (hive-create-actor-gimmie* hive "gm" #:new-conn-handler new-conn-handler)) + (define repl-manager + (hive-create-actor* hive "repl")) + (define initial-tasks (list (bootstrap-message hive (actor-id gm) 'init-world - #:game-spec game-spec))) + #:game-spec game-spec) + (apply bootstrap-message hive repl-manager 'init + (if (string? repl-server) + `(#:path ,repl-server) + '())))) + (define agenda (make-agenda #:pre-unwind-handler print-error-and-continue #:queue (list->q initial-tasks))) (set! %live-gm gm) (set! %live-hive hive) + (receive (post-run-hook gameobj-injector) (make-special-injector agenda hive (actor-id gm)) ;; Set up injector for live hacking - (set! inject! gameobj-injector) - - ;; Set up REPL sever - (cond - ;; If repl-server is an integer, we'll use that as the port - ((integer? repl-server) - (spawn-and-queue-repl-server! agenda repl-server)) - (repl-server - (spawn-and-queue-repl-server! agenda))) + (set! inject-gameobj! gameobj-injector) - (start-agenda agenda - #:post-run-hook post-run-hook))) + (run-agenda agenda #:post-run-hook post-run-hook))) -(define (inject-special! queue hive gm-id game-spec special-symbol) +(define (do-inject-special! queue hive gm-id game-spec special-symbol) (define gameobj-spec (or (find (lambda (entry) (eq? (car entry) special-symbol)) @@ -113,5 +113,5 @@ (lambda (agenda) (queue-injected-tasks-on-agenda! agenda inject-queue)) (lambda (game-spec special-symbol) - (inject-special! inject-queue hive gm-id - game-spec special-symbol)))) + (do-inject-special! inject-queue hive gm-id + game-spec special-symbol))))