Skip to content

Commit

Permalink
refactor: add tip for scene_root_tracker
Browse files Browse the repository at this point in the history
  • Loading branch information
Ark2000 committed Jun 29, 2023
1 parent 3664bbc commit 9fcca3e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion addons/panku_console/console.gd
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func _ready():
# you can add or remove any modules here as you wish
var modules:Array[PankuModule] = [
PankuModuleNativeLogger.new(),
PankuModuleSceneRootTracker.new(),
PankuModuleScreenNotifier.new(),
PankuModuleSystemReport.new(),
PankuModuleHistoryManager.new(),
Expand All @@ -52,6 +51,7 @@ func _ready():
PankuModuleDataController.new(),
PankuModuleScreenCrtEffect.new(),
PankuModuleExpressionMonitor.new(),
PankuModuleSceneRootTracker.new(),
]
module_manager.init_manager(self, modules)

Expand Down
9 changes: 8 additions & 1 deletion addons/panku_console/modules/scene_root_tracker/module.gd
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ var _tween_loop:Tween
func init_module():
setup_scene_root_tracker()

# print a tip to interacvite_shell module
# modules load order matters
var tip:String = "\n[tip] you can always access current scene by [b]current[/b]"
if core.module_manager.has_module("interactive_shell"):
var ishell = core.module_manager.get_module("interactive_shell")
ishell.interactive_shell.output(tip)

# always register the current scene root as `current`
func setup_scene_root_tracker():
_current_scene_root = get_scene_root()
Expand All @@ -21,4 +28,4 @@ func setup_scene_root_tracker():
).set_delay(0.1)

func get_scene_root() -> Node:
return core.get_tree().root.get_child(core.get_tree().root.get_child_count() - 1)
return core.get_tree().root.get_child(core.get_tree().root.get_child_count() - 1)

0 comments on commit 9fcca3e

Please sign in to comment.