+;; Evil! This uses a global variable... but it's hard to give any more
+;; convenient way of providing something for live hacking (which is
+;; "quasi-evil for productivity's sake" anyway). You can set up your own
+;; solution which doesn't use a global though.
+
+(define %inject-queue #f)
+
+(define (inject-gameobj! game-spec special-symbol)
+ (if %inject-queue
+ (let ((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))))
+ (enq! %inject-queue (cons gameobj-spec special-symbol)))
+ (display "Game hasn't been started...\n"))
+ 'done)
+
+(define-actor <gameobj-injector> (<actor>)
+ ((repl-update gameobj-injector-inject-queued))
+ (gm #:init-keyword #:gm
+ #:getter .gm))
+
+(define (gameobj-injector-inject-queued injector message)
+ (while (not (q-empty? %inject-queue))
+ (match (deq! %inject-queue)
+ ((gameobj-spec . special-symbol)
+ (<-wait (.gm injector) 'inject-special!
+ #:special-symbol special-symbol
+ #:gameobj-spec gameobj-spec)))))
+
+\f
+;;; Game running stuff
+;;; ==================
+
+(define* (run-demo game-spec default-room #:key repl-server)