scene changers now work with playlist

This commit is contained in:
derek
2025-03-28 14:30:27 -05:00
parent 1422992c13
commit a591865d4b
13 changed files with 100 additions and 71 deletions

View File

@@ -1,20 +1,21 @@
extends Node
@export var portal_parent : Node3D
@onready var playlist_generator: Control = $"../Playlist Generator"
@onready var current_match = GameGlobals.playlist[GameGlobals.current_match_id]
@onready var current_round = current_match[GameGlobals.current_round_id]["round"]
var portals = []
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
if GameGlobals.current_match[GameGlobals.current_round_id] == [] or GameGlobals.current_match[GameGlobals.current_round_id] == null:
playlist_generator.load_playlist()
print("CURRENT MATCH : ",GameGlobals.current_match)
for i in get_tree().current_scene.get_children():
if i.is_in_group("portal"):
for i in portal_parent.get_children():
if i is Portal:
portals.append(i)
if GameGlobals.current_match[GameGlobals.current_round_id].size() == 0:
if GameGlobals.playlist[0][GameGlobals.current_round_id].size() == 0:
var next_round = GameGlobals.current_round_id + 1
if next_round <= (GameGlobals.current_match.size() - 1):
GameGlobals.current_round_id = next_round
@@ -22,19 +23,10 @@ func _ready() -> void:
var id = 0
for i in portals:
if id <= (GameGlobals.current_match[GameGlobals.current_round_id].size() - 1):
if GameGlobals.current_match[GameGlobals.current_round_id][id] != null:
var level_spawn = GameGlobals.current_match[GameGlobals.current_round_id][id]
i.index = id
i.active = true
i.scene_path = str(level_spawn["level_path"])
i.scene_name = str(level_spawn["level_name"])
i.level_gamemode = load(level_spawn["gamemode_path"])
else:
i.active = false
i.scene_name = "closed"
if id <= (current_round.size() - 1):
var level_spawn = current_round[id]
i.level_info = level_spawn
else:
i.active = false
i.scene_name = "closed"
id += 1
SaveLoad.save_user_data()