-(use-modules (srfi srfi-1))
-
-;;; Mob Factory
-
-(define-macro (makemob name . methods)
- `(define* (,name . args)
- (let ((option (car args)))
- ,(union
- `(case option
- (:on (mob-on ',name))
- (:off (mob-off ',name)))
- (define (options m)
- (let ((option (car m)) (body (cadr m)))
- (cond ((null? m) '())
- (else (cons (list option `(apply ,body (cdr args))) (options (cddr m)))))))
- (options methods)))))
-
-
-(define mob-on #f)
-(define run-mobs #f)
-(define mob-off #f)
-(define refresh-running-mobs #f)
-(define quit-all-mobs #f)
-
-(let ((running-mobs '()) (mobs-to-add '()) (mobs-to-quit '()))
- (set! mob-on
- (lambda (mob)
- (push mob mobs-to-add)))
-
- (set! run-mobs
- (lambda* (option #:key args function)
- (define (run-mobs-rec mobs)
- (cond ((null? mobs) #f)
- (else
- (cond (function (function)))
- (secure-block #f (apply (car mobs) (cons option args)))
- (or #t (run-mobs-rec (cdr mobs))))))))
-
- (set! mob-off
- (lambda (mob)
- (push mob mobs-to-quit)))
-
- (set! refresh-running-mobs
- (lambda ()
- (do ((mob (pop mobs-to-add) (pop mobs-to-add))) ((null? mob))
- (push mob running-mobs)
- (secure-block nil (mob #:init)))
- (set! running-mobs (reverse (lset-difference eq? running-mobs mobs-to-quit)))
- (set! mobs-to-quit '())))
+;;; Mobs Factory
+
+(define show-mob-hash #f)
+(define hide-mob-hash #f)
+(define get-active-mobs #f)
+(define clear-active-mobs #f)
+(define mobs-changed? #f)
+
+(let ((active-mobs (make-hash-table)) (changed #f))
+ (set! show-mob-hash
+ (lambda (key mob)
+ (hash-set! active-mobs key mob)
+ (set! changed #t)))