playlist now removes played scenes
This commit is contained in:
@@ -19,10 +19,11 @@ var last_leaderboard_id = 0
|
||||
var user_names = ["Profile 1","Profile 2","Profile 3","Profile 4","Profile 5"]
|
||||
var all_user_leaderboards = [["Global"]]
|
||||
var current_leaderboard_name = all_user_leaderboards[user_id][last_leaderboard_id]
|
||||
var no_reentry_portals = []
|
||||
|
||||
var playlist_test
|
||||
var current_match
|
||||
var current_match_id = 0
|
||||
var current_round_id = 0
|
||||
var playlist_test
|
||||
|
||||
|
||||
#Player Stats
|
||||
var player_deaths = 0
|
||||
|
||||
@@ -7,9 +7,15 @@ extends Node3D
|
||||
@onready var active: Label3D = $Active
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
level_name.text = portal_node.scene_name
|
||||
gamemode_label.text = portal_node.level_gamemode.gamemode_name
|
||||
active.text = str("ACTIVE: ",portal_node.active)
|
||||
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
|
||||
active.text = str("active: ",portal_node.active)
|
||||
else:
|
||||
level_name.text = "closed for maintenance"
|
||||
gamemode_label.text = "-"
|
||||
active.text = "active: closed"
|
||||
|
||||
func update_sign_names():
|
||||
level_name.text = portal_node.scene_name
|
||||
|
||||
@@ -126,7 +126,6 @@ var controlled_elsewhere = false
|
||||
@onready var hurt_audio = $Audio/Hurt
|
||||
@onready var hit_indicator: AudioStreamPlayer = $Audio/HitIndicator
|
||||
@onready var health_indicator = $HealthIndicator
|
||||
@onready var ammo_counter = $Head/Recoil/Camera3D/AmmoCounter
|
||||
@onready var stamina_counter = $Head/Recoil/Camera3D/StaminaCounter
|
||||
@onready var recoil: Node3D = $Head/Recoil
|
||||
@onready var weapon_spawner = $Head/Recoil/Camera3D/WeaponHolder/WeaponSpawner
|
||||
@@ -490,7 +489,7 @@ func _physics_process(delta):
|
||||
level_control.die()
|
||||
|
||||
focus_on_target()
|
||||
joypad_look(delta)
|
||||
joypad_look()
|
||||
aim_down_sights(delta)
|
||||
flashlight_toggle()
|
||||
hold_item(delta)
|
||||
@@ -514,7 +513,7 @@ func joypad_walk():
|
||||
|
||||
return dir_out
|
||||
|
||||
func joypad_look(delta):
|
||||
func joypad_look():
|
||||
if !controlled_elsewhere:
|
||||
# Joypad right stick look control
|
||||
var xAxis = Input.get_joy_axis(0,JOY_AXIS_RIGHT_X)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
@tool
|
||||
extends Node
|
||||
|
||||
@export var generate_playlist_now = false
|
||||
@@ -10,20 +9,6 @@ extends Node
|
||||
@export var rounds_per_match : int = 3
|
||||
@export var matches_per_year : int = 52
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
if generate_playlist_now == true:
|
||||
generate_playlist()
|
||||
|
||||
if load_playlist_from_file == true:
|
||||
load_playlist()
|
||||
|
||||
|
||||
func generate_playlist() -> void:
|
||||
var playlist_name = only_valid_chars(GameGlobals.all_user_leaderboards[GameGlobals.user_id][GameGlobals.last_leaderboard_id])
|
||||
var playlist = []
|
||||
|
||||
@@ -2,24 +2,39 @@ extends Node
|
||||
|
||||
@onready var playlist_generator: Control = $"../Playlist Generator"
|
||||
|
||||
var round_id = 2
|
||||
var portals = []
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
playlist_generator.load_playlist()
|
||||
if GameGlobals.current_match == [] or GameGlobals.current_match == 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"):
|
||||
portals.append(i)
|
||||
|
||||
print("NO REENTRY PORTALS : ",GameGlobals.no_reentry_portals)
|
||||
if GameGlobals.current_match[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
|
||||
|
||||
|
||||
var id = 0
|
||||
for i in portals:
|
||||
if !GameGlobals.no_reentry_portals.has(Vector2(round_id,id)):
|
||||
i.round_id = Vector2(round_id,id)
|
||||
i.scene_path = str(GameGlobals.current_match[round_id][id]["level_path"])
|
||||
i.scene_name = str(GameGlobals.current_match[round_id][id]["level_name"])
|
||||
i.level_gamemode = load(GameGlobals.current_match[round_id][id]["gamemode_path"])
|
||||
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"
|
||||
else:
|
||||
i.active = false
|
||||
i.scene_name = "closed"
|
||||
id += 1
|
||||
SaveLoad.save_user_data()
|
||||
|
||||
@@ -62,7 +62,9 @@ func save_user_data():
|
||||
file.store_var(GameGlobals.last_hit_path)
|
||||
file.store_var(leaderboard_name)
|
||||
file.store_var(GameGlobals.current_level)
|
||||
file.store_var(GameGlobals.no_reentry_portals)
|
||||
file.store_var(GameGlobals.current_match)
|
||||
file.store_var(GameGlobals.current_match_id)
|
||||
file.store_var(GameGlobals.current_round_id)
|
||||
file.store_var(money)
|
||||
file.store_var(deposited_money)
|
||||
file.store_var(health)
|
||||
@@ -95,7 +97,9 @@ func load_user_data():
|
||||
GameGlobals.last_hit_path = file.get_var()
|
||||
var file_leaderboard_name = file.get_var()
|
||||
GameGlobals.current_level = str(file.get_var())
|
||||
GameGlobals.no_reentry_portals = file.get_var()
|
||||
GameGlobals.current_match = file.get_var()
|
||||
GameGlobals.current_match_id = file.get_var()
|
||||
GameGlobals.current_round_id = file.get_var()
|
||||
var money = set_nulls_zero(file.get_var())
|
||||
var deposited_money = set_nulls_zero(file.get_var())
|
||||
var health = file.get_var()
|
||||
|
||||
@@ -5,9 +5,11 @@ class_name Portal
|
||||
@export var scene_name : String
|
||||
@export var level_gamemode : gamemode
|
||||
@export var scene_thumbnail : Texture2D
|
||||
@export var hub_portal : bool = false
|
||||
|
||||
var active = false
|
||||
var round_id : Vector2
|
||||
var timer_active = false
|
||||
var active = true
|
||||
var index : int
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
@@ -20,18 +22,22 @@ func _process(delta: float) -> void:
|
||||
|
||||
|
||||
func _on_body_entered(body: Node3D) -> void:
|
||||
if active:
|
||||
GameGlobals.no_reentry_portals.append(round_id)
|
||||
#Let the Bounds detector know player is exiting
|
||||
SignalBus.emit_signal("player_exiting_tree")
|
||||
#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()
|
||||
get_tree().change_scene_to_file(scene_path)
|
||||
if body.is_in_group("player"):
|
||||
if active and timer_active:
|
||||
#Let the Bounds detector know player is exiting
|
||||
SignalBus.emit_signal("player_exiting_tree")
|
||||
|
||||
if hub_portal:
|
||||
#add back other portals to round portal array
|
||||
GameGlobals.current_match[GameGlobals.current_round_id].remove_at(index)
|
||||
#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()
|
||||
get_tree().change_scene_to_file(scene_path)
|
||||
|
||||
|
||||
func _on_start_activation_timeout() -> void:
|
||||
active = true
|
||||
timer_active = true
|
||||
|
||||
Reference in New Issue
Block a user