Skip to content

Commit

Permalink
LemonTree: Add store access via parent branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Lemon-King committed Oct 20, 2024
1 parent 534384b commit 88f2185
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions resources/assets/zscript/lib/LemonTree/lemontreebranch.zs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down

0 comments on commit 88f2185

Please sign in to comment.