5 Commits

Author SHA1 Message Date
77df5fbbfd add human dresses 2026-06-27 18:13:09 +02:00
Matteo Sonaglioni
ed5eb706a1 fix ai 2026-06-27 17:47:15 +02:00
Matteo Sonaglioni
58f9188794 Merge branch 'main' into polish8 2026-06-27 16:40:46 +02:00
c0a68da7d1 update and improve ui 2026-06-27 11:54:01 +00:00
97bbca95e8 add sit state and colors to cat 2026-06-25 19:46:13 +00:00
42 changed files with 960 additions and 151 deletions

View File

@@ -32,7 +32,8 @@ func _ready() -> void:
toggle_enable_state_machine()
func toggle_enable_state_machine() -> void:
state_machine.enable = _enable_state_machine
if state_machine:
state_machine.enable = _enable_state_machine
func _physics_process(delta: float) -> void:
if !_enable_state_machine:

View File

@@ -0,0 +1,38 @@
extends AIBase
class_name AICat
@export_group("Cat Colors")
@export var mesh: MeshInstance3D
@export var fur_colors: Array[Color] = []
@export var eye_colors: Array[Color] = []
@export var fur_material_index: int = 0
@export var eye_material_index: int = 1
func _ready() -> void:
super._ready()
_apply_random_color()
func _apply_random_color() -> void:
if fur_colors.is_empty() or eye_colors.is_empty():
return
if not mesh or not mesh.mesh:
return
var max_index = min(fur_colors.size(), eye_colors.size())
var random_idx = randi() % max_index
_override_material_color(mesh, fur_material_index, fur_colors[random_idx])
_override_material_color(mesh, eye_material_index, eye_colors[random_idx])
func _override_material_color(mesh_node: MeshInstance3D, surface_idx: int, color: Color) -> void:
if surface_idx < 0 or surface_idx >= mesh_node.mesh.get_surface_count():
return
var mat = mesh_node.mesh.surface_get_material(surface_idx)
if mat and mat is StandardMaterial3D:
var new_mat = mat.duplicate() as StandardMaterial3D
new_mat.albedo_color = color
mesh_node.set_surface_override_material(surface_idx, new_mat)

View File

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

View File

@@ -2,10 +2,61 @@
[ext_resource type="PackedScene" uid="uid://clx701xdwelgx" path="res://core/ai/agents/base/ai_base.tscn" id="1_85o24"]
[ext_resource type="Script" uid="uid://d3hy70ec8vqo5" path="res://core/ai/framework/run_animation_state.gd" id="2_6mu8r"]
[ext_resource type="Script" uid="uid://cx67xas1hxv3x" path="res://core/ai/agents/cat/ai_cat.gd" id="2_cat_script"]
[ext_resource type="PackedScene" uid="uid://c5rccx22gs6jt" path="res://core/ai/agents/cat/Cat_rig.fbx" id="2_rohxe"]
[ext_resource type="Script" uid="uid://bngfthvt04ivv" path="res://core/ai/framework/patrol_state.gd" id="3_0jm3k"]
[ext_resource type="Script" uid="uid://dty1p02kqviwf" path="res://core/ai/framework/sit_state.gd" id="3_scd7t"]
[ext_resource type="Shader" uid="uid://d0ch5ofrgf7y6" path="res://core/daynight/trunk_shader.gdshader" id="7_rxsfd"]
[node name="AiCat" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_85o24")]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_1rb57"]
render_priority = 0
shader = ExtResource("7_rxsfd")
shader_parameter/albedo_color = Color(0.7389186, 0.53468716, 0.19165063, 1)
shader_parameter/use_texture = true
shader_parameter/uv_scale = Vector2(1, 1)
shader_parameter/palette_shift_y = 0.0
shader_parameter/gradient_start_y = 0.0
shader_parameter/gradient_end_y = 10.0
shader_parameter/light_steps = 3.0
shader_parameter/step_softness = 0.1
shader_parameter/shadow_color = Color(0.4, 0.4, 0.6, 1)
shader_parameter/shadow_offset = 0.0
shader_parameter/cast_shadow_strength = 0.6
shader_parameter/use_ghibli_glint = true
shader_parameter/glint_color = Color(1, 0.95, 0.85, 1)
shader_parameter/glint_intensity = 1.0
shader_parameter/glint_sharpness = 32.0
shader_parameter/emission_color = Color(0, 0, 0, 1)
shader_parameter/emission_energy = 0.0
[sub_resource type="ShaderMaterial" id="ShaderMaterial_42ie3"]
render_priority = 0
shader = ExtResource("7_rxsfd")
shader_parameter/albedo_color = Color(0.099985994, 0.09998601, 0.099985965, 1)
shader_parameter/use_texture = true
shader_parameter/uv_scale = Vector2(1, 1)
shader_parameter/palette_shift_y = 0.0
shader_parameter/gradient_start_y = 0.0
shader_parameter/gradient_end_y = 10.0
shader_parameter/light_steps = 3.0
shader_parameter/step_softness = 0.1
shader_parameter/shadow_color = Color(0.4, 0.4, 0.6, 1)
shader_parameter/shadow_offset = 0.0
shader_parameter/cast_shadow_strength = 0.6
shader_parameter/use_ghibli_glint = true
shader_parameter/glint_color = Color(1, 0.95, 0.85, 1)
shader_parameter/glint_intensity = 1.0
shader_parameter/glint_sharpness = 32.0
shader_parameter/emission_color = Color(0, 0, 0, 1)
shader_parameter/emission_energy = 0.0
[node name="AiCat" unique_id=1228675528 node_paths=PackedStringArray("mesh", "anim_player") instance=ExtResource("1_85o24")]
script = ExtResource("2_cat_script")
mesh = NodePath("Cat_rig/Rig_Cat/Skeleton3D/Cat")
fur_colors = Array[Color]([Color(0.8716863, 0.762116, 0.1809479, 1)])
eye_colors = Array[Color]([Color(0.12955844, 0.12955847, 0.12955844, 1), Color(0.6901961, 0.3019608, 0.12156863, 1), Color(0.6830768, 0.6830776, 0.68307686, 1), Color(0.6273405, 0.15743047, 0, 1)])
fur_material_index = 0
eye_material_index = 1
anim_player = NodePath("Cat_rig/AnimationPlayer")
entity_type = 3
entity_name = "Cat"
@@ -17,9 +68,16 @@ initial_state = NodePath("IdleState")
script = ExtResource("2_6mu8r")
state_id = &"idle"
next_state_id = &"patrol"
random_next_state_ids = Array[StringName]([&"patrol", &"sit"])
animation_name = "Cat_Idle"
[node name="PatrolState" type="Node" parent="StateMachine" index="1" unique_id=1861645340]
[node name="SitState" type="Node" parent="StateMachine" index="1" unique_id=860354787]
script = ExtResource("3_scd7t")
state_id = &"sit"
next_state_id = &"idle"
animation_name = "Cat_Sit"
[node name="PatrolState" type="Node" parent="StateMachine" index="2" unique_id=1861645340]
script = ExtResource("3_0jm3k")
state_id = &"patrol"
next_state_id = &"idle"
@@ -28,7 +86,7 @@ exit_on_action_finished = true
[node name="Cat_rig" parent="." index="3" unique_id=1332997618 instance=ExtResource("2_rohxe")]
[node name="Skeleton3D" parent="Cat_rig/Rig_Cat" parent_id_path=PackedInt32Array(1332997618, 1292226211) index="0" unique_id=807490174]
[node name="Skeleton3D" parent="Cat_rig/Rig_Cat" parent_id_path=PackedInt32Array(1332997618, 1024066488) index="0" unique_id=1455145313]
bones/1/position = Vector3(1.6719584e-08, 0.23547882, 0.34218493)
bones/1/rotation = Quaternion(0.12769094, -0.6954821, -0.12769029, 0.69548184)
bones/2/rotation = Quaternion(-1.5819447e-07, -1.9079575e-07, -0.5904159, 0.8070992)
@@ -57,4 +115,8 @@ bones/27/rotation = Quaternion(-8.140452e-08, 1.1560887e-07, -0.47071794, 0.8822
bones/28/position = Vector3(0.18089616, -0.000116375166, 0.011642809)
bones/28/rotation = Quaternion(4.5638826e-05, -8.8217595e-05, 0.5290293, 0.84860367)
[node name="Cat" parent="Cat_rig/Rig_Cat/Skeleton3D" index="0" unique_id=869144045]
surface_material_override/0 = SubResource("ShaderMaterial_1rb57")
surface_material_override/1 = SubResource("ShaderMaterial_42ie3")
[editable path="Cat_rig"]

View File

@@ -15,12 +15,14 @@ initial_state = NodePath("WaitTrainState")
[node name="WaitTrainState" type="Node" parent="StateMachine" index="0" unique_id=1000000000]
script = ExtResource("3_wait")
fly_distance_threshold = 10.0
state_id = &"wait"
next_state_id = &"fly"
animation_name = "Idle_Crow"
[node name="FlyAwayState" type="Node" parent="StateMachine" index="1" unique_id=1000000001]
script = ExtResource("4_fly")
destroy_after_seconds = 20.0
state_id = &"fly"
animation_name = "Fly_Crow"

Binary file not shown.

View File

@@ -0,0 +1,44 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://b3j2dbcqwodx1"
path="res://.godot/imported/Farmer1.fbx-c6b3fa9e901f9ab5b38c67c1343eab85.scn"
[deps]
source_file="res://core/ai/agents/human/Farmer1.fbx"
dest_files=["res://.godot/imported/Farmer1.fbx-c6b3fa9e901f9ab5b38c67c1343eab85.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=true
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={}
fbx/importer=0
fbx/allow_geometry_helper_nodes=false
fbx/embedded_image_handling=1
fbx/naming_version=2

Binary file not shown.

View File

@@ -0,0 +1,44 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://c5x3ycaxixpxy"
path="res://.godot/imported/Farmer2.fbx-da830fcedaed7d46b77458a4c0e1f611.scn"
[deps]
source_file="res://core/ai/agents/human/Farmer2.fbx"
dest_files=["res://.godot/imported/Farmer2.fbx-da830fcedaed7d46b77458a4c0e1f611.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=true
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={}
fbx/importer=0
fbx/allow_geometry_helper_nodes=false
fbx/embedded_image_handling=1
fbx/naming_version=2

View File

@@ -10,7 +10,7 @@ entity_name = "Farmer"
allowed_biomes = Array[String](["countryside"])
[node name="StateMachine" parent="." index="1" unique_id=1286404264 node_paths=PackedStringArray("initial_state")]
initial_state = NodePath("GatherState")
initial_state = NodePath("IdleState")
[node name="PatrolState" type="Node" parent="StateMachine" index="0" unique_id=930272128]
script = ExtResource("3_2oda6")
@@ -35,7 +35,40 @@ next_state_id = &"patrol"
animation_name = "custom/idle"
[node name="Skeleton3D" parent="BaseMesh/BaseMesh" parent_id_path=PackedInt32Array(1846171523, 1363988051) index="0" unique_id=1848874512]
bones/8/rotation = Quaternion(-0.6173422, -0.37346625, 0.5666242, -0.3979305)
bones/46/rotation = Quaternion(0.059241787, 0.12928401, 0.9836761, -0.110261135)
bones/0/position = Vector3(-0.0015795716, 0.9761277, 0.0012886743)
bones/0/rotation = Quaternion(0.008345705, 0.02440254, -0.0222881, 0.999419)
bones/1/rotation = Quaternion(-0.033856627, 0.0019547925, 0.01148837, 0.9993588)
bones/2/rotation = Quaternion(0.003385691, 0.0057030413, 0.004773842, 0.9999666)
bones/3/rotation = Quaternion(0.0033856947, 0.0057030534, 0.0047738357, 0.9999666)
bones/4/rotation = Quaternion(0.03554347, -0.0036022358, -0.01067691, 0.9993046)
bones/5/rotation = Quaternion(0.023500564, -0.0268053, 0.016007349, 0.9992362)
bones/8/rotation = Quaternion(-0.677935, -0.3162402, 0.5391133, -0.3869797)
bones/9/rotation = Quaternion(0.33057448, -0.0144906035, -0.024771411, 0.9433436)
bones/10/rotation = Quaternion(0.071588665, 0.16423635, 0.26876602, 0.9463965)
bones/11/rotation = Quaternion(-0.11033899, 0.19317266, 0.18225361, 0.95775425)
bones/12/rotation = Quaternion(0.28979003, -0.100065045, 0.021221647, 0.95160836)
bones/13/rotation = Quaternion(-0.01075587, -0.003262491, 0.085242614, 0.9962969)
bones/17/rotation = Quaternion(0.372185, -0.04203017, 0.003265603, 0.9272007)
bones/18/rotation = Quaternion(0.6449709, -0.022805, 0.11591787, 0.7550203)
bones/22/rotation = Quaternion(0.5152635, -0.09862117, 0.07484319, 0.8480425)
bones/23/rotation = Quaternion(0.7634141, -0.01797779, 0.14009176, 0.63027775)
bones/27/rotation = Quaternion(0.6460654, -0.34361044, 0.58023506, 0.35757324)
bones/28/rotation = Quaternion(0.3564352, 0.033001784, 0.1479881, 0.9219352)
bones/29/rotation = Quaternion(0.10407414, -0.119882874, -0.20823832, 0.96510804)
bones/30/rotation = Quaternion(-0.040577345, -0.20657076, -0.14159827, 0.96728075)
bones/31/rotation = Quaternion(0.18718895, 0.11185156, -0.005364931, 0.97592044)
bones/32/rotation = Quaternion(0.077440694, -0.18545257, 0.02808432, 0.9791944)
bones/36/rotation = Quaternion(0.33726785, 0.06133867, 0.07482985, 0.93642324)
bones/37/rotation = Quaternion(0.5483169, 0.027307179, -0.058035128, 0.83380747)
bones/41/rotation = Quaternion(0.4086348, 0.09420283, 0.037183065, 0.90706164)
bones/42/rotation = Quaternion(0.59161603, 0.030198008, -0.037664413, 0.8047733)
bones/46/rotation = Quaternion(0.060233127, 0.24369022, 0.966249, -0.05787964)
bones/47/rotation = Quaternion(-0.56581247, 0.0105282655, -0.0027436528, 0.8244622)
bones/48/rotation = Quaternion(0.46872035, 0.0146656195, -0.0033694527, 0.88321847)
bones/49/rotation = Quaternion(0.49349385, 0.06718427, -0.01829647, 0.86695755)
bones/52/rotation = Quaternion(-0.0765912, 0.12600712, 0.988389, -0.03665043)
bones/53/rotation = Quaternion(-0.25056988, -0.06629382, 0.018621337, 0.96564656)
bones/54/rotation = Quaternion(0.549743, -0.041815143, -0.046032935, 0.83301574)
bones/55/rotation = Quaternion(0.3627838, -0.05369254, 0.01255593, 0.9302406)
[editable path="BaseMesh"]

View File

@@ -6,6 +6,9 @@
[ext_resource type="Animation" uid="uid://ptj85lvvtjpg" path="res://core/ai/agents/human/sitting.res" id="4_8kg0q"]
[ext_resource type="Animation" uid="uid://oq22ilhxjejj" path="res://core/ai/agents/human/idle.res" id="4_cuxdk"]
[ext_resource type="Animation" uid="uid://6xnsf8x7nmsl" path="res://core/ai/agents/human/walking.res" id="6_cuxdk"]
[ext_resource type="PackedScene" uid="uid://b3j2dbcqwodx1" path="res://core/ai/agents/human/Farmer1.fbx" id="7_hguxe"]
[ext_resource type="PackedScene" uid="uid://c5x3ycaxixpxy" path="res://core/ai/agents/human/Farmer2.fbx" id="8_ke7sb"]
[ext_resource type="Script" uid="uid://dauqq8cqmwrqh" path="res://core/ai/agents/human/dress_human.gd" id="9_2tpdi"]
[sub_resource type="AnimationLibrary" id="AnimationLibrary_8kg0q"]
_data = {
@@ -15,13 +18,79 @@ _data = {
&"walking": ExtResource("6_cuxdk")
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_ke7sb"]
_data = {
&"gathering": ExtResource("3_8kg0q"),
&"idle": ExtResource("4_cuxdk"),
&"sitting": ExtResource("4_8kg0q"),
&"walking": ExtResource("6_cuxdk")
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_2tpdi"]
_data = {
&"gathering": ExtResource("3_8kg0q"),
&"idle": ExtResource("4_cuxdk"),
&"sitting": ExtResource("4_8kg0q"),
&"walking": ExtResource("6_cuxdk")
}
[node name="AiHuman" unique_id=1228675528 node_paths=PackedStringArray("anim_player") instance=ExtResource("1_hko2w")]
anim_player = NodePath("BaseMesh/AnimationPlayer")
[node name="BaseMesh" parent="." index="3" unique_id=1846171523 instance=ExtResource("3_ef4cu")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0)
[node name="Skeleton3D" parent="BaseMesh/BaseMesh" parent_id_path=PackedInt32Array(1846171523, 1142246531) index="0" unique_id=928995817]
[node name="Skeleton3D" parent="BaseMesh/BaseMesh" parent_id_path=PackedInt32Array(1846171523, 2032005240) index="0" unique_id=1876883359]
bones/0/position = Vector3(-0.0024333135, 0.9952637, 6.9276895e-05)
bones/0/rotation = Quaternion(-0.0049152793, -0.050206795, -0.026513178, 0.99837476)
bones/1/rotation = Quaternion(-0.025209453, 0.006135946, 0.009180705, 0.9996213)
bones/2/rotation = Quaternion(0.020680578, 0.011754706, 0.015464293, 0.99959743)
bones/3/rotation = Quaternion(0.020680578, 0.011754692, 0.015464287, 0.99959743)
bones/4/rotation = Quaternion(-0.053108443, 0.009324013, 0.011697456, 0.9984768)
bones/5/rotation = Quaternion(0.03947722, 0.0123098595, -0.024802445, 0.99883676)
bones/8/rotation = Quaternion(-0.5728458, -0.38286844, 0.60871977, -0.39334446)
bones/9/rotation = Quaternion(0.44939622, 0.29187396, 0.053696252, 0.84259677)
bones/10/rotation = Quaternion(-0.013349593, 0.006303966, 0.231745, 0.97266454)
bones/11/rotation = Quaternion(-0.13493852, -0.23365982, 0.088579476, 0.95882654)
bones/12/rotation = Quaternion(0.1921569, 0.10821218, -0.024087887, 0.9750824)
bones/13/rotation = Quaternion(0.025333803, 0.00917047, 0.048555605, 0.9984571)
bones/14/rotation = Quaternion(-0.0120385215, 0.035021365, -0.027293455, 0.99894124)
bones/17/rotation = Quaternion(0.09417869, -0.072669275, -0.17156787, 0.9779642)
bones/18/rotation = Quaternion(0.14308922, 0.0019350327, -0.0097575225, 0.98965985)
bones/19/rotation = Quaternion(0.114431076, 0.0009974723, -0.016153814, 0.99329937)
bones/22/rotation = Quaternion(0.11025663, -0.026056329, -0.115814656, 0.9867886)
bones/23/rotation = Quaternion(0.08941777, 0.0010620031, -0.023814844, 0.9957089)
bones/24/rotation = Quaternion(0.18236126, 0.0039793584, -0.014504941, 0.9831166)
bones/27/rotation = Quaternion(0.5637914, -0.40525162, 0.5912719, 0.41025364)
bones/28/rotation = Quaternion(0.5117543, -0.062450167, 0.07040776, 0.8539615)
bones/29/rotation = Quaternion(0.06749446, 0.22771753, -0.20722775, 0.9490237)
bones/30/rotation = Quaternion(-0.0005478785, -0.33554533, -0.112540804, 0.93527734)
bones/31/rotation = Quaternion(0.13877106, 0.12508087, 0.031252213, 0.9818965)
bones/32/rotation = Quaternion(-0.01564488, 0.0028465544, -0.073795564, 0.9971466)
bones/33/rotation = Quaternion(0.09055836, 0.16444178, -0.016598457, 0.9820808)
bones/36/rotation = Quaternion(0.048626706, 0.08521321, 0.1502388, 0.98376954)
bones/37/rotation = Quaternion(0.20746112, 0.00031290663, 0.0112788575, 0.97817826)
bones/38/rotation = Quaternion(0.15843387, -0.0010695796, -0.0025179624, 0.9873659)
bones/41/rotation = Quaternion(0.16202472, 0.04171574, 0.09497025, 0.98131984)
bones/42/rotation = Quaternion(0.14799795, 0.00100551, 0.030993575, 0.9885015)
bones/43/rotation = Quaternion(0.04765674, -0.005312021, -0.037802245, 0.9981341)
bones/46/rotation = Quaternion(0.024758164, 0.13509843, 0.9874187, -0.07835583)
bones/47/rotation = Quaternion(-0.1871983, 0.0008643933, -0.010582049, 0.98226476)
bones/48/rotation = Quaternion(0.46037424, -0.13497493, 0.042778272, 0.87636036)
bones/49/rotation = Quaternion(0.3209879, 0.038273156, 0.0024189365, 0.9463065)
bones/52/rotation = Quaternion(-0.060150255, 0.009860813, 0.99663967, -0.05471906)
bones/53/rotation = Quaternion(-0.10502596, -0.00032293255, 0.008123855, 0.9944363)
bones/54/rotation = Quaternion(0.51151097, 0.066536464, -0.07767137, 0.8531686)
bones/55/rotation = Quaternion(0.3453064, -0.067497015, 0.02391528, 0.93575406)
[node name="AnimationPlayer" parent="BaseMesh" index="1" unique_id=226905852]
libraries/custom = SubResource("AnimationLibrary_8kg0q")
[node name="Farmer1" parent="." index="4" unique_id=925374995 instance=ExtResource("7_hguxe")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0)
visible = false
[node name="Skeleton3D" parent="Farmer1/BaseMesh" parent_id_path=PackedInt32Array(925374995, 35893719) index="0" unique_id=264693097]
bones/0/position = Vector3(0.00060560287, 0.9719096, 0.007789615)
bones/0/rotation = Quaternion(-0.03158553, -0.024531638, -0.086598895, 0.9954402)
bones/1/rotation = Quaternion(-0.068302006, -0.011589706, 0.088431515, 0.99367017)
@@ -29,7 +98,7 @@ bones/2/rotation = Quaternion(0.013750468, -0.0028497525, 0.022636604, 0.9996452
bones/3/rotation = Quaternion(0.014052153, -0.0046672956, 0.021981178, 0.99964875)
bones/4/rotation = Quaternion(0.08060878, 0.0009885994, -0.05385771, 0.99528927)
bones/5/rotation = Quaternion(-0.08819712, -0.010719821, 0.004734955, 0.9960341)
bones/8/rotation = Quaternion(-0.5780019, -0.40066734, 0.5948007, -0.38934776)
bones/8/rotation = Quaternion(-0.6173422, -0.37346625, 0.5666242, -0.3979305)
bones/9/rotation = Quaternion(0.5403529, 0.038538188, -0.087646246, 0.8359735)
bones/10/rotation = Quaternion(-0.009744837, 0.0007412914, 0.18789424, 0.98214066)
bones/11/rotation = Quaternion(0.019992959, 0.15807849, 0.15262179, 0.9753554)
@@ -55,7 +124,7 @@ bones/38/rotation = Quaternion(0.13336712, -0.0009009653, 0.002359003, 0.9910635
bones/41/rotation = Quaternion(0.12012116, 0.015946638, 0.088212825, 0.9887037)
bones/42/rotation = Quaternion(0.11693482, 0.00096280884, 0.06057904, 0.99128985)
bones/43/rotation = Quaternion(0.22191456, 0.026510797, -0.016629422, 0.9745638)
bones/46/rotation = Quaternion(0.00039673893, 0.021240532, 0.99960107, -0.018613452)
bones/46/rotation = Quaternion(0.059241787, 0.12928401, 0.9836761, -0.110261135)
bones/47/rotation = Quaternion(-0.34151906, -0.06546942, 0.0071559767, 0.93756455)
bones/48/rotation = Quaternion(0.60213244, 0.010313871, -0.012120304, 0.7982376)
bones/49/rotation = Quaternion(0.31586254, 0.059334766, -0.020474449, 0.9467265)
@@ -64,7 +133,65 @@ bones/53/rotation = Quaternion(-0.20515193, 0.049833227, 0.0071537, 0.9774345)
bones/54/rotation = Quaternion(0.55275166, -0.049315806, -0.007871797, 0.8318483)
bones/55/rotation = Quaternion(0.326561, -0.058840513, 0.019667907, 0.9431378)
[node name="AnimationPlayer" parent="BaseMesh" index="1" unique_id=2096005878]
libraries/custom = SubResource("AnimationLibrary_8kg0q")
[node name="AnimationPlayer" parent="Farmer1" index="1" unique_id=1795570086]
libraries/custom = SubResource("AnimationLibrary_ke7sb")
[node name="Farmer2" parent="." index="5" unique_id=1239853450 instance=ExtResource("8_ke7sb")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.9, 0)
visible = false
[node name="Skeleton3D" parent="Farmer2/BaseMesh" parent_id_path=PackedInt32Array(1239853450, 2123768022) index="0" unique_id=1560566445]
bones/0/position = Vector3(0.00060560287, 0.9719096, 0.007789615)
bones/0/rotation = Quaternion(-0.03158553, -0.024531638, -0.086598895, 0.9954402)
bones/1/rotation = Quaternion(-0.068302006, -0.011589706, 0.088431515, 0.99367017)
bones/2/rotation = Quaternion(0.013750468, -0.0028497525, 0.022636604, 0.99964523)
bones/3/rotation = Quaternion(0.014052153, -0.0046672956, 0.021981178, 0.99964875)
bones/4/rotation = Quaternion(0.08060878, 0.0009885994, -0.05385771, 0.99528927)
bones/5/rotation = Quaternion(-0.08819712, -0.010719821, 0.004734955, 0.9960341)
bones/8/rotation = Quaternion(-0.6173422, -0.37346625, 0.5666242, -0.3979305)
bones/9/rotation = Quaternion(0.5403529, 0.038538188, -0.087646246, 0.8359735)
bones/10/rotation = Quaternion(-0.009744837, 0.0007412914, 0.18789424, 0.98214066)
bones/11/rotation = Quaternion(0.019992959, 0.15807849, 0.15262179, 0.9753554)
bones/12/rotation = Quaternion(0.11525436, -0.03521942, -0.0147265345, 0.9926023)
bones/13/rotation = Quaternion(0.004553697, -0.0011956134, 0.0748576, 0.9971832)
bones/14/rotation = Quaternion(-0.021573644, -0.09607655, -0.02610063, 0.9947978)
bones/17/rotation = Quaternion(0.10615231, -0.012490018, -0.06538699, 0.9921191)
bones/18/rotation = Quaternion(0.112639524, -0.0005986789, -0.020016164, 0.99343413)
bones/19/rotation = Quaternion(0.13624819, 0.001439244, -0.018421004, 0.9905025)
bones/22/rotation = Quaternion(0.051831737, -0.007218998, -0.063239366, 0.9966254)
bones/23/rotation = Quaternion(0.12439526, 0.00031310506, -0.03746358, 0.99152523)
bones/24/rotation = Quaternion(0.14832872, 0.0028264069, -0.017447466, 0.9887802)
bones/27/rotation = Quaternion(0.6085938, -0.37735197, 0.5827399, 0.3842309)
bones/28/rotation = Quaternion(0.42811802, -0.12440211, 0.04666202, 0.8939026)
bones/29/rotation = Quaternion(-0.010464899, -0.0008133942, -0.24076757, 0.97052604)
bones/30/rotation = Quaternion(0.01554073, -0.15455346, -0.11519627, 0.9811226)
bones/31/rotation = Quaternion(0.109474085, 0.02398801, 0.02464503, 0.99339455)
bones/32/rotation = Quaternion(-0.03558804, 0.04901748, 0.08471445, 0.9945624)
bones/33/rotation = Quaternion(0.014632019, 0.019343862, -0.1317728, 0.9909832)
bones/36/rotation = Quaternion(0.19392295, 0.020005528, 0.11780725, 0.973712)
bones/37/rotation = Quaternion(0.090232305, 2.462184e-07, 0.01726049, 0.9957712)
bones/38/rotation = Quaternion(0.13336712, -0.0009009653, 0.002359003, 0.9910635)
bones/41/rotation = Quaternion(0.12012116, 0.015946638, 0.088212825, 0.9887037)
bones/42/rotation = Quaternion(0.11693482, 0.00096280884, 0.06057904, 0.99128985)
bones/43/rotation = Quaternion(0.22191456, 0.026510797, -0.016629422, 0.9745638)
bones/46/rotation = Quaternion(0.059241787, 0.12928401, 0.9836761, -0.110261135)
bones/47/rotation = Quaternion(-0.34151906, -0.06546942, 0.0071559767, 0.93756455)
bones/48/rotation = Quaternion(0.60213244, 0.010313871, -0.012120304, 0.7982376)
bones/49/rotation = Quaternion(0.31586254, 0.059334766, -0.020474449, 0.9467265)
bones/52/rotation = Quaternion(-0.07240856, 0.034467246, 0.9931159, -0.085380435)
bones/53/rotation = Quaternion(-0.20515193, 0.049833227, 0.0071537, 0.9774345)
bones/54/rotation = Quaternion(0.55275166, -0.049315806, -0.007871797, 0.8318483)
bones/55/rotation = Quaternion(0.326561, -0.058840513, 0.019667907, 0.9431378)
[node name="AnimationPlayer" parent="Farmer2" index="1" unique_id=916643412]
libraries/custom = SubResource("AnimationLibrary_2tpdi")
[node name="DressHuman" type="Node3D" parent="." index="6" unique_id=107727715 node_paths=PackedStringArray("farmers", "main_anim_player")]
script = ExtResource("9_2tpdi")
farmers = [NodePath("../Farmer1"), NodePath("../Farmer2")]
colors = Array[Color]([Color(0, 0, 0, 1), Color(1, 1, 1, 1), Color(1, 0, 0, 1), Color(0, 1, 0, 1), Color(0, 0, 1, 1)])
main_anim_player = NodePath("../BaseMesh/AnimationPlayer")
[editable path="BaseMesh"]
[editable path="Farmer1"]
[editable path="Farmer2"]

View File

@@ -0,0 +1,59 @@
extends Node
@export var farmers: Array[Node3D]
@export var colors: Array[Color]
@export var main_anim_player: AnimationPlayer
var dress_anim_player: AnimationPlayer
func _ready() -> void:
if farmers.is_empty():
return
for farmer in farmers:
if farmer:
farmer.hide()
var selected_farmer = farmers.pick_random()
if selected_farmer:
selected_farmer.show()
dress_anim_player = selected_farmer.get_node_or_null("AnimationPlayer")
if main_anim_player and dress_anim_player:
main_anim_player.current_animation_changed.connect(_on_animation_sync)
main_anim_player.animation_started.connect(_on_animation_sync)
if main_anim_player.current_animation != "":
_on_animation_sync(main_anim_player.current_animation)
dress_anim_player.seek(main_anim_player.current_animation_position)
if colors.size() > 0:
var parts_to_color = ["pants", "shirt"]
var shared_color = colors.pick_random()
for part_name in parts_to_color:
var piece_node = _find_mesh_case_insensitive(selected_farmer, part_name)
if piece_node:
var mat = StandardMaterial3D.new()
mat.albedo_color = shared_color
piece_node.set_surface_override_material(0, mat)
func _on_animation_sync(anim_name: StringName) -> void:
if dress_anim_player and dress_anim_player.has_animation(anim_name):
dress_anim_player.play(anim_name)
dress_anim_player.speed_scale = main_anim_player.speed_scale
func _find_mesh_case_insensitive(parent: Node, part_name: String) -> MeshInstance3D:
var target = part_name.to_lower()
for child in parent.get_children():
if child.name.to_lower().contains(target) and child is MeshInstance3D:
return child
var found = _find_mesh_case_insensitive(child, target)
if found:
return found
return null

View File

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

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,40 @@
extends State
class_name SitState
var reverse: bool = false
func enter() -> void:
reverse = false
super.enter()
if agent.anim_player and not agent.anim_player.animation_finished.is_connected(_on_animation_finished):
agent.anim_player.animation_finished.connect(_on_animation_finished)
if runtime_timer and not runtime_timer.is_stopped():
runtime_timer.stop()
run_animation()
func exit() -> void:
super.exit()
if agent.anim_player and agent.anim_player.animation_finished.is_connected(_on_animation_finished):
agent.anim_player.animation_finished.disconnect(_on_animation_finished)
func _on_animation_finished(anim_name: StringName) -> void:
if animation_name == anim_name:
if not reverse:
if min_wait_time > 0:
var wait_time := randf_range(min_wait_time, max_wait_time)
runtime_timer.start(wait_time)
else:
_on_timer_timeout()
else:
transitioned.emit(self, get_next_state())
func _on_timer_timeout() -> void:
reverse = true
if agent.anim_player and agent.anim_player.has_animation(animation_name):
agent.anim_player.play_backwards(animation_name, blend_time)
else:
transitioned.emit(self, get_next_state())

View File

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

View File

@@ -392,7 +392,14 @@ func train_move(delta: float) -> void:
#Calculate train distance for steam stats
func _track_steam_distance(distance_units: float) -> void:
if distance_units <= 0.0 or not SteamManager.is_on_steam:
if distance_units <= 0.0:
return
# Always track the global distance in our save file (for UI and persistency)
GameState.save_data.total_distance_km += distance_units * STEAM_DISTANCE_KM_PER_UNIT
# Steam specific logic
if not SteamManager.is_on_steam:
return
_pending_steam_distance_km += distance_units * STEAM_DISTANCE_KM_PER_UNIT

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://d2s020wikunuo"
path="res://.godot/imported/barretta_main.png-d118ead98672de7a9802ba85eaf04053.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/game_menu/assets/page_1/barretta_main.png"
dest_files=["res://.godot/imported/barretta_main.png-d118ead98672de7a9802ba85eaf04053.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ct7o3u6i5rka6"
path="res://.godot/imported/barretta_second.png-7f0af7da51c3ebb821e017a3fe148c6e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/game_menu/assets/page_1/barretta_second.png"
dest_files=["res://.godot/imported/barretta_second.png-7f0af7da51c3ebb821e017a3fe148c6e.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -2,7 +2,7 @@
[ext_resource type="Script" uid="uid://c7q3d823b1v1h" path="res://core/game_menu/biome_picker.gd" id="1_jqji0"]
[ext_resource type="Texture2D" uid="uid://dc0sl04wem136" path="res://core/game_menu/assets/page_1/color_main_biome.png" id="2_8s4h5"]
[ext_resource type="Texture2D" uid="uid://dj6pt25w5i4jq" path="res://core/game_menu/assets/page_1/lucchetto.png" id="2_jqji0"]
[ext_resource type="Texture2D" uid="uid://bx6gsh5uchkge" path="res://core/game_menu/assets/lock.png" id="3_jqji0"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_jqji0"]
@@ -65,18 +65,19 @@ stretch_mode = 3
[node name="TextureRect" type="TextureRect" parent="Texture" unique_id=288045010]
unique_name_in_owner = true
layout_mode = 1
anchors_preset = -1
anchor_left = 0.36645964
anchor_top = 0.41690964
anchor_right = 0.6335404
anchor_bottom = 0.58309036
offset_left = 1.5
offset_top = 8.5
offset_right = -1.5
offset_bottom = -8.5
anchors_preset = 8
anchor_left = 0.5
anchor_top = 0.5
anchor_right = 0.5
anchor_bottom = 0.5
offset_left = -26.8755
offset_top = -34.375504
offset_right = 26.8755
offset_bottom = 34.375504
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
texture = ExtResource("2_jqji0")
texture = ExtResource("3_jqji0")
expand_mode = 1
[connection signal="pressed" from="." to="." method="_on_pressed"]

View File

@@ -25,9 +25,11 @@ grow_vertical = 2
unique_name_in_owner = true
layout_mode = 1
anchor_left = 0.3625
anchor_top = 0.14351852
anchor_top = 0.21481481
anchor_right = 0.6375
anchor_bottom = 0.8564815
anchor_bottom = 0.78518516
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
[node name="ColorRect" parent="Photo" index="0" unique_id=1208008621]
@@ -37,6 +39,12 @@ offset_top = 0.0
offset_right = 0.0
offset_bottom = 0.0
[node name="MarginContainer" parent="Photo/ColorRect" index="0" unique_id=1141643525]
theme_override_constants/margin_left = 20
theme_override_constants/margin_top = 30
theme_override_constants/margin_right = 20
theme_override_constants/margin_bottom = 185
[connection signal="gui_input" from="Panel" to="." method="_on_panel_gui_input"]
[editable path="Photo"]

View File

@@ -3,10 +3,11 @@
[ext_resource type="Script" uid="uid://dsey5dvc11vpq" path="res://core/game_menu/photo.gd" id="1_u0arp"]
[node name="Photo" type="Button" unique_id=1451980505]
custom_minimum_size = Vector2(132, 154)
custom_minimum_size = Vector2(132, 154.02)
anchors_preset = -1
anchor_right = 0.06875
anchor_bottom = 0.1425926
offset_bottom = 0.020004272
pivot_offset_ratio = Vector2(0.5, 0.5)
script = ExtResource("1_u0arp")
metadata/_edit_use_anchors_ = true
@@ -34,9 +35,9 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 14
theme_override_constants/margin_top = 15
theme_override_constants/margin_right = 14
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 50
[node name="PhotoTexture" type="TextureRect" parent="ColorRect/MarginContainer" unique_id=506844785]

View File

@@ -1,52 +1,57 @@
extends VBoxContainer
@onready var color_pickers: Array[TrainColorPicker] = [$%ColorPicker1, $%ColorPicker2, $%ColorPicker3, $%ColorPicker4, $%ColorPicker5, $%ColorPicker6]
@onready var left_arrow: ArrowButton = $%ArrowButtonLeft
@onready var right_arrow: ArrowButton = $%ArrowButtonRight
@onready var color_pickers_1: Array[TrainColorPicker] = [$%ColorPicker1, $%ColorPicker2, $%ColorPicker3, $%ColorPicker4, $%ColorPicker5, $%ColorPicker6]
@onready var color_pickers_2: Array[TrainColorPicker] = [$%ColorPicker7, $%ColorPicker8, $%ColorPicker9, $%ColorPicker10, $%ColorPicker11, $%ColorPicker12]
@onready var treno: Node3D = $TrainViewportContainer/SubViewport/Treno
var selected_color: Color
var selected_color_index: int = 0
func _ready() -> void:
for color_picker in color_pickers:
color_picker.pressed.connect(_on_color_selected.bind(color_picker))
for color_picker in color_pickers_1:
color_picker.pressed.connect(_on_color_selected.bind(color_picker, 0))
color_picker.deselect()
_set_selected_color(0)
var init_idx_1 = GameState.save_data.train_color_1_index
_set_selected_color(init_idx_1, 0)
left_arrow.pressed.connect(_select_prev_color)
right_arrow.pressed.connect(_select_next_color)
for color_picker in color_pickers_2:
color_picker.pressed.connect(_on_color_selected.bind(color_picker, 1))
color_picker.deselect()
var init_idx_2 = GameState.save_data.train_color_2_index
_set_selected_color(init_idx_2, 1)
func _process(delta: float) -> void:
if treno:
treno.rotation_degrees.y += 30.0 * delta
func _set_selected_color(index: int) -> void:
func _set_selected_color(index: int, material_index: int) -> void:
var color_pickers = color_pickers_1 if material_index == 0 else color_pickers_2
for i in range(color_pickers.size()):
if i == index:
color_pickers[i].select()
selected_color_index = i
selected_color = color_pickers[i].color
_apply_train_color(selected_color)
_apply_train_color(selected_color, material_index, index)
else:
color_pickers[i].deselect()
func _on_color_selected(selected_color_picker: TrainColorPicker) -> void:
func _on_color_selected(selected_color_picker: TrainColorPicker, material_index: int) -> void:
var color_pickers = color_pickers_1 if material_index == 0 else color_pickers_2
for i in range(color_pickers.size()):
if color_pickers[i] == selected_color_picker:
_set_selected_color(i)
_set_selected_color(i, material_index)
break
func _select_prev_color() -> void:
var next_index = (selected_color_index - 1 + color_pickers.size()) % color_pickers.size()
_set_selected_color(next_index)
func _select_next_color() -> void:
var next_index = (selected_color_index + 1) % color_pickers.size()
_set_selected_color(next_index)
func _apply_train_color(color: Color) -> void:
var mat: ShaderMaterial = load("res://tgcc/train/Color1_train.tres")
func _apply_train_color(color: Color, material_index: int, color_index: int = 0) -> void:
var path = "res://tgcc/train/Color%s_train.tres" % ("1" if material_index == 0 else "2")
var mat: ShaderMaterial = load(path)
if mat:
mat.set_shader_parameter("albedo_color", color)
if material_index == 0:
GameState.save_data.train_color_1 = color.to_html()
GameState.save_data.train_color_1_index = color_index
else:
GameState.save_data.train_color_2 = color.to_html()
GameState.save_data.train_color_2_index = color_index
GameState.save_game()

View File

@@ -2,8 +2,9 @@
[ext_resource type="Script" uid="uid://8k1msabobhks" path="res://core/game_menu/train_selector.gd" id="1_puip6"]
[ext_resource type="Texture2D" uid="uid://bjqp8kmb5y7px" path="res://core/game_menu/assets/page_1/chooseyourtrain_text.png" id="2_cfvtr"]
[ext_resource type="PackedScene" uid="uid://dm3skv22c60tm" path="res://core/game_menu/arrow_button.tscn" id="2_puip6"]
[ext_resource type="PackedScene" uid="uid://ch1st1oryjoio" path="res://core/game_menu/color_picker.tscn" id="3_i2rs1"]
[ext_resource type="Texture2D" uid="uid://d2s020wikunuo" path="res://core/game_menu/assets/page_1/barretta_main.png" id="4_ftlwq"]
[ext_resource type="Texture2D" uid="uid://ct7o3u6i5rka6" path="res://core/game_menu/assets/page_1/barretta_second.png" id="6_y1o8e"]
[ext_resource type="PackedScene" uid="uid://dxun0jk5t0n6" path="res://core/tween/container_tween.tscn" id="10_i2rs1"]
[ext_resource type="PackedScene" uid="uid://otptvwer4par" path="res://tgcc/train/train.tscn" id="11_train"]
@@ -31,7 +32,7 @@ stretch = true
own_world_3d = true
transparent_bg = true
handle_input_locally = false
size = Vector2i(660, 180)
size = Vector2i(625, 180)
render_target_update_mode = 4
[node name="Camera3D" type="Camera3D" parent="TrainViewportContainer/SubViewport" unique_id=1674220602]
@@ -43,59 +44,116 @@ transform = Transform3D(0.707107, -0.5, 0.5, 0, 0.707107, 0.707107, -0.707107, -
[node name="Treno" parent="TrainViewportContainer/SubViewport" unique_id=1674220603 instance=ExtResource("11_train")]
[node name="HBoxContainer2" type="HBoxContainer" parent="." unique_id=607833319]
[node name="TextureRect" type="TextureRect" parent="." unique_id=338929443]
layout_mode = 2
alignment = 1
mouse_filter = 2
texture = ExtResource("4_ftlwq")
[node name="ArrowButtonLeft" parent="HBoxContainer2" unique_id=103192648 instance=ExtResource("2_puip6")]
unique_name_in_owner = true
layout_mode = 2
flip_h = true
[node name="MarginContainer" type="MarginContainer" parent="TextureRect" unique_id=616392028]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
theme_override_constants/margin_left = 116
[node name="HBoxContainer" type="HBoxContainer" parent="HBoxContainer2" unique_id=1364417494]
[node name="HBoxContainer" type="HBoxContainer" parent="TextureRect/MarginContainer" unique_id=1364417494]
layout_mode = 2
theme_override_constants/separation = 0
alignment = 1
[node name="ColorPicker1" parent="HBoxContainer2/HBoxContainer" unique_id=59169767 instance=ExtResource("3_i2rs1")]
[node name="ColorPicker1" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=59169767 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.7432059, 0.5684909, 1, 1)
[node name="ColorPicker2" parent="HBoxContainer2/HBoxContainer" unique_id=584054476 instance=ExtResource("3_i2rs1")]
[node name="ColorPicker2" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=584054476 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.47657922, 0.8792635, 0.8823829, 1)
[node name="ColorPicker3" parent="HBoxContainer2/HBoxContainer" unique_id=889429149 instance=ExtResource("3_i2rs1")]
[node name="ColorPicker3" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=889429149 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.54004896, 0.5516501, 0.45533067, 1)
[node name="ColorPicker4" parent="HBoxContainer2/HBoxContainer" unique_id=466686411 instance=ExtResource("3_i2rs1")]
[node name="ColorPicker4" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=466686411 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.40863404, 1, 0.47657922, 1)
[node name="ColorPicker5" parent="HBoxContainer2/HBoxContainer" unique_id=675841518 instance=ExtResource("3_i2rs1")]
[node name="ColorPicker5" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=675841518 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(1, 0, 0, 1)
[node name="ColorPicker6" parent="HBoxContainer2/HBoxContainer" unique_id=1698412911 instance=ExtResource("3_i2rs1")]
[node name="ColorPicker6" parent="TextureRect/MarginContainer/HBoxContainer" unique_id=1698412911 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
[node name="ArrowButtonRight" parent="HBoxContainer2" unique_id=68298624 instance=ExtResource("2_puip6")]
[node name="TextureRect2" type="TextureRect" parent="." unique_id=1180760395]
layout_mode = 2
mouse_filter = 2
texture = ExtResource("6_y1o8e")
[node name="MarginContainer" type="MarginContainer" parent="TextureRect2" unique_id=651764288]
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
mouse_filter = 2
theme_override_constants/margin_left = 116
[node name="HBoxContainer2" type="HBoxContainer" parent="TextureRect2/MarginContainer" unique_id=2122540668]
layout_mode = 2
theme_override_constants/separation = 0
alignment = 1
[node name="ColorPicker7" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=1664685328 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.7432059, 0.5684909, 1, 1)
[node name="ColorPicker8" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=396324135 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.47657922, 0.8792635, 0.8823829, 1)
[node name="ColorPicker9" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=1233950004 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.54004896, 0.5516501, 0.45533067, 1)
[node name="ColorPicker10" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=2132596175 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(0.40863404, 1, 0.47657922, 1)
[node name="ColorPicker11" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=831493295 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
color = Color(1, 0, 0, 1)
[node name="ColorPicker12" parent="TextureRect2/MarginContainer/HBoxContainer2" unique_id=170636843 instance=ExtResource("3_i2rs1")]
unique_name_in_owner = true
layout_mode = 2
size_flags_vertical = 4
[node name="ContainerTween" parent="." unique_id=160227524 node_paths=PackedStringArray("targets") instance=ExtResource("10_i2rs1")]
unique_name_in_owner = true
targets = [NodePath("../HBoxContainer2/ArrowButtonLeft"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker1"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker2"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker3"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker4"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker5"), NodePath("../HBoxContainer2/HBoxContainer/ColorPicker6"), NodePath("../HBoxContainer2/ArrowButtonRight")]
targets = [NodePath(""), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker1"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker2"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker3"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker4"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker5"), NodePath("../TextureRect/MarginContainer/HBoxContainer/ColorPicker6"), NodePath("")]

View File

@@ -29,6 +29,11 @@ var is_loaded: bool = false
func _ready() -> void:
load_game()
apply_video_settings()
apply_train_colors()
func _process(delta: float) -> void:
if not get_tree().paused and is_loaded:
save_data.total_time_played_seconds += delta
func apply_video_settings() -> void:
get_viewport().use_taa = save_data.anti_aliasing
@@ -36,6 +41,16 @@ func apply_video_settings() -> void:
get_viewport().msaa_3d = msaa_mode
get_viewport().msaa_2d = msaa_mode
func apply_train_colors() -> void:
if not save_data.train_color_1.is_empty():
var mat1: ShaderMaterial = load("res://tgcc/train/Color1_train.tres")
if mat1:
mat1.set_shader_parameter("albedo_color", Color(save_data.train_color_1))
if not save_data.train_color_2.is_empty():
var mat2: ShaderMaterial = load("res://tgcc/train/Color2_train.tres")
if mat2:
mat2.set_shader_parameter("albedo_color", Color(save_data.train_color_2))
match save_data.window_mode_index:
0:
DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_EXCLUSIVE_FULLSCREEN)

View File

@@ -9,6 +9,13 @@ var anti_aliasing: bool = true
var window_mode_index: int = 0
var resolution_x: int = 1920
var resolution_y: int = 1080
var train_color_1: String = ""
var train_color_2: String = ""
var train_color_1_index: int = 0
var train_color_2_index: int = 0
var total_distance_km: float = 0.0
var total_time_played_seconds: float = 0.0
func to_dictionary() -> Dictionary:
var serialized_collectible_ids: Array[String] = []
@@ -23,6 +30,12 @@ func to_dictionary() -> Dictionary:
"window_mode_index": window_mode_index,
"resolution_x": resolution_x,
"resolution_y": resolution_y,
"train_color_1": train_color_1,
"train_color_2": train_color_2,
"train_color_1_index": train_color_1_index,
"train_color_2_index": train_color_2_index,
"total_distance_km": total_distance_km,
"total_time_played_seconds": total_time_played_seconds,
}
static func from_dictionary(data: Dictionary) -> SaveGameData:
@@ -52,4 +65,22 @@ static func from_dictionary(data: Dictionary) -> SaveGameData:
if data.has("resolution_y"):
save_game_data.resolution_y = int(data["resolution_y"])
if data.has("train_color_1"):
save_game_data.train_color_1 = str(data["train_color_1"])
if data.has("train_color_2"):
save_game_data.train_color_2 = str(data["train_color_2"])
if data.has("train_color_1_index"):
save_game_data.train_color_1_index = int(data["train_color_1_index"])
if data.has("train_color_2_index"):
save_game_data.train_color_2_index = int(data["train_color_2_index"])
if data.has("total_distance_km"):
save_game_data.total_distance_km = float(data["total_distance_km"])
if data.has("total_time_played_seconds"):
save_game_data.total_time_played_seconds = float(data["total_time_played_seconds"])
return save_game_data

Binary file not shown.

After

Width:  |  Height:  |  Size: 774 KiB

View File

@@ -0,0 +1,40 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://c31yut8p24t8g"
path="res://.godot/imported/button_customize.png-2b9ab16ca23c28488847c768be1934d0.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://core/main_scene_ui/assets/button_customize.png"
dest_files=["res://.godot/imported/button_customize.png-2b9ab16ca23c28488847c768be1934d0.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

View File

@@ -4,7 +4,10 @@ extends Control
@onready var game_menu: Control = $%GameMenu
@onready var game_menu_panel: Control = $%GameMenuPanel
@onready var menu_icon_button: Button = $%MenuIconButton
@onready var hide_ui_button: Button = $%HideUIButton
@onready var customize_train_button: Button = $%CustomizeTrainButton
@onready var photo_icon_button: Button = $%PhotoIconButton
@onready var choo_choo_button: Button = $%ChooChooButton
@onready var collectible_icon_button: Button = $%CollectibleIconButton
@onready var resume_button: Button = $GameMenuPanel/GameMenu/Pages/Page3/OptionMenu/VBoxContainer/ResumeButton
@onready var weather_row: HBoxContainer = $%WeatherRow
@@ -13,6 +16,8 @@ extends Control
@onready var photo_mode_texture_mask: TextureRect = $%PhotoModeTextureMask
@onready var photo_mode_black_screen: ColorRect = $%PhotoModeBlackScreen
@onready var audio_player: Control = $%AudioPlayer
@onready var time_label: Label = $%TimeLabel
@onready var dist_label: Label = $%DistLabel
var _cycle = false
var _rain = false
@@ -24,29 +29,47 @@ var _photo_mode_alpha_tween: Tween
var _photo_mode_fold_tween: Tween
func _ready() -> void:
set_process_input(false)
GameState.on_enable_photo_mode_request.connect(_on_enable_photo_mode)
GameState.on_disable_photo_mode_request.connect(_on_disable_photo_mode)
GameState.on_photo_taken_started.connect(_on_photo_taken_started)
GameState.on_photo_taken_finished.connect(_on_photo_taken_finished)
GameState.on_photo_taken_prepare.connect(_on_photo_capture_prepare)
menu_icon_button.pressed.connect(_on_menu_icon_button_pressed)
hide_ui_button.pressed.connect(_on_hide_ui_button_pressed)
customize_train_button.pressed.connect(_open_game_menu_on_page.bind(0))
collectible_icon_button.pressed.connect(_open_game_menu_on_page.bind(1))
menu_icon_button.pressed.connect(_open_game_menu_on_page.bind(2))
photo_icon_button.pressed.connect(_on_photo_icon_button_pressed)
collectible_icon_button.pressed.connect(_on_collectible_icon_button_pressed)
choo_choo_button.pressed.connect(_on_choo_choo_button_pressed)
resume_button.pressed.connect(_on_resume_button_pressed)
func _on_menu_icon_button_pressed() -> void:
GameState.pause_game()
game_menu_panel.show()
game_menu.scale = Vector2(1, 1)
game_menu.open()
TweenFX.fold_in(game_menu)
func _process(delta: float) -> void:
if time_label and dist_label and GameState.is_loaded:
var time = GameState.save_data.total_time_played_seconds
var hours = int(time) / 3600
var minutes = (int(time) % 3600) / 60
var seconds = int(time) % 60
time_label.text = "Travel Time: %02d:%02d:%02d" % [hours, minutes, seconds]
dist_label.text = "Distance Traveled: %d km" % int(GameState.save_data.total_distance_km)
func _on_hide_ui_button_pressed() -> void:
hide_ui()
Input.set_mouse_mode(Input.MOUSE_MODE_HIDDEN)
await get_tree().create_timer(0.3).timeout
set_process_input(true)
func _input(event: InputEvent) -> void:
if event is InputEventMouseMotion:
set_process_input(false)
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
show_ui()
func _on_photo_icon_button_pressed() -> void:
GameState.on_enable_photo_mode_request.emit()
func _on_collectible_icon_button_pressed() -> void:
func _open_game_menu_on_page(tab_index: int) -> void:
GameState.pause_game()
game_menu.on_tab_pressed(1, true)
game_menu.on_tab_pressed(tab_index, true)
game_menu_panel.show()
game_menu.scale = Vector2(1, 1)
TweenFX.fold_in(game_menu)
@@ -101,7 +124,7 @@ func pick_random_weather() -> void:
weather_row.on_icon_pressed_changed(random_button)
func _on_enable_photo_mode() -> void:
hide_ui_for_photo_mode()
hide_ui()
photo_mode_texture_mask.scale = Vector2(1,1)
photo_mode_texture_mask.modulate.a = 0.0
photo_mode_texture_panel.show()
@@ -124,7 +147,7 @@ func _on_enable_photo_mode() -> void:
_photo_mode_fold_tween = TweenFX.fold_in(photo_mode_texture_mask)
func _on_disable_photo_mode() -> void:
show_ui_for_photo_mode()
show_ui()
var mat = photo_mode_texture_panel.material as ShaderMaterial
if mat:
if _photo_mode_mat_tween:
@@ -167,24 +190,31 @@ func _on_photo_taken_finished() -> void:
photo_mode_black_screen.hide()
GameState.on_photo_mode_black_screen_disappeared.emit()
func hide_ui_for_photo_mode() -> void:
TweenFX.fade_out(weather_row, 0.25)
TweenFX.fade_out(time_of_day_row, 0.25)
TweenFX.fade_out(menu_icon_button, 0.25)
TweenFX.fade_out(photo_icon_button, 0.25)
TweenFX.fade_out(collectible_icon_button, 0.25)
TweenFX.fade_out(audio_player, 0.25)
func _on_choo_choo_button_pressed() -> void:
#play sfx
pass
func show_ui_for_photo_mode() -> void:
weather_row.show()
time_of_day_row.show()
menu_icon_button.show()
photo_icon_button.show()
collectible_icon_button.show()
audio_player.show()
TweenFX.fade_in(weather_row, 0.25)
TweenFX.fade_in(time_of_day_row, 0.25)
TweenFX.fade_in(menu_icon_button, 0.25)
TweenFX.fade_in(photo_icon_button, 0.25)
TweenFX.fade_in(collectible_icon_button, 0.25)
TweenFX.fade_in(audio_player, 0.25)
func _set_buttons_mouse_filter(ignore: bool) -> void:
var filter = Control.MOUSE_FILTER_IGNORE if ignore else Control.MOUSE_FILTER_STOP
var buttons = [hide_ui_button, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, choo_choo_button]
if weather_row and "options_icon_buttons" in weather_row:
buttons.append_array(weather_row.options_icon_buttons)
if time_of_day_row and "options_icon_buttons" in time_of_day_row:
buttons.append_array(time_of_day_row.options_icon_buttons)
for btn in buttons:
if btn is Control:
btn.mouse_filter = filter
func hide_ui() -> void:
_set_buttons_mouse_filter(true)
var hud_elements = [hide_ui_button, weather_row, time_of_day_row, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, audio_player, choo_choo_button, time_label, dist_label]
for element in hud_elements:
TweenFX.fade_out(element, 0.25)
func show_ui() -> void:
_set_buttons_mouse_filter(false)
var hud_elements = [hide_ui_button, weather_row, time_of_day_row, customize_train_button, collectible_icon_button, menu_icon_button, photo_icon_button, audio_player, choo_choo_button, time_label, dist_label]
for element in hud_elements:
element.show()
TweenFX.fade_in(element, 0.25)

View File

@@ -26,7 +26,9 @@
[ext_resource type="Texture2D" uid="uid://cq65xyg4wsctm" path="res://core/main_scene_ui/assets/button_weather_nowind.png" id="12_fjfwt"]
[ext_resource type="Texture2D" uid="uid://tex06svipyg4" path="res://core/main_scene_ui/assets/button_random.png" id="14_gcgq4"]
[ext_resource type="Texture2D" uid="uid://1n3paucfsovj" path="res://core/main_scene_ui/assets/button_photomode.png" id="15_th1nj"]
[ext_resource type="Texture2D" uid="uid://c31yut8p24t8g" path="res://core/main_scene_ui/assets/button_customize.png" id="19_vywaj"]
[ext_resource type="Texture2D" uid="uid://b03si5ir3ypp7" path="res://core/main_scene_ui/assets/button_collection03.png" id="19_yggu7"]
[ext_resource type="FontFile" uid="uid://bclja5no1qteh" path="res://core/font/Kestila.ttf" id="29_jn6vt"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_hole"]
shader = ExtResource("10_shader")
@@ -48,8 +50,10 @@ layout_mode = 1
anchors_preset = 2
anchor_top = 1.0
anchor_bottom = 1.0
offset_top = -164.0
offset_right = 80.0
offset_left = 20.0
offset_top = -184.0
offset_right = 100.0
offset_bottom = -20.0
grow_vertical = 0
[node name="TimeOfDayRow" parent="Rows" unique_id=1734127019 instance=ExtResource("2_4cc8f")]
@@ -132,40 +136,80 @@ data = "Random"
image = ExtResource("14_gcgq4")
apply_texture_on_selection = false
[node name="MenuIconButton" parent="." unique_id=707872474 instance=ExtResource("3_t1xop")]
unique_name_in_owner = true
[node name="TopButtons" type="VBoxContainer" parent="." unique_id=1644086668]
layout_mode = 1
anchors_preset = 1
anchor_left = 1.0
anchor_right = 1.0
anchor_bottom = 0.0
offset_left = -80.0
offset_bottom = 80.0
offset_left = -100.0
offset_top = 20.0
offset_right = -20.0
offset_bottom = 100.0
grow_horizontal = 0
theme_override_constants/separation = 8
[node name="MenuIconButton" parent="TopButtons" unique_id=707872474 instance=ExtResource("3_t1xop")]
unique_name_in_owner = true
layout_mode = 2
image = ExtResource("10_6016m")
[node name="CollectionOptions" type="VBoxContainer" parent="." unique_id=542153805]
[node name="HideUIButton" parent="TopButtons" unique_id=1621140689 instance=ExtResource("3_t1xop")]
unique_name_in_owner = true
layout_mode = 2
image = ExtResource("10_6016m")
[node name="MiddleButtons" type="VBoxContainer" parent="." unique_id=542153805]
layout_mode = 1
anchors_preset = 6
anchor_left = 1.0
anchor_top = 0.5
anchor_right = 1.0
anchor_bottom = 0.5
offset_left = -40.0
offset_top = -20.0
offset_bottom = 20.0
offset_left = -100.0
offset_top = -124.0
offset_right = -20.0
offset_bottom = 124.0
grow_horizontal = 0
grow_vertical = 2
theme_override_constants/separation = 8
[node name="PhotoIconButton" parent="CollectionOptions" unique_id=1863476241 instance=ExtResource("3_t1xop")]
[node name="CustomizeTrainButton" parent="MiddleButtons" unique_id=27430111 instance=ExtResource("3_t1xop")]
unique_name_in_owner = true
layout_mode = 2
image = ExtResource("19_vywaj")
[node name="CollectibleIconButton" parent="MiddleButtons" unique_id=520235552 instance=ExtResource("3_t1xop")]
unique_name_in_owner = true
layout_mode = 2
image = ExtResource("19_yggu7")
[node name="PhotoIconButton" parent="MiddleButtons" unique_id=1863476241 instance=ExtResource("3_t1xop")]
unique_name_in_owner = true
layout_mode = 2
image = ExtResource("15_th1nj")
[node name="CollectibleIconButton" parent="CollectionOptions" unique_id=520235552 instance=ExtResource("3_t1xop")]
[node name="ChooChooButton" parent="MiddleButtons" unique_id=774819903 instance=ExtResource("3_t1xop")]
unique_name_in_owner = true
layout_mode = 2
image = ExtResource("19_yggu7")
image = ExtResource("15_th1nj")
[node name="InfoLabels" type="VBoxContainer" parent="." unique_id=234435566]
custom_minimum_size = Vector2(400, 0)
layout_mode = 1
offset_left = 20.0
offset_top = 20.0
offset_right = 420.0
offset_bottom = 220.0
[node name="TimeLabel" type="Label" parent="InfoLabels" unique_id=18932607]
unique_name_in_owner = true
layout_mode = 2
theme_override_fonts/font = ExtResource("29_jn6vt")
[node name="DistLabel" type="Label" parent="InfoLabels" unique_id=1743894966]
unique_name_in_owner = true
layout_mode = 2
theme_override_fonts/font = ExtResource("29_jn6vt")
[node name="AudioPlayer" parent="." unique_id=425192018 node_paths=PackedStringArray("radio") instance=ExtResource("7_lapqe")]
unique_name_in_owner = true
@@ -174,10 +218,10 @@ anchor_left = 1.0
anchor_top = 0.99814814
anchor_right = 1.0
anchor_bottom = 0.99814814
offset_left = -146.0
offset_top = -57.0
offset_right = -146.0
offset_bottom = -57.0
offset_left = -166.0
offset_top = -74.0
offset_right = -166.0
offset_bottom = -74.0
grow_horizontal = 0
grow_vertical = 0
radio = NodePath("../Radio")
@@ -222,18 +266,6 @@ texture = ExtResource("9_4cc8f")
stretch_mode = 3
metadata/_edit_use_anchors_ = true
[node name="PhotoModeBlackScreen" type="ColorRect" parent="." unique_id=1928591477]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
pivot_offset_ratio = Vector2(0.5, 0.5)
color = Color(0, 0, 0, 1)
[node name="PhotoTaken" parent="." unique_id=683693112 instance=ExtResource("8_t1xop")]
visible = false
layout_mode = 1
@@ -246,6 +278,18 @@ offset_bottom = 0.0
grow_horizontal = 2
grow_vertical = 2
[node name="PhotoModeBlackScreen" type="ColorRect" parent="." unique_id=1928591477]
unique_name_in_owner = true
visible = false
layout_mode = 1
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
pivot_offset_ratio = Vector2(0.5, 0.5)
color = Color(0, 0, 0, 1)
[node name="Radio" parent="." unique_id=1234112225 instance=ExtResource("5_nevjt")]
playlist = Array[AudioStream]([ExtResource("6_kd244")])

View File

@@ -5,12 +5,13 @@ extends Control
var initial_pos_saved := false
var initial_pos: Vector2
var appear_tween: Tween
var move_tween: Tween
var is_photo_mode_enable = false
var current_execution: int = 0
func _ready() -> void:
CollectionManager.on_photo_saved.connect(_set_photo_taken)
CollectionManager.on_photo_preview_ready.connect(_set_photo_preview)
GameState.on_enable_photo_mode_request.connect(_on_enable_photo_mode)
GameState.on_disable_photo_mode_request.connect(_on_disable_photo_mode)
GameState.on_photo_taken_finished.connect(_show_photo_taken)
@@ -19,8 +20,7 @@ func _ready() -> void:
func _hide_photo_taken() -> void:
hide()
func _set_photo_taken(file_path) -> void:
var image = Image.load_from_file(file_path)
func _set_photo_preview(image: Image) -> void:
if image:
var texture = ImageTexture.create_from_image(image)
photo_texture.texture = texture
@@ -41,12 +41,17 @@ func _show_photo_taken() -> void:
rotation_degrees = 0.0
show()
var explode_tween_duration = 5.5
var appear_duration = 0.8
var float_duration = 1.5
var move_tween_duration = 1.0
var shrink_duration = 1
var scale_amt = 3.0
var explode_tween = TweenFX.explode(self, explode_tween_duration, 3)
appear_tween = create_tween()
appear_tween.tween_property(self, "scale", Vector2.ONE * scale_amt, appear_duration).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_OUT)
appear_tween.parallel().tween_property(self, "rotation_degrees", randf_range(-10, 10), appear_duration * 0.8)
await get_tree().create_timer(explode_tween_duration / 2).timeout
await get_tree().create_timer(appear_duration + float_duration).timeout
if my_execution != current_execution:
return
@@ -61,10 +66,14 @@ func _show_photo_taken() -> void:
move_tween = create_tween()
var target_pos = collectible_button.global_position
move_tween.tween_property(self, "global_position:x", target_pos.x, move_tween_duration).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
move_tween.parallel().tween_property(self, "global_position:y", target_pos.y, move_tween_duration).set_trans(Tween.TRANS_BACK).set_ease(Tween.EASE_IN)
await explode_tween.finished
move_tween.parallel().tween_property(self, "scale", Vector2.ONE * 0.1, shrink_duration).set_trans(Tween.TRANS_CUBIC).set_ease(Tween.EASE_IN_OUT)
move_tween.parallel().tween_property(self, "modulate:a", 0.0, shrink_duration).set_trans(Tween.TRANS_LINEAR)
await move_tween.finished
if my_execution != current_execution:
return
@@ -90,6 +99,8 @@ func _on_disable_photo_mode() -> void:
func reset() -> void:
TweenFX.stop_all(self)
if appear_tween:
appear_tween.kill()
if move_tween:
move_tween.kill()
hide()

View File

@@ -34,9 +34,9 @@ anchor_right = 1.0
anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
theme_override_constants/margin_left = 14
theme_override_constants/margin_top = 15
theme_override_constants/margin_right = 14
theme_override_constants/margin_left = 10
theme_override_constants/margin_top = 10
theme_override_constants/margin_right = 10
theme_override_constants/margin_bottom = 50
[node name="PhotoTexture" type="TextureRect" parent="ColorRect/MarginContainer" unique_id=1754898569]

View File

@@ -2,6 +2,7 @@ extends Node
signal on_collectible_unlocked(collectible_id: StringName)
signal on_photo_saved(filePath: String)
signal on_photo_preview_ready(image: Image)
@export var collectibles_library: CollectibleLibrary
@@ -35,14 +36,18 @@ func save_photo_to_disk_async(image: Image) -> void:
if not image:
return
if not DirAccess.dir_exists_absolute("user://photos"):
DirAccess.make_dir_absolute("user://photos")
var timestamp = str(Time.get_unix_time_from_system())
var file_path = "user://photos/photo_" + timestamp + ".png"
image.save_png(file_path)
WorkerThreadPool.add_task(func():
image.save_png(file_path)
call_deferred("_on_photo_saved_callback", file_path)
)
func _on_photo_saved_callback(file_path: String) -> void:
saved_photos.append(file_path)
sync_save_data()
on_photo_saved.emit(file_path)

View File

@@ -121,6 +121,7 @@ func take_photo_async() -> void:
var targets = get_tree().get_nodes_in_group("collectible")
var space_state = get_world_3d().direct_space_state
CollectionManager.on_photo_preview_ready.emit(captured_image)
CollectionManager.save_photo_to_disk_async(captured_image)
for target in targets:
@@ -138,6 +139,10 @@ func take_photo_async() -> void:
CollectionManager.unlock_collectible(target.collectible_data.id)
GameState.save_game()
var shutter_stay_duration = 0.15
await get_tree().create_timer(shutter_stay_duration).timeout
GameState.on_photo_taken_finished.emit()
func _on_photo_mode_black_screen_disappeared() -> void:

View File

@@ -105,8 +105,8 @@ geometry_source_geometry_mode = 2
geometry_source_group_name = &"FieldNav"
[sub_resource type="NavigationMesh" id="NavigationMesh_uf36e"]
vertices = PackedVector3Array(0.9999995, 0.45649529, -1.499999, 0.9999995, 0.45649529, -9.499999, -1.0000005, 0.45649529, -9.499999, 1.2499995, 0.45649529, 1.000001, 9.5, 0.45649529, 1.000001, 9.5, 0.45649529, -1.249999, -1.0000005, 0.45649529, 9.500001, 1.2499995, 0.45649529, 9.500001)
polygons = [PackedInt32Array(2, 1, 0), PackedInt32Array(4, 3, 5), PackedInt32Array(5, 3, 0), PackedInt32Array(7, 6, 3), PackedInt32Array(3, 6, 0), PackedInt32Array(0, 6, 2)]
vertices = PackedVector3Array(1.295435, 0.45649529, 0.98768234, 9.545435, 0.45649529, 0.98768234, 9.545435, 0.45649529, -1.0123177, 1.295435, 0.45649529, -1.0123177, 1.045435, 0.45649529, -9.512318, -1.454565, 0.45649529, -9.262318, -1.204565, 0.45649529, 9.487682, 1.045435, 0.45649529, 9.487682)
polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1), PackedInt32Array(7, 6, 0), PackedInt32Array(0, 6, 3), PackedInt32Array(3, 6, 5), PackedInt32Array(3, 5, 4)]
geometry_source_geometry_mode = 2
geometry_source_group_name = &"RoadNav"
@@ -148,7 +148,7 @@ surface_material_override/1 = ExtResource("6_7dsci")
surface_material_override/0 = ExtResource("6_7dsci")
surface_material_override/1 = ExtResource("5_v716w")
[node name="MSH_Staccioanta_1_007" parent="." index="8" unique_id=914751003]
[node name="MSH_Staccioanta_1_007" parent="." index="8" unique_id=914751003 groups=["RoadNav"]]
surface_material_override/0 = ExtResource("7_2mkp7")
[node name="PaliLuci_003" parent="." index="9" unique_id=860093688 groups=["weather_node"]]
@@ -420,3 +420,6 @@ allowed_type = 2
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 9.302983, 0.08556163, -0.19890785)
script = ExtResource("40_uf36e")
allowed_type = 4
[node name="Camera3D" type="Camera3D" parent="." index="46" unique_id=279832393]
transform = Transform3D(0.9723699, -0.22059396, 0.07638751, 0, 0.3272179, 0.9449489, -0.23344538, -0.9188399, 0.31817684, 1.081, 13.657, 5.307)

View File

@@ -188,8 +188,8 @@ geometry_source_geometry_mode = 2
geometry_source_group_name = &"FieldNav"
[sub_resource type="NavigationMesh" id="NavigationMesh_k3vly"]
vertices = PackedVector3Array(-1.8700409, 0.45649529, 2.500001, -1.8700409, 0.45649529, 5.500001, -1.1200409, 0.45649529, 5.750001, -1.1200409, 0.45649529, 2.250001, 0.8799591, 0.45649529, 9.500001, -1.1200409, 0.45649529, 9.500001, 0.8799591, 0.45649529, -9.499999, -1.1200409, 0.45649529, -9.499999, -2.370041, 0.45649529, 2.250001, -2.370041, 0.45649529, 5.750001, -8.870041, 0.45649529, -0.74999905, -8.870041, 0.45649529, 9.250001, -2.370041, 0.45649529, -0.74999905, -2.370041, 0.45649529, 9.250001)
polygons = [PackedInt32Array(0, 2, 1), PackedInt32Array(0, 3, 2), PackedInt32Array(2, 3, 4), PackedInt32Array(4, 5, 2), PackedInt32Array(7, 6, 3), PackedInt32Array(3, 6, 4), PackedInt32Array(1, 9, 0), PackedInt32Array(0, 9, 8), PackedInt32Array(8, 9, 10), PackedInt32Array(10, 9, 11), PackedInt32Array(10, 12, 8), PackedInt32Array(9, 13, 11)]
vertices = PackedVector3Array(1.1351337, 0.45649529, -9.499999, -0.86486626, 0.45649529, -9.499999, -1.1148663, 0.45649529, -8.999999, -0.86486626, 0.45649529, 2.250001, 1.1351337, 0.45649529, 9.500001, -2.1148663, 0.45649529, 2.500001, -2.1148663, 0.45649529, 5.250001, -0.86486626, 0.45649529, 5.500001, -0.86486626, 0.45649529, 9.500001, -2.3648663, 0.45649529, -0.74999905, -9.114866, 0.45649529, -0.74999905, -9.114866, 0.45649529, 9.000001, -2.3648663, 0.45649529, 9.000001)
polygons = [PackedInt32Array(1, 0, 2), PackedInt32Array(2, 0, 3), PackedInt32Array(3, 0, 4), PackedInt32Array(5, 3, 6), PackedInt32Array(6, 3, 7), PackedInt32Array(4, 7, 3), PackedInt32Array(4, 8, 7), PackedInt32Array(5, 6, 9), PackedInt32Array(9, 6, 12), PackedInt32Array(9, 12, 11), PackedInt32Array(9, 11, 10)]
geometry_source_geometry_mode = 2
geometry_source_group_name = &"RoadNav"
@@ -233,7 +233,7 @@ surface_material_override/0 = ExtResource("3_30u2s")
surface_material_override/0 = ExtResource("7_28cea")
surface_material_override/1 = ExtResource("8_hbf40")
[node name="MSH_Staccioanta_1_003" parent="." index="9" unique_id=1980961732]
[node name="MSH_Staccioanta_1_003" parent="." index="9" unique_id=1980961732 groups=["RoadNav"]]
surface_material_override/0 = ExtResource("9_mkvmp")
[node name="Rocks_001" parent="." index="10" unique_id=375547626 groups=["weather_node"]]

View File

@@ -8,6 +8,7 @@
render_priority = 0
shader = ExtResource("3_xsxbg")
shader_parameter/snow_edge_softness = 0.15
shader_parameter/snow_noise_scale = 0.15
shader_parameter/snow_color_variation = 0.05
shader_parameter/ripple_scale = 1.5
shader_parameter/ripple_speed = 2.0
@@ -24,6 +25,7 @@ shader_parameter/puddle_threshold = 0.45
render_priority = 0
shader = ExtResource("3_xsxbg")
shader_parameter/snow_edge_softness = 0.15
shader_parameter/snow_noise_scale = 0.15
shader_parameter/snow_color_variation = 0.05
shader_parameter/ripple_scale = 1.5
shader_parameter/ripple_speed = 2.0
@@ -40,6 +42,7 @@ shader_parameter/puddle_threshold = 0.45
render_priority = 0
shader = ExtResource("3_xsxbg")
shader_parameter/snow_edge_softness = 0.15
shader_parameter/snow_noise_scale = 0.15
shader_parameter/snow_color_variation = 0.05
shader_parameter/ripple_scale = 1.5
shader_parameter/ripple_speed = 2.0
@@ -96,6 +99,7 @@ shadow_mesh = SubResource("ArrayMesh_d4r25")
render_priority = 0
shader = ExtResource("3_xsxbg")
shader_parameter/snow_edge_softness = 0.15
shader_parameter/snow_noise_scale = 0.15
shader_parameter/snow_color_variation = 0.05
shader_parameter/ripple_scale = 1.5
shader_parameter/ripple_speed = 2.0
@@ -108,6 +112,9 @@ shader_parameter/rain_normal_strength = 0.4
shader_parameter/puddle_noise_scale = 0.08
shader_parameter/puddle_threshold = 0.45
[sub_resource type="BoxShape3D" id="BoxShape3D_8kteh"]
size = Vector3(3.4276123, 0.5996094, 0.0715332)
[node name="MSH_Staccionate" unique_id=118332436 instance=ExtResource("1_j7em5")]
transform = Transform3D(2, 0, 0, 0, 2, 0, 0, 0, 2, 0, 0, 0)
@@ -131,3 +138,7 @@ mesh = SubResource("ArrayMesh_h5j06")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.0379614, 0, 0)
material_override = ExtResource("2_2tbpd")
material_overlay = SubResource("ShaderMaterial_p4545")
[node name="CollisionShape3D" type="CollisionShape3D" parent="." index="5" unique_id=752765599]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.18890381, 0.29392046, 0.0010986328)
shape = SubResource("BoxShape3D_8kteh")

View File

@@ -267,6 +267,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -91.191925, 0, 539.03174)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -312.19193, 0, 349.03174)
[node name="Control" type="Control" parent="." unique_id=630650980]
visible = false
layout_mode = 3
anchors_preset = 0
offset_right = 40.0