- (define hive (make-hive))
- (define new-conn-handler
- (make-default-room-conn-handler default-room))
- (define gm
- (hive-create-actor-gimmie* hive <game-master> "gm"
- #:new-conn-handler new-conn-handler))
- (define repl-manager
- (hive-create-actor* hive <repl-manager> "repl"))
-
- (define initial-tasks
- (list (bootstrap-message hive (actor-id gm) 'init-world
- #: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! gameobj-injector)
-
- (run-agenda agenda #:post-run-hook post-run-hook)))
-
-
-(define (do-inject-special! queue hive gm-id game-spec special-symbol)
- (define gameobj-spec
- (or (find
- (lambda (entry) (eq? (car entry) special-symbol))
- game-spec)
- (throw 'no-such-symbol "Can't find such a symbol in the game-spec"
- #:symbol special-symbol)))
- (define task
- (bootstrap-message hive gm-id 'inject-special!
- #:special-symbol special-symbol
- #:gameobj-spec gameobj-spec))
- (enq! queue task)
- 'done)
-
-(define (queue-injected-tasks-on-agenda! agenda inject-queue)
- "Inject tasks from the inject-queue onto the agenda queue."
- (while (not (q-empty? inject-queue))
- (enq! (agenda-queue agenda) (q-pop! inject-queue))))
-
-(define* (make-special-injector agenda hive gm-id)
- "Make a post-run-hook and gameobj injector for quick live hacking."
- (define inject-queue (make-q))
- (values
- (lambda (agenda)
- (queue-injected-tasks-on-agenda! agenda inject-queue))
- (lambda (game-spec special-symbol)
- (do-inject-special! inject-queue hive gm-id
- game-spec special-symbol))))
+ (run-hive
+ (lambda (hive)
+ (define new-conn-handler
+ (make-default-room-conn-handler default-room))
+ (define gm
+ ;; (bootstrap-actor-gimmie* hive <game-master> "gm"
+ ;; #:new-conn-handler new-conn-handler)
+ (create-actor* <game-master> "gm"
+ #:new-conn-handler new-conn-handler))
+ (define injector
+ (create-actor <gameobj-injector>
+ #:gm gm))
+
+ (define repl-manager
+ (create-actor* <repl-manager> "repl"
+ #:subscribers (list injector)))
+
+ ;; (set! %live-gm gm)
+ (set! %live-hive hive)
+
+ (set! %inject-queue (make-q))
+
+ (<- gm 'init-world
+ #:game-spec game-spec)
+ ;; (run-hive hive
+ ;; (list (bootstrap-message hive (actor-id gm) 'init-world
+ ;; #:game-spec game-spec)))
+ (wait (make-condition)))
+ ;; Just for testing / for now...
+ #:parallelism 1))