scene changers now work with playlist
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
extends Node3D
|
||||
|
||||
@export var portal_node : Node
|
||||
@onready var portal_node = get_parent()
|
||||
|
||||
@onready var level_name: Label3D = $"Level Name"
|
||||
@onready var gamemode_label: Label3D = $Gamemode
|
||||
@onready var active: Label3D = $Active
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
|
||||
if portal_node.active:
|
||||
level_name.text = portal_node.scene_name
|
||||
if portal_node.level_gamemode != null:
|
||||
gamemode_label.text = portal_node.level_gamemode.gamemode_name
|
||||
level_name.text = portal_node.level_info["level_name"]
|
||||
if portal_node.level_info["gamemode_path"] != null:
|
||||
gamemode_label.text = load(portal_node.level_info["gamemode_path"]).gamemode_name
|
||||
active.text = str("active: ",portal_node.active)
|
||||
else:
|
||||
level_name.text = "closed for maintenance"
|
||||
|
||||
@@ -6,7 +6,7 @@ extends Node
|
||||
@export var maps_in_rotation : Array[level_resource] = []
|
||||
@export var gamemodes_in_rotation : Array[gamemode]= []
|
||||
@export var chest_drops : Array[Resource]
|
||||
@export var levels_per_round : int = 5
|
||||
@export var levels_per_round : int = 10
|
||||
@export var rounds_per_match : int = 3
|
||||
@export var chests_per_match : int = 100
|
||||
@export var matches_per_year : int = 52
|
||||
@@ -46,7 +46,7 @@ func generate_playlist() -> void:
|
||||
|
||||
var numbers = []
|
||||
for i in range(chests_per_match):
|
||||
numbers.append(i+1)
|
||||
numbers.append(i)
|
||||
|
||||
numbers.shuffle()
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
extends Area3D
|
||||
class_name Portal
|
||||
|
||||
@export var scene_path : String
|
||||
@export var scene_name : String
|
||||
@export var level_gamemode : gamemode
|
||||
@export var scene_thumbnail : Texture2D
|
||||
@export var hub_portal : bool = false
|
||||
const ENEMY_WORKING_SCENE_ASYNCTEST = preload("res://scenes/enemy_working_scene_ASYNCTEST.tscn")
|
||||
var level_info = {}
|
||||
|
||||
|
||||
var timer_active = false
|
||||
var active = true
|
||||
var index : int
|
||||
@@ -25,16 +22,10 @@ func _on_body_entered(body: Node3D) -> void:
|
||||
if body.is_in_group("player"):
|
||||
if active and timer_active:
|
||||
active = false
|
||||
var scene = load(level_info["level_path"]).instantiate()
|
||||
|
||||
var scene = ENEMY_WORKING_SCENE_ASYNCTEST.instantiate()
|
||||
get_tree().current_scene.add_child(scene)
|
||||
scene.global_position = global_position
|
||||
#Set incoming gamemode
|
||||
GameGlobals.loading_gamemode = level_gamemode
|
||||
#Save data
|
||||
if get_tree().current_scene.gamemode.load_save == true:
|
||||
SaveLoad.save_game_data(get_tree().current_scene.get_name())
|
||||
SaveLoad.save_user_data()
|
||||
|
||||
|
||||
func _on_start_activation_timeout() -> void:
|
||||
|
||||
@@ -38,3 +38,5 @@ class_name weapon_resource
|
||||
@export var tracker_asset : Resource
|
||||
@export_group("Hitscan Settings")
|
||||
@export var hitscan_range : float = 100 ##for hitscan and melee weapons
|
||||
|
||||
var calculated_rigidbody_spawn_velocity = {}
|
||||
|
||||
Reference in New Issue
Block a user