extends VisibleOnScreenNotifier2D
@export var tutorial_cutscene : TutorialCutscenes
@export var visibility_target : Node2D

var ignore : bool = false

func _ready() -> void:
	if not visibility_target:
		return
	if visibility_target is ActivatableDoor:
		visibility_target = visibility_target.sprite_2d
	visibility_target.visibility_changed.connect(func () : ignore = not visibility_target.visible)

func _on_screen_entered() -> void:
	if ignore or Globals.skip_cutscenes or Globals.timeshift_cutscene_done:
		Globals.timeshift_cutscene_done = true
		return
	tutorial_cutscene.show()
	tutorial_cutscene.start_dialogue()
	Globals.timeshift_cutscene_done = true
	
