Add global systems and bounce boosting
This commit is contained in:
parent
69477db047
commit
d379cd28d7
2 changed files with 41 additions and 7 deletions
|
|
@ -162,7 +162,7 @@
|
|||
(define (make-system name priority mode criteria process)
|
||||
(assert (symbol? name))
|
||||
(assert (integer? priority))
|
||||
(assert (member mode '(entity batch)))
|
||||
(assert (member mode '(entity batch global)))
|
||||
(assert (every symbol? criteria))
|
||||
(assert (procedure? process))
|
||||
(int:make-system name priority mode criteria process))
|
||||
|
|
@ -266,10 +266,12 @@
|
|||
;; Execute a single system
|
||||
(define (execute-system system)
|
||||
(assert (system? system))
|
||||
(let ((entities (map get-entity (set->list (apply query-by-components (system-criteria system))))))
|
||||
(cond
|
||||
((eqv? (system-mode system) 'batch) ((system-process system) entities))
|
||||
((eqv? (system-mode system) 'entity) (for-each (lambda (e) ((system-process system) e)) entities)))))
|
||||
(if (eqv? (system-mode system) 'global)
|
||||
((system-process system))
|
||||
(let ((entities (map get-entity (set->list (apply query-by-components (system-criteria system))))))
|
||||
(cond
|
||||
((eqv? (system-mode system) 'batch) ((system-process system) entities))
|
||||
((eqv? (system-mode system) 'entity) (for-each (lambda (e) ((system-process system) e)) entities))))))
|
||||
|
||||
(define (execute-systems)
|
||||
(for-each
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue