From b4de83ce32e382dd85cad0cc5bb697dd691e2dde Mon Sep 17 00:00:00 2001 From: David Thompson Date: Tue, 15 Dec 2020 11:42:25 -0500 Subject: node: Improve boot logic. --- starling/node.scm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/starling/node.scm b/starling/node.scm index 17fd177..631f113 100644 --- a/starling/node.scm +++ b/starling/node.scm @@ -155,8 +155,9 @@ represented as a ratio in the range [0, 1]." (define-method (boot (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 )) (define (do-reboot) @@ -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) (activate child))) new-children) -- cgit v1.2.3