extends Node

@onready var manager = $".."
@onready var vfx = $"../VFX"
@onready var end_card = load("res://scenes/end_card.tscn")
@export var crt: CRT

func mishap1():
	var inst = manager.res_ev01.instantiate()
	manager.insert_event(inst)
	print("mishap 1 triggered")
	
func mishap2():
	var inst = manager.res_ev02.instantiate()
	manager.insert_event(inst)
	print("mishap 2 triggered")

func mishap3():
	var inst = manager.res_ev03.instantiate()
	manager.insert_event(inst)
	print("mishap 3 triggered")

func mishap4():
	var inst = manager.res_ev04.instantiate()
	manager.insert_event(inst)
	print("mishap 4 triggered")

func mishap5():
	var inst = manager.res_ev05.instantiate()
	manager.insert_event(inst)
	print("mishap 5 triggered")
	
func mishap6():
	var inst = manager.res_ev06.instantiate()
	manager.insert_event(inst)
	print("mishap 6 triggered")

func mishap7():
	var inst = manager.res_ev07.instantiate()
	manager.insert_event(inst)
	print("mishap 7 triggered")
	
func mishap8():
	var inst = manager.res_ev08.instantiate()
	manager.insert_event(inst)
	print("mishap 8 triggered")

func mishap9():
	var inst = manager.res_ev09.instantiate()
	manager.insert_event(inst)
	print("mishap 9 triggered")

func mishap10():
	var inst = manager.res_ev10.instantiate()
	manager.insert_event(inst)
	print("mishap 10 triggered")
	
func mishap11():
	var inst = manager.res_ev11.instantiate()
	manager.insert_event(inst)
	print("mishap 11 triggered")

func play_5s_shake():
	if manager.event_running:
		vfx.play("shake 5s")

func distort(clicks: int):
	crt.enable_distortion(clicks)

func end_game():
	print("Called end game.")
	get_tree().change_scene_to_packed(end_card)
