diff --git a/Resources/Jobs/job_action_figure.tres b/Resources/Jobs/job_action_figure.tres index ef64b9a..f3b0387 100644 --- a/Resources/Jobs/job_action_figure.tres +++ b/Resources/Jobs/job_action_figure.tres @@ -6,7 +6,8 @@ script = ExtResource("1_5jvwy") job_name = "Action figure (D&D)" job_reward = 25.0 -job_experience = 25.0 +job_experience = 30.0 job_amount = 1 +job_difficulty = 3 job_description = "Local D&D player needs a custom action figure for his upcoming session" metadata/_custom_type_script = "uid://bp1c3unpg2ndn" diff --git a/Resources/Jobs/job_ad_keychain.tres b/Resources/Jobs/job_ad_keychain.tres index 3c6055b..2c79ffa 100644 --- a/Resources/Jobs/job_ad_keychain.tres +++ b/Resources/Jobs/job_ad_keychain.tres @@ -5,8 +5,8 @@ [resource] script = ExtResource("1_uaqmk") job_name = "Ad keychain with logo" -job_reward = 250.0 -job_experience = 250.0 +job_reward = 5.0 +job_experience = 8.0 job_amount = 50 job_description = "Local company needs keychains with their logo for the local fair" metadata/_custom_type_script = "uid://bp1c3unpg2ndn" diff --git a/Resources/Jobs/job_cafe_cookie_stamp.tres b/Resources/Jobs/job_cafe_cookie_stamp.tres index 093deb0..235537c 100644 --- a/Resources/Jobs/job_cafe_cookie_stamp.tres +++ b/Resources/Jobs/job_cafe_cookie_stamp.tres @@ -8,5 +8,6 @@ job_name = "Cookiestamp with logo" job_reward = 80.0 job_experience = 75.0 job_amount = 3 +job_difficulty = 2 job_description = "Cafe wants to stamp their cookies with their own logo" metadata/_custom_type_script = "uid://bp1c3unpg2ndn" diff --git a/Resources/Jobs/job_college_electronic_box.tres b/Resources/Jobs/job_college_electronic_box.tres index 3c88ef2..a980417 100644 --- a/Resources/Jobs/job_college_electronic_box.tres +++ b/Resources/Jobs/job_college_electronic_box.tres @@ -8,5 +8,6 @@ job_name = "Electronic control box" job_reward = 120.0 job_experience = 110.0 job_amount = 5 +job_difficulty = 3 job_description = "College student group needs control boxes for their prototype project" metadata/_custom_type_script = "uid://bp1c3unpg2ndn" diff --git a/Resources/Jobs/job_cup_holder_seat.tres b/Resources/Jobs/job_cup_holder_seat.tres index 08b5c82..4b58a91 100644 --- a/Resources/Jobs/job_cup_holder_seat.tres +++ b/Resources/Jobs/job_cup_holder_seat.tres @@ -8,5 +8,6 @@ job_name = "Cupholder-adapter" job_reward = 55.0 job_experience = 50.0 job_amount = 1 +job_difficulty = 2 job_description = "Car enthusiast wants a custom cupholder-adapter for his project car" metadata/_custom_type_script = "uid://bp1c3unpg2ndn" diff --git a/Resources/Jobs/job_drone_chassis.tres b/Resources/Jobs/job_drone_chassis.tres index 5e65626..2264d55 100644 --- a/Resources/Jobs/job_drone_chassis.tres +++ b/Resources/Jobs/job_drone_chassis.tres @@ -8,5 +8,6 @@ job_name = "Prototype drone chassis" job_reward = 190.0 job_experience = 180.0 job_amount = 1 +job_difficulty = 5 job_description = "Anonymous client needs a complex prototype chassis" metadata/_custom_type_script = "uid://bp1c3unpg2ndn" diff --git a/Resources/Jobs/job_rc_car_control_arm.tres b/Resources/Jobs/job_rc_car_control_arm.tres index d8e4474..120a747 100644 --- a/Resources/Jobs/job_rc_car_control_arm.tres +++ b/Resources/Jobs/job_rc_car_control_arm.tres @@ -8,5 +8,6 @@ job_name = "RC-car front control arm" job_reward = 35.0 job_experience = 35.0 job_amount = 2 +job_difficulty = 4 job_description = "Hobbyist crashed his rc-car on a race and needs new control arms quickly" metadata/_custom_type_script = "uid://bp1c3unpg2ndn" diff --git a/Resources/job_data.gd b/Resources/job_data.gd index fb0c3ab..fed3fa1 100644 --- a/Resources/job_data.gd +++ b/Resources/job_data.gd @@ -14,6 +14,14 @@ extends Resource set(value): job_amount = value _generate_job_time() + +# Difficulty from 1 to 5: Easy, Medium, Hard, Pain, Torture +@export var job_difficulty: int = 1: + set(value): + clamp(value, 1, 5) + job_difficulty = value + _generate_job_time() + @export var job_description: String var job_time: float var job_material: String = "PLA" @@ -22,6 +30,7 @@ var job_material: String = "PLA" func _init() -> void: _generate_job_time() +# Generate printing time func _generate_job_time() -> void: var print_time: float = sqrt(job_experience + job_reward) * job_amount var round_time: float = round(print_time * 100) / 100 diff --git a/Scenes/Global/game_data.gd b/Scenes/Global/game_data.gd index b0c3133..9396715 100644 --- a/Scenes/Global/game_data.gd +++ b/Scenes/Global/game_data.gd @@ -31,7 +31,8 @@ func _ready() -> void: func _on_job_spawn_timer_timeout() -> void: print("Spawn timer over") - generate_job() + #generate_job() + draw_job() func generate_job(): if not current_job_count >= MAX_JOBS: @@ -43,6 +44,32 @@ func generate_job(): new_job.job_accepted.connect(_on_job_accepted_pressed) job_interact.emit() +func draw_job(): + if not current_job_count >= MAX_JOBS: + var job: JobData = generate_random_job() + current_job_count += 1 + var new_job = JOB_CARD.instantiate() + job_generated.emit(new_job) + new_job.initialize_job(job) + new_job.job_accepted.connect(_on_job_accepted_pressed) + job_interact.emit() + +func generate_random_job() -> JobData: + var new_job = JobData.new() + var random_job: JobData = jobs_array.pick_random() + var amount = randf_range(1, PlayerData.max_order_amount) + + new_job.job_name = random_job.job_name + new_job.job_reward = random_job.job_reward * amount + new_job.job_experience = random_job.job_experience * amount + new_job.job_difficulty = random_job.job_difficulty + new_job.job_amount = roundf(amount) + + print('Random amount: %.2f' % amount) + print('Job amount: %.2f' % new_job.job_amount) + print('Generated new job: %s (%d € | %d xp | %d pcs)' % [new_job.job_name, new_job.job_reward, new_job.job_experience, new_job.job_amount]) + return new_job + func _on_job_accepted_pressed(accepted_job): print("Job accepted") PlayerData.jobs.append(accepted_job.job_data) diff --git a/Scenes/Global/player_data.gd b/Scenes/Global/player_data.gd index 74c04d7..1086e91 100644 --- a/Scenes/Global/player_data.gd +++ b/Scenes/Global/player_data.gd @@ -1,28 +1,36 @@ extends Node -@export var xp: float = 0: +var xp: float = 0: set(value): xp = value xp_changed.emit(xp) -@export var money: float = 500: +var money: float = 500: set(value): money = value money_changed.emit(money) -@export var level: int = 0: +var level: int = 0: set(value): level = value level_changed.emit(level) -@export var sell_multiplier: float = 0.5 +var max_order_amount: int = 5: + set(value): + max_order_amount = value + max_order_amount_changed.emit(max_order_amount) + +var sell_multiplier: float = 0.5 var jobs: Array[JobData] +# Signal - player stats signal xp_changed(new_xp) signal money_changed(new_money) signal level_changed(new_level) +signal max_order_amount_changed(new_max_order_amount) +# Signal - functions signal give_experience(xp_amount) signal give_money(money_amount)