|author||David Thompson <email@example.com>||2020-12-15 11:42:25 -0500|
|committer||David Thompson <firstname.lastname@example.org>||2020-12-15 11:42:25 -0500|
node: Improve boot logic.
1 files changed, 7 insertions, 4 deletions
diff --git a/starling/node.scm b/starling/node.scm
index 17fd177..631f113 100644
@@ -155,8 +155,9 @@ represented as a ratio in the range [0, 1]."
(define-method (boot (node <node>))
"Prepare NODE to enter the game world for the first time."
- (set! (booted? node) #t)
- (on-boot node))
+ (unless (booted? node)
+ (set! (booted? node) #t)
+ (on-boot node)))
(define-method (reboot (node <node>))
@@ -249,8 +250,10 @@ represented as a ratio in the range [0, 1]."
;; Add to name index.
(when (name child)
(hashq-set! (children-by-name new-parent) (name child) child))
- ;; If the parent is active, that means the new children
- ;; must also be active.
+ ;; If the parent is booted or active, that means the new
+ ;; children must also be booted or activated.
+ (when (booted? new-parent)
+ (boot child))
(when (active? new-parent)