From 88f2185efaa7e2a44701cccac2b12f329239a2fb Mon Sep 17 00:00:00 2001 From: Lemon-King Date: Sun, 20 Oct 2024 14:18:29 -0400 Subject: [PATCH] LemonTree: Add store access via parent branch --- .../assets/zscript/lib/LemonTree/lemontreebranch.zs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/resources/assets/zscript/lib/LemonTree/lemontreebranch.zs b/resources/assets/zscript/lib/LemonTree/lemontreebranch.zs index ea06ba7..1efe399 100644 --- a/resources/assets/zscript/lib/LemonTree/lemontreebranch.zs +++ b/resources/assets/zscript/lib/LemonTree/lemontreebranch.zs @@ -2,6 +2,19 @@ class LemonTreeBranch { bool _persist; // allows data to persist between games + LemonTreeBranch GetStore() { + LemonTreeSession ltSession = LemonTree.GetSession(); + if (ltSession) { + bool exists = false; + LemonTreeBranch store; + [store, exists] = ltSession.stores.CheckValue(self.GetClassName()); + if (exists) { + return store; + } + } + return null; + } + virtual void Init() { self._persist = false; console.printf("%s: Init", self.GetClassName());