Fixed: Jobs were not loading in release. Completely reworked resource management
This commit is contained in:
parent
a540ae1f83
commit
ca3f2aba83
5 changed files with 27 additions and 25 deletions
19
Resources/Jobs/all_jobs.tres
Normal file
19
Resources/Jobs/all_jobs.tres
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
[gd_resource type="Resource" script_class="JobList" format=3 uid="uid://buvi8m3atoavu"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bp1c3unpg2ndn" path="res://Resources/job_data.gd" id="1_nybwa"]
|
||||||
|
[ext_resource type="Resource" uid="uid://0gyhxwe47tby" path="res://Resources/Jobs/job_action_figure.tres" id="2_7dwwk"]
|
||||||
|
[ext_resource type="Script" uid="uid://dmfdc1mnd4dy5" path="res://Resources/job_list.gd" id="2_8lx8r"]
|
||||||
|
[ext_resource type="Resource" uid="uid://cuff7udubpjgk" path="res://Resources/Jobs/job_ad_keychain.tres" id="3_s4yce"]
|
||||||
|
[ext_resource type="Resource" uid="uid://ceck7mpy7qnae" path="res://Resources/Jobs/job_cafe_cookie_stamp.tres" id="4_eriey"]
|
||||||
|
[ext_resource type="Resource" uid="uid://5ag48elqtpg7" path="res://Resources/Jobs/job_college_electronic_box.tres" id="5_gkqel"]
|
||||||
|
[ext_resource type="Resource" uid="uid://dg2ffm3feksrm" path="res://Resources/Jobs/job_cup_holder_seat.tres" id="6_d2ue3"]
|
||||||
|
[ext_resource type="Resource" uid="uid://c3l3haowyo1yc" path="res://Resources/Jobs/job_drone_chassis.tres" id="7_nayax"]
|
||||||
|
[ext_resource type="Resource" uid="uid://0wacf77o0vq1" path="res://Resources/Jobs/job_headphone_stand_tableside.tres" id="8_1p1kw"]
|
||||||
|
[ext_resource type="Resource" uid="uid://dt1hgcy140fpt" path="res://Resources/Jobs/job_modern_cabinet_handle.tres" id="9_cfo7u"]
|
||||||
|
[ext_resource type="Resource" uid="uid://b0akomrm6gavw" path="res://Resources/Jobs/job_rc_car_control_arm.tres" id="10_awcc0"]
|
||||||
|
[ext_resource type="Resource" uid="uid://dy48odm1apexk" path="res://Resources/Jobs/job_zipper_pull_tab.tres" id="11_mr4tb"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("2_8lx8r")
|
||||||
|
jobs = Array[ExtResource("1_nybwa")]([ExtResource("2_7dwwk"), ExtResource("3_s4yce"), ExtResource("4_eriey"), ExtResource("5_gkqel"), ExtResource("6_d2ue3"), ExtResource("7_nayax"), ExtResource("8_1p1kw"), ExtResource("9_cfo7u"), ExtResource("10_awcc0"), ExtResource("11_mr4tb")])
|
||||||
|
metadata/_custom_type_script = "uid://dmfdc1mnd4dy5"
|
||||||
4
Resources/job_list.gd
Normal file
4
Resources/job_list.gd
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
class_name JobList
|
||||||
|
extends Resource
|
||||||
|
|
||||||
|
@export var jobs: Array[JobData] = []
|
||||||
1
Resources/job_list.gd.uid
Normal file
1
Resources/job_list.gd.uid
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
uid://dmfdc1mnd4dy5
|
||||||
|
|
@ -15,15 +15,15 @@ var current_job_count: int = 0
|
||||||
# - Scenes
|
# - Scenes
|
||||||
const JOB_CARD = preload("uid://dvfcie8hqcb0")
|
const JOB_CARD = preload("uid://dvfcie8hqcb0")
|
||||||
const PRINTER = preload("uid://33ctlyrpibs3")
|
const PRINTER = preload("uid://33ctlyrpibs3")
|
||||||
|
const ALL_JOBS = preload("uid://buvi8m3atoavu")
|
||||||
|
|
||||||
# - Constants - Settings
|
# - Constants - Settings
|
||||||
# Jobs
|
# Jobs
|
||||||
const JOB_SPAWN_WAIT: float = 2.0
|
const JOB_SPAWN_WAIT: float = 2.0
|
||||||
var max_jobs: int = PlayerData.max_order_amount
|
var max_jobs: int = PlayerData.max_order_amount
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
load_all_jobs("res://Resources/Jobs/")
|
jobs_array = ALL_JOBS.jobs
|
||||||
|
|
||||||
# Create timer for job spawning
|
# Create timer for job spawning
|
||||||
job_spawn_timer = Timer.new()
|
job_spawn_timer = Timer.new()
|
||||||
|
|
@ -87,25 +87,3 @@ func _on_job_accepted_pressed(accepted_job) -> void:
|
||||||
accepted_job.queue_free()
|
accepted_job.queue_free()
|
||||||
job_interact.emit()
|
job_interact.emit()
|
||||||
#endregion
|
#endregion
|
||||||
#region Utility - Load job resources
|
|
||||||
func load_all_jobs(path: String) -> void:
|
|
||||||
var dir = DirAccess.open(path)
|
|
||||||
|
|
||||||
if dir:
|
|
||||||
dir.list_dir_begin()
|
|
||||||
var file_name = dir.get_next()
|
|
||||||
|
|
||||||
while file_name != "":
|
|
||||||
if not dir.current_is_dir() and file_name.get_extension() == "tres":
|
|
||||||
var full_path = path + file_name
|
|
||||||
var job_resource = load(full_path) as JobData
|
|
||||||
|
|
||||||
if job_resource:
|
|
||||||
jobs_array.append(job_resource)
|
|
||||||
#print(job_resource)
|
|
||||||
file_name = dir.get_next()
|
|
||||||
dir.list_dir_end()
|
|
||||||
#print(jobs_array)
|
|
||||||
else:
|
|
||||||
print("No files found on path")
|
|
||||||
#endregion
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ custom_features=""
|
||||||
export_filter="all_resources"
|
export_filter="all_resources"
|
||||||
include_filter=""
|
include_filter=""
|
||||||
exclude_filter=""
|
exclude_filter=""
|
||||||
export_path="Releases/PrintingSim-v0.2"
|
export_path="Releases/PrintingSim-stable"
|
||||||
patches=PackedStringArray()
|
patches=PackedStringArray()
|
||||||
patch_delta_encoding=false
|
patch_delta_encoding=false
|
||||||
patch_delta_compression_level_zstd=19
|
patch_delta_compression_level_zstd=19
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue