Merge branch 'development'

This commit is contained in:
jepsu 2026-06-30 11:04:18 +03:00
commit 5562774716
29 changed files with 641 additions and 26 deletions

View file

@ -0,0 +1,13 @@
[gd_resource type="Resource" script_class="FilamentData" format=3 uid="uid://dvu3hbx3tn0nx"]
[ext_resource type="Script" uid="uid://cim8peoxip2si" path="res://Resources/filament_data.gd" id="1_7duty"]
[resource]
script = ExtResource("1_7duty")
material = "PLA"
reward_multiplier = 1.0
xp_multiplier = 1.0
amount = 200.0
price = 4.18
description = "Filament with reduced plastic content"
metadata/_custom_type_script = "uid://cim8peoxip2si"

View file

@ -0,0 +1,10 @@
class_name FilamentData
extends Resource
@export var material: String
@export var reward_multiplier: float
@export var xp_multiplier: float
@export var amount: float
@export var price: float
@export var description: String = ""
@export var level_req: int = 1

View file

@ -0,0 +1 @@
uid://cim8peoxip2si

View file

@ -4,13 +4,22 @@ extends Node
signal job_generated(job: Node)
signal job_interact
signal printer_bought(printer: Node)
signal filament_bought
@warning_ignore("unused_signal")
signal refresh_printer_dropdown
signal notification_requested(message: String, color: String)
# - Variables - Code managed
var job_spawn_timer: Timer
var jobs_array: Array[JobData]
var current_job_count: int = 0
var filaments_array: Array[FilamentData]
# - Text colors
var hex_white: String = '#ffffff'
var hex_green: String = '#4ade80'
var hex_blue: String = '#60a5fa'
var hex_red: String = '#f87171'
# - Scenes
const JOB_CARD = preload("uid://dvfcie8hqcb0")
@ -33,6 +42,10 @@ func _ready() -> void:
job_spawn_timer.timeout.connect(_on_job_spawn_timer_timeout)
job_spawn_timer.start()
func display_msg(message: String, color: String) -> void:
notification_requested.emit(message,color)
#region Shop buy interactions
func _on_shop_printer_purchase_req(printer_data: PrinterData) -> void:
if PlayerData.try_purchase(printer_data.printer_price):
var new_printer = PRINTER.instantiate()
@ -40,10 +53,14 @@ func _on_shop_printer_purchase_req(printer_data: PrinterData) -> void:
new_printer.initialize_printer(printer_data)
PlayerData.owned_printers += 1
func _on_shop_filament_purchase_req(filament_data: FilamentData) -> void:
if PlayerData.try_purchase(filament_data.price):
filaments_array.append(filament_data)
filament_bought.emit()
#endregion
#region Job generation
func _on_job_spawn_timer_timeout() -> void:
#print("Spawn timer over")
#generate_job()
draw_job()

View file

@ -25,7 +25,13 @@ var owned_printers: int = 0:
owned_printers = value
owned_printers_changed.emit(value)
var sell_multiplier: float = 0.5
var sell_multiplier: float = 0.5:
set(value):
sell_multiplier = value
var failure_chance: float = 0.2:
set(value):
failure_chance = value
var jobs: Array[JobData]

87
Scenes/Map/Map.tscn Normal file
View file

@ -0,0 +1,87 @@
[gd_scene format=3 uid="uid://xpks7daol1db"]
[ext_resource type="Script" uid="uid://cesw3a37hqn08" path="res://Scenes/Map/map.gd" id="1_iio4a"]
[ext_resource type="PackedScene" uid="uid://c6icyfxslhlmc" path="res://Scenes/Map/map_tile.tscn" id="2_lcs11"]
[sub_resource type="Environment" id="Environment_7g6h4"]
ambient_light_source = 2
ambient_light_color = Color(0.057391837, 0.057391845, 0.057391837, 1)
fog_enabled = true
fog_light_color = Color(0.7149284, 0.74206614, 0.7842839, 1)
fog_sky_affect = 0.0
[sub_resource type="Curve" id="Curve_v0tmn"]
_data = [Vector2(0, 0), 0.0, 0.0, 0, 0, Vector2(0.5, 1), 0.0, 0.0, 0, 0, Vector2(1, 0), 0.0, 0.0, 0, 0]
point_count = 3
[sub_resource type="CurveTexture" id="CurveTexture_m2fa0"]
curve = SubResource("Curve_v0tmn")
[sub_resource type="ParticleProcessMaterial" id="ParticleProcessMaterial_6kfdn"]
emission_shape = 3
emission_box_extents = Vector3(10, 0.2, 10)
angle_min = 1.0728835e-05
angle_max = 360.00003
direction = Vector3(1, 0, 1)
initial_velocity_min = 0.049999997
initial_velocity_max = 0.19999999
gravity = Vector3(0, 0, 0)
scale_min = 2.0
scale_max = 4.0
alpha_curve = SubResource("CurveTexture_m2fa0")
[sub_resource type="Gradient" id="Gradient_yju8x"]
offsets = PackedFloat32Array(0.2, 0.8)
metadata/_snap_enabled = true
[sub_resource type="FastNoiseLite" id="FastNoiseLite_11lgl"]
[sub_resource type="NoiseTexture2D" id="NoiseTexture2D_lcs11"]
noise = SubResource("FastNoiseLite_11lgl")
color_ramp = SubResource("Gradient_yju8x")
[sub_resource type="ORMMaterial3D" id="ORMMaterial3D_11lgl"]
transparency = 1
vertex_color_use_as_albedo = true
albedo_color = Color(1, 1, 1, 0.11764706)
albedo_texture = SubResource("NoiseTexture2D_lcs11")
proximity_fade_enabled = true
[sub_resource type="SphereMesh" id="SphereMesh_lcs11"]
material = SubResource("ORMMaterial3D_11lgl")
radius = 2.0
height = 4.0
[node name="Map" type="Node3D" unique_id=1765565476]
script = ExtResource("1_iio4a")
tile_scene = ExtResource("2_lcs11")
[node name="Camera3D" type="Camera3D" parent="." unique_id=40432726]
transform = Transform3D(1, 0, 0, 0, 0.7071068, 0.7071068, 0, -0.7071068, 0.7071068, 0, 6, 5)
[node name="MapTile" parent="." unique_id=441860049 instance_placeholder="res://Scenes/Map/map_tile.tscn"]
[node name="Control" type="CanvasLayer" parent="." unique_id=1301244712]
[node name="Button" type="Button" parent="Control" unique_id=1524228928]
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -73.5
offset_top = 46.0
offset_right = 72.5
offset_bottom = 79.0
grow_horizontal = 2
text = "Generate new tile"
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1838982295]
environment = SubResource("Environment_7g6h4")
[node name="EnvFog" type="GPUParticles3D" parent="." unique_id=1381169011]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
amount = 50
lifetime = 10.0
process_material = SubResource("ParticleProcessMaterial_6kfdn")
draw_pass_1 = SubResource("SphereMesh_lcs11")
[connection signal="pressed" from="Control/Button" to="." method="_on_button_pressed"]

78
Scenes/Map/map.gd Normal file
View file

@ -0,0 +1,78 @@
extends Node3D
@export var tile_scene: PackedScene
@export var tile_size: float = 2.0
@export var tile_separation: float = 0.2
var generated_tiles: Dictionary = {}
func _ready() -> void:
spawn_tile(Vector2i(0, 0))
func spawn_tile(grid_pos: Vector2i) -> void:
if generated_tiles.has(grid_pos):
return
var tile = tile_scene.instantiate()
add_child(tile)
var x_spacing = tile_size * 0.75 + tile_separation
var z_spacing = tile_size * sqrt(3) / 2 + tile_separation
var pos_x = grid_pos.x * x_spacing
var pos_z = grid_pos.y * z_spacing + (abs(grid_pos.x) % 2) * (z_spacing / 2.0)
var target_position = Vector3(pos_x, 0, pos_z)
tile.transform.origin = Vector3(pos_x, -3.0, pos_z)
generated_tiles[grid_pos] = tile
if tile.has_method("initialize"):
tile.initialize(grid_pos.x, grid_pos.y)
var tween = create_tween()
var tile_light = tile.get_node_or_null("OmniLight3D")
if tile_light:
tile_light.light_energy = 0.0
tween.tween_property(tile, "position", target_position, 0.8)\
.set_trans(Tween.TRANS_CUBIC)\
.set_ease(Tween.EASE_OUT)
if tile_light:
tween.parallel().tween_property(tile_light, "light_energy", 1.5, 0.8)\
.set_trans(Tween.TRANS_CUBIC)\
.set_ease(Tween.EASE_OUT)
func get_hex_neighbors(grid_pos: Vector2i) -> Array[Vector2i]:
var neighbors: Array[Vector2i] = []
neighbors.append(grid_pos + Vector2i(0, -1)) # Neighbor Up
neighbors.append(grid_pos + Vector2i(0, 1)) # Neighbor Down
neighbors.append(grid_pos + Vector2i(-1, 0)) # Neighbor Left
neighbors.append(grid_pos + Vector2i(1, 0)) # Neighbor Right
if abs(grid_pos.x) % 2 == 1:
neighbors.append(grid_pos + Vector2i(-1, 1)) # Neighbor Left-Down
neighbors.append(grid_pos + Vector2i(1, 1)) # Neighbor Right-Down
else:
neighbors.append(grid_pos + Vector2i(-1, -1)) # Neighbor Left-Up
neighbors.append(grid_pos + Vector2i(1, -1)) # Neighbor Right-Up
return neighbors
func _on_button_pressed() -> void:
var open_neighbors = []
for current_pos in generated_tiles.keys():
var neighbors = get_hex_neighbors(current_pos)
for n_pos in neighbors:
if not generated_tiles.has(n_pos) and not open_neighbors.has(n_pos):
open_neighbors.append(n_pos)
if open_neighbors.size() > 0:
var random_target_pos = open_neighbors[randi() % open_neighbors.size()]
spawn_tile(random_target_pos)
print("Generated new tile at: ", random_target_pos)
else:
print("World is full")

1
Scenes/Map/map.gd.uid Normal file
View file

@ -0,0 +1 @@
uid://cesw3a37hqn08

1
Scenes/Map/map_tile.gd Normal file
View file

@ -0,0 +1 @@
extends Node3D

View file

@ -0,0 +1 @@
uid://db7luam5x7vhs

32
Scenes/Map/map_tile.tscn Normal file
View file

@ -0,0 +1,32 @@
[gd_scene format=3 uid="uid://c6icyfxslhlmc"]
[ext_resource type="Script" uid="uid://db7luam5x7vhs" path="res://Scenes/Map/map_tile.gd" id="1_0t1dj"]
[sub_resource type="CylinderMesh" id="CylinderMesh_7g6h4"]
top_radius = 1.0
bottom_radius = 1.0
height = 0.2
radial_segments = 6
[sub_resource type="CylinderShape3D" id="CylinderShape3D_7g6h4"]
height = 0.22
radius = 0.859375
[node name="MapTile" type="Node3D" unique_id=441860049]
transform = Transform3D(-4.3711385e-08, 0, -0.99999994, 0, 1, 0, 0.99999994, 0, -4.3711385e-08, 0, 0, 0)
script = ExtResource("1_0t1dj")
[node name="MeshInstance3D" type="MeshInstance3D" parent="." unique_id=786384927]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
mesh = SubResource("CylinderMesh_7g6h4")
[node name="Area3D" type="Area3D" parent="MeshInstance3D" unique_id=519127025]
[node name="CollisionShape3D" type="CollisionShape3D" parent="MeshInstance3D/Area3D" unique_id=318914845]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.0057469606, 0)
shape = SubResource("CylinderShape3D_7g6h4")
debug_color = Color(0, 0.6509804, 0.08627451, 0.52156866)
[node name="OmniLight3D" type="OmniLight3D" parent="." unique_id=1228933535]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.2232149, 0)
light_energy = 1.5

View file

@ -4,15 +4,21 @@ extends PanelContainer
@onready var printer_model_label: Label = $MarginContainer/MainArea/PrinterModelLabel
@onready var progress_bar: ProgressBar = $MarginContainer/MainArea/PrintInfo/ProgressBar
@onready var select_job: OptionButton = $MarginContainer/MainArea/SelectJob
@onready var status_label: Label = $MarginContainer/MainArea/TopInfo/StatusLabel
@onready var time_left_label: Label = $MarginContainer/MainArea/PrintInfo/TimeLeftLabel
@onready var status_label: RichTextLabel = $MarginContainer/MainArea/TopInfo/StatusLabel
@onready var time_left_label: Label = $MarginContainer/MainArea/PrintInfo/InfoRow2/TimeLeftLabel
@onready var start_button: Button = $MarginContainer/MainArea/Buttons/StartButton
@onready var reward_label: RichTextLabel = $MarginContainer/MainArea/PrintInfo/InfoRow2/RewardLabel
@onready var quality_label: RichTextLabel = $MarginContainer/MainArea/PrintInfo/InfoRow1/QualityLabel
var printer_data: PrinterData
var selected_job: JobData
var selected_job_index: int
var is_printing: bool = false
var print_failed: bool = false
var time_left: float
var failure_points: Array
var print_quality: float = 1.0
func _ready() -> void:
GameData.refresh_printer_dropdown.connect(_on_refresh_printer_dropdown)
@ -21,11 +27,14 @@ func initialize_printer(data: PrinterData) -> void:
printer_data = data
printer_name_label.text = printer_data.printer_manufacturer
printer_model_label.text = printer_data.printer_type
quality_label.visible = false
reward_label.visible = false
time_left_label.visible = false
time_left = 0
set_status()
status_label.text = 'Status: [color=%s]%s[/color]' % [GameData.hex_white, "Free"]
progress_bar.visible = false
progress_bar.value = 0
GameData.display_msg('%s printer bought!' % printer_data.printer_manufacturer, GameData.hex_green)
_on_select_job_pressed()
func _process(delta) -> void:
@ -33,8 +42,13 @@ func _process(delta) -> void:
select_job.visible = false
progress_bar.visible = true
time_left_label.visible = true
quality_label.visible = true
reward_label.visible = true
set_status()
quality_label.text = 'Quality: [color=%s]%.0f%%[/color]' % [GameData.hex_green, (print_quality * 100)]
reward_label.text = 'Reward: [color=%s]%.2f €[/color]' % [GameData.hex_green, (selected_job.job_reward * print_quality)]
var total_time = selected_job.job_time / printer_data.printer_speed
var progress = (total_time - time_left) / total_time
@ -43,31 +57,69 @@ func _process(delta) -> void:
time_left_label.text = 'Time left: %s' % calculate_time_left(time_left)
if time_left <= 0:
PlayerData.give_money.emit(selected_job.job_reward)
PlayerData.give_experience.emit(selected_job.job_experience)
select_job.visible = true
PlayerData.give_money.emit(selected_job.job_reward * print_quality)
PlayerData.give_experience.emit(selected_job.job_experience * print_quality)
reset_status()
if failure_points.has(roundf(progress_bar.value * 100)):
if failure_points[0] == roundf(progress_bar.value * 100):
if check_failure(roundf(progress_bar.value * 100)):
print_failed = true
reset_status()
elif check_failure(roundf(progress_bar.value * 100)):
print_quality -= 0.1
func reset_status() -> void:
is_printing = false
set_status()
print_failed = false
print_quality = 1.0
failure_points = []
time_left_label.visible = false
quality_label.visible = false
reward_label.visible = false
progress_bar.visible = false
progress_bar.value = 0
time_left = 0
select_job.disabled = false
select_job.visible = true
start_button.disabled = false
_on_select_job_pressed()
set_status()
func set_status() -> void:
if is_printing:
status_label.text = 'Status: Printing'
var color_hex: String = GameData.hex_white
var status: String
if print_failed:
status = 'Failed'
color_hex = GameData.hex_red
GameData.display_msg('Print failed!',color_hex)
elif is_printing:
status = 'Printing'
color_hex = GameData.hex_blue
else:
status_label.text = 'Status: Free'
status = 'Free'
color_hex = GameData.hex_green
GameData.display_msg('Print completed!',color_hex)
status_label.text = 'Status: [color=%s]%s[/color]' % [color_hex, status]
func calculate_fail_thresholds() -> Array:
var failure_checkpoints: Array = []
failure_checkpoints.append(roundf(randf_range(1,33)))
failure_checkpoints.append(roundf(randf_range(34,66)))
failure_checkpoints.append(roundf(randf_range(67,90)))
return failure_checkpoints
func check_failure(value: float) -> bool:
if randf() >= PlayerData.failure_chance:
failure_points[failure_points.bsearch(value, true)] = 0
return false
else:
failure_points[failure_points.bsearch(value, true)] = 0
return true
func calculate_time_left(time) -> String:
var minutes: int = 0
if time >= 60:
while time >= 60:
minutes += 1
@ -121,4 +173,6 @@ func _on_start_button_pressed() -> void:
else:
PlayerData.jobs.remove_at(selected_job_index)
failure_points = calculate_fail_thresholds()
print('Failure points: ', failure_points)
GameData.refresh_printer_dropdown.emit()

View file

@ -6,8 +6,11 @@
[node name="Printer" type="PanelContainer" unique_id=1372437203]
custom_minimum_size = Vector2(0, 150)
offset_right = 271.0
offset_bottom = 182.0
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
script = ExtResource("1_dlbos")
@ -30,11 +33,13 @@ size_flags_horizontal = 3
theme_override_font_sizes/font_size = 30
text = "Printer #1"
[node name="StatusLabel" type="Label" parent="MarginContainer/MainArea/TopInfo" unique_id=2117616913]
[node name="StatusLabel" type="RichTextLabel" parent="MarginContainer/MainArea/TopInfo" unique_id=157586427]
layout_mode = 2
size_flags_horizontal = 3
bbcode_enabled = true
text = "Status: Free"
horizontal_alignment = 2
vertical_alignment = 1
[node name="PrinterModelLabel" type="Label" parent="MarginContainer/MainArea" unique_id=666140345]
layout_mode = 2
@ -43,13 +48,33 @@ text = "Printer model"
[node name="PrintInfo" type="VBoxContainer" parent="MarginContainer/MainArea" unique_id=1502076264]
layout_mode = 2
[node name="FilamentLabel" type="Label" parent="MarginContainer/MainArea/PrintInfo" unique_id=181392172]
[node name="InfoRow1" type="HBoxContainer" parent="MarginContainer/MainArea/PrintInfo" unique_id=1561257387]
layout_mode = 2
text = "Material: PLA"
[node name="TimeLeftLabel" type="Label" parent="MarginContainer/MainArea/PrintInfo" unique_id=1516591173]
[node name="FilamentLabel" type="Label" parent="MarginContainer/MainArea/PrintInfo/InfoRow1" unique_id=181392172]
layout_mode = 2
text = "Time left: 15.0"
text = "Material: ###"
[node name="QualityLabel" type="RichTextLabel" parent="MarginContainer/MainArea/PrintInfo/InfoRow1" unique_id=937206053]
layout_mode = 2
size_flags_horizontal = 3
bbcode_enabled = true
text = "Print quality: ###%"
horizontal_alignment = 2
[node name="InfoRow2" type="HBoxContainer" parent="MarginContainer/MainArea/PrintInfo" unique_id=719967546]
layout_mode = 2
[node name="TimeLeftLabel" type="Label" parent="MarginContainer/MainArea/PrintInfo/InfoRow2" unique_id=1516591173]
layout_mode = 2
text = "Time left: ###s"
[node name="RewardLabel" type="RichTextLabel" parent="MarginContainer/MainArea/PrintInfo/InfoRow2" unique_id=700892606]
layout_mode = 2
size_flags_horizontal = 3
bbcode_enabled = true
text = "Reward: ###€"
horizontal_alignment = 2
[node name="ProgressBar" type="ProgressBar" parent="MarginContainer/MainArea/PrintInfo" unique_id=768246659]
layout_mode = 2

View file

@ -0,0 +1,34 @@
extends PanelContainer
signal buy_filament
var filament_data: FilamentData
@onready var filament_material: Label = %Material
@onready var description: Label = %Description
@onready var reward_multiplier: Label = %RewardMultiplier
@onready var xp_multiplier: Label = %ExperienceMultiplier
@onready var amount: Label = %Amount
@onready var price_tag: Label = %PriceTag
@onready var buy_button: Button = $Margin/Info/Price/BuyButton
func _ready() -> void:
PlayerData.money_changed.connect(_on_toggle_button)
func initialize_filament(data: FilamentData) -> void:
filament_data = data
filament_material.text = filament_data.material
description.text = filament_data.description
reward_multiplier.text = 'Reward multiplier: x%.1f' % filament_data.reward_multiplier
xp_multiplier.text = 'Experience multiplier: x%.1f' % filament_data.xp_multiplier
amount.text = 'Amount: %.0f g' % filament_data.amount
price_tag.text = 'Price: %.2f' % filament_data.price
func _on_buy_button_pressed() -> void:
buy_filament.emit(self)
func _on_toggle_button(money) -> void:
if PlayerData.money >= filament_data.price:
buy_button.disabled = false
else:
buy_button.disabled = true

View file

@ -0,0 +1 @@
uid://o733qdkp8lxl

View file

@ -0,0 +1,76 @@
[gd_scene format=3 uid="uid://csq76iufxrb4y"]
[ext_resource type="Script" uid="uid://o733qdkp8lxl" path="res://Scenes/Shop/Filaments/shop_filament_card.gd" id="1_gtjvs"]
[node name="FilamentsCard" type="PanelContainer" unique_id=368185874]
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_gtjvs")
[node name="Margin" type="MarginContainer" parent="." unique_id=1163688479]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="Info" type="VBoxContainer" parent="Margin" unique_id=1453497579]
layout_mode = 2
[node name="Title" type="VBoxContainer" parent="Margin/Info" unique_id=1904589169]
layout_mode = 2
[node name="Material" type="Label" parent="Margin/Info/Title" unique_id=24143253]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "LOL-CF"
[node name="Description" type="Label" parent="Margin/Info/Title" unique_id=870869096]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Filament description goes here"
[node name="Multipliers" type="HBoxContainer" parent="Margin/Info" unique_id=2026319482]
layout_mode = 2
[node name="RewardMultiplier" type="Label" parent="Margin/Info/Multipliers" unique_id=867010603]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Reward multiplier: x1.0"
[node name="ExperienceMultiplier" type="Label" parent="Margin/Info/Multipliers" unique_id=1033367043]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Experience multiplier: x1.0"
[node name="ProductInfo" type="HBoxContainer" parent="Margin/Info" unique_id=1243250288]
layout_mode = 2
[node name="Amount" type="Label" parent="Margin/Info/ProductInfo" unique_id=1356405418]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Amount: 123 g"
[node name="Price" type="HBoxContainer" parent="Margin/Info" unique_id=926000726]
layout_mode = 2
[node name="PriceTag" type="Label" parent="Margin/Info/Price" unique_id=881459224]
unique_name_in_owner = true
layout_mode = 2
size_flags_horizontal = 3
text = "Price: 1.23 €"
[node name="BuyButton" type="Button" parent="Margin/Info/Price" unique_id=780730344]
layout_mode = 2
size_flags_horizontal = 3
text = "Buy"
[connection signal="pressed" from="Margin/Info/Price/BuyButton" to="." method="_on_buy_button_pressed"]

View file

@ -7,7 +7,6 @@ const PRINTER_SCENE = preload("uid://bdpqvwvwmaian")
func _ready() -> void:
generate_printers()
printer_purchase_requested.connect(GameData._on_shop_printer_purchase_req)
func generate_printers() -> void:

View file

@ -1,11 +1,14 @@
[gd_scene format=3 uid="uid://bdpqvwvwmaian"]
[ext_resource type="Script" uid="uid://ttfk4n2fkifj" path="res://Scenes/Shop/Printers/printer_card.gd" id="1_tl8ce"]
[ext_resource type="Script" uid="uid://ttfk4n2fkifj" path="res://Scenes/Shop/Printers/shop_printer_card.gd" id="1_tl8ce"]
[ext_resource type="StyleBox" uid="uid://csahw36txnewl" path="res://Styles/btn_style_box_green_hover.tres" id="2_tl8ce"]
[node name="PrinterCard" type="PanelContainer" unique_id=1714388686]
offset_right = 40.0
offset_bottom = 40.0
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
size_flags_horizontal = 3
script = ExtResource("1_tl8ce")

View file

@ -0,0 +1,22 @@
extends PanelContainer
signal filament_purchase_requested(filament_data: FilamentData)
@export var filaments_array: Array[FilamentData]
const SHOP_FILAMENTS_CARD = preload("uid://csq76iufxrb4y")
func _ready() -> void:
generate_filaments()
filament_purchase_requested.connect(GameData._on_shop_filament_purchase_req)
func generate_filaments() -> void:
for filament in filaments_array:
if PlayerData.level >= filament.level_req:
var new_filament = SHOP_FILAMENTS_CARD.instantiate()
%FilamentList.add_child(new_filament)
new_filament.initialize_filament(filament)
new_filament.buy_filament.connect(_on_buy_filament_pressed)
func _on_buy_filament_pressed(bought_filament) -> void:
filament_purchase_requested.emit(bought_filament)

View file

@ -0,0 +1 @@
uid://bcowlm04qsgqc

View file

@ -1,14 +1,18 @@
[gd_scene format=3 uid="uid://d24rvu5c0gd1w"]
[ext_resource type="Script" uid="uid://d0sgvbphgssmi" path="res://Scenes/UI/ui.gd" id="1_vqjbf"]
[ext_resource type="PackedScene" uid="uid://c4tdg221rvm53" path="res://Scenes/UI/ui_notification.tscn" id="2_s3gqk"]
[ext_resource type="Script" uid="uid://bcowlm04qsgqc" path="res://Scenes/UI/shop_filaments.gd" id="9_mbl0m"]
[ext_resource type="Script" uid="uid://q8cf21vq4ka6" path="res://Scenes/tab_switcher.gd" id="13_vqjbf"]
[ext_resource type="Script" uid="uid://cg2kskiky8iur" path="res://Scenes/Shop/shop_tab_switcher.gd" id="14_vqjbf"]
[ext_resource type="Script" uid="uid://d3g5e8wjfqy5i" path="res://Scenes/Shop/Printers/printers.gd" id="15_vqjbf"]
[ext_resource type="Script" uid="uid://d3g5e8wjfqy5i" path="res://Scenes/Shop/Printers/shop_printers.gd" id="15_vqjbf"]
[ext_resource type="Script" uid="uid://bed8wdnwod4wu" path="res://Resources/printer_data.gd" id="16_rdojl"]
[ext_resource type="Resource" uid="uid://bdis2u0tfvlch" path="res://Resources/Printers/printer_bambulab_A1_mini.tres" id="17_llrls"]
[ext_resource type="Resource" uid="uid://b6x4k150ugskw" path="res://Resources/Printers/printer_creality_ender_3.tres" id="18_8rt22"]
[ext_resource type="Resource" uid="uid://b4v47rpo27kec" path="res://Resources/Printers/printer_prusa_mk4s.tres" id="19_1ohgd"]
[sub_resource type="Gradient" id="Gradient_7g6h4"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_8fchy"]
bg_color = Color(0.3529412, 0.47843137, 0.7372549, 0.47058824)
corner_radius_top_left = 6
@ -38,6 +42,23 @@ grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_vqjbf")
[node name="CPUParticles2D" type="CPUParticles2D" parent="." unique_id=61421642]
position = Vector2(568, 312)
amount = 60
lifetime = 8.0
preprocess = 8.0
speed_scale = 0.3
emission_shape = 3
emission_rect_extents = Vector2(1000, 600)
direction = Vector2(0, -1)
gravity = Vector2(0, 0)
initial_velocity_min = 20.0
initial_velocity_max = 50.0
scale_amount_min = 2.0
scale_amount_max = 5.0
color = Color(0.45585775, 0.45585775, 0.4558577, 1)
color_ramp = SubResource("Gradient_7g6h4")
[node name="VBoxContainer" type="VBoxContainer" parent="." unique_id=1634044894]
layout_mode = 1
anchors_preset = 15
@ -152,6 +173,9 @@ size_flags_horizontal = 3
size_flags_vertical = 3
theme_override_constants/separation = 8
[node name="Printer" parent="VBoxContainer/MainAreaMargin/MainArea/LeftColumn/MainMargin/PrinterScroll/MarginContainer/PrinterContainer" unique_id=1372437203 instance_placeholder="res://Scenes/Printer/printer.tscn"]
layout_mode = 2
[node name="RightColumn" type="VBoxContainer" parent="VBoxContainer/MainAreaMargin/MainArea" unique_id=653054059]
layout_mode = 2
size_flags_horizontal = 3
@ -276,6 +300,7 @@ unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 3
theme_override_styles/panel = SubResource("StyleBoxFlat_mmlst")
script = ExtResource("9_mbl0m")
[node name="ScrollContainer" type="ScrollContainer" parent="VBoxContainer/MainAreaMargin/MainArea/RightColumn/MainMargin/ShopTab/VBoxContainer/Filaments" unique_id=1087434821]
layout_mode = 2
@ -300,6 +325,16 @@ unique_name_in_owner = true
visible = false
layout_mode = 2
[node name="UiNotification" parent="." unique_id=1468421214 instance=ExtResource("2_s3gqk")]
layout_mode = 0
anchors_preset = 0
anchor_right = 0.0
anchor_bottom = 0.0
offset_right = 1152.0
offset_bottom = 649.0
grow_horizontal = 1
grow_vertical = 1
[node name="JobSpawner" type="Timer" parent="." unique_id=1696213535]
autostart = true

View file

@ -0,0 +1,11 @@
extends Control
@onready var message_label: RichTextLabel = $Base/Margin/Message
@onready var animation_player: AnimationPlayer = $AnimationPlayer
func _ready() -> void:
GameData.notification_requested.connect(_on_notification_requested)
func _on_notification_requested(message: String, color: String) -> void:
message_label.text = '[color=%s]%s[/color]' % [color, message]
animation_player.play("show_notification")

View file

@ -0,0 +1 @@
uid://y3jtgv0vknvk

View file

@ -0,0 +1,104 @@
[gd_scene format=3 uid="uid://c4tdg221rvm53"]
[ext_resource type="Script" uid="uid://y3jtgv0vknvk" path="res://Scenes/UI/ui_notification.gd" id="1_7y7gh"]
[sub_resource type="Animation" id="Animation_8qs5e"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Base:position:y")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [-50.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Base:modulate:a")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [1.0]
}
[sub_resource type="Animation" id="Animation_np30a"]
resource_name = "show_notification"
length = 3.0000000000000004
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Base:position:y")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.29999995),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [-50.0, 10.0]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Base:modulate:a")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 1.5, 3),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 0,
"values": [1.0, 1.0, 0.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_7ag70"]
_data = {
&"RESET": SubResource("Animation_8qs5e"),
&"show_notification": SubResource("Animation_np30a")
}
[node name="UiNotification" type="Control" unique_id=1468421214]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
script = ExtResource("1_7y7gh")
[node name="Base" type="PanelContainer" parent="." unique_id=870318481]
layout_mode = 1
anchors_preset = 5
anchor_left = 0.5
anchor_right = 0.5
offset_left = -79.0
offset_top = -50.0
offset_right = 79.0
offset_bottom = -7.0
grow_horizontal = 2
[node name="Margin" type="MarginContainer" parent="Base" unique_id=716680500]
layout_mode = 2
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 10
[node name="Message" type="RichTextLabel" parent="Base/Margin" unique_id=438265807]
layout_mode = 2
bbcode_enabled = true
text = "Example message"
fit_content = true
autowrap_mode = 0
horizontal_alignment = 1
vertical_alignment = 1
[node name="AnimationPlayer" type="AnimationPlayer" parent="." unique_id=152270752]
libraries/ = SubResource("AnimationLibrary_7ag70")

View file

@ -8,7 +8,8 @@ name="Linux"
platform="Linux"
dedicated_server=false
custom_features=""
export_filter="all_resources"
export_filter="scenes"
export_files=PackedStringArray("res://Scenes/Map/Map.tscn", "res://Scenes/Map/map_tile.tscn")
include_filter=""
exclude_filter=""
export_path="Releases/PrintingSim-stable"

View file

@ -28,3 +28,4 @@ GameData="*uid://d3abg1dpwrkmq"
rendering_device/driver.windows="d3d12"
renderer/rendering_method="mobile"
environment/defaults/default_clear_color=Color(0, 0, 0, 1)