Merge branch 'devcom-salvaging' into state_mangement

This commit is contained in:
betalars 2023-06-25 23:54:07 +02:00
commit 31a8c224fd
20 changed files with 846 additions and 121 deletions

Binary file not shown.

Binary file not shown.

View File

@ -28,7 +28,7 @@ func _process(delta):
func start(): func start():
$light_animation.play("light_up") $light_animation.play("light_up")
$AudioPlayer.play("intro") $AudioPlayer.play("intro")
State.assign_focus_to($PlayerController) State.pass_focus_to($PlayerController)
current_mode = Modes.WALKING current_mode = Modes.WALKING
func _update_scene(new_mode) -> int: func _update_scene(new_mode) -> int:
@ -37,7 +37,6 @@ func _update_scene(new_mode) -> int:
elif new_mode == Modes.FREEZE: elif new_mode == Modes.FREEZE:
emit_signal("freeze") emit_signal("freeze")
return new_mode return new_mode
func _unhandled_input(event): func _unhandled_input(event):

View File

@ -1,11 +1,13 @@
[gd_scene load_steps=48 format=3 uid="uid://b3b0gyvklqn50"] [gd_scene load_steps=53 format=3 uid="uid://b3b0gyvklqn50"]
[ext_resource type="Script" path="res://base-environments/youth_room/room_handle.gd" id="1_aitp0"] [ext_resource type="Script" path="res://base-environments/youth_room/room_handle.gd" id="1_aitp0"]
[ext_resource type="PackedScene" uid="uid://c0i4ydmxtxfho" path="res://base-environments/youth_room/import/youth_room.glb" id="1_jf3oi"] [ext_resource type="PackedScene" uid="uid://c0i4ydmxtxfho" path="res://base-environments/youth_room/import/youth_room.glb" id="1_jf3oi"]
[ext_resource type="AudioStream" uid="uid://1h6k2d8q1kw3" path="res://base-environments/youth_room/import/sounds/rain_on_window.mp3" id="2_3haaq"] [ext_resource type="AudioStream" uid="uid://1h6k2d8q1kw3" path="res://base-environments/youth_room/import/sounds/rain_on_window.mp3" id="2_3haaq"]
[ext_resource type="Texture2D" uid="uid://d0ucjqi8tx6vt" path="res://import/interface-elements/frame.png" id="2_21x33"]
[ext_resource type="Texture2D" uid="uid://cs6gtn285a4al" path="res://dev-util/logo_background.png" id="3_1mw2j"] [ext_resource type="Texture2D" uid="uid://cs6gtn285a4al" path="res://dev-util/logo_background.png" id="3_1mw2j"]
[ext_resource type="PackedScene" uid="uid://mkccbig41bqb" path="res://logic-scenes/player_controller/player_controller.tscn" id="3_foj4y"] [ext_resource type="PackedScene" uid="uid://mkccbig41bqb" path="res://logic-scenes/player_controller/player_controller.tscn" id="3_foj4y"]
[ext_resource type="AudioStream" uid="uid://bbpo1hu35yer8" path="res://base-environments/youth_room/import/sounds/thunder.mp3" id="3_wcypa"] [ext_resource type="AudioStream" uid="uid://bbpo1hu35yer8" path="res://base-environments/youth_room/import/sounds/thunder.mp3" id="3_wcypa"]
[ext_resource type="Texture2D" uid="uid://bwicl5q0lw06q" path="res://import/interface-elements/bottom.png" id="3_xqd4w"]
[ext_resource type="AudioStream" uid="uid://cudna8k7fw06t" path="res://base-environments/youth_room/audio/Moving Loop.wav" id="8_egnow"] [ext_resource type="AudioStream" uid="uid://cudna8k7fw06t" path="res://base-environments/youth_room/audio/Moving Loop.wav" id="8_egnow"]
[ext_resource type="AudioStream" uid="uid://bwh60165c3saj" path="res://base-environments/youth_room/audio/lisa_youth_voice.ogg" id="9_dqdgk"] [ext_resource type="AudioStream" uid="uid://bwh60165c3saj" path="res://base-environments/youth_room/audio/lisa_youth_voice.ogg" id="9_dqdgk"]
[ext_resource type="AudioStream" uid="uid://cl74a68tjwinh" path="res://base-environments/youth_room/audio/Youth Loop.wav" id="9_i8mqk"] [ext_resource type="AudioStream" uid="uid://cl74a68tjwinh" path="res://base-environments/youth_room/audio/Youth Loop.wav" id="9_i8mqk"]
@ -15,7 +17,8 @@
[ext_resource type="PackedScene" uid="uid://d3pb25xuef2t2" path="res://logic-scenes/collectable/collectable_ui.tscn" id="11_jxai0"] [ext_resource type="PackedScene" uid="uid://d3pb25xuef2t2" path="res://logic-scenes/collectable/collectable_ui.tscn" id="11_jxai0"]
[ext_resource type="PackedScene" uid="uid://bdnesuqroi7ss" path="res://vfx/collectable_particles.tscn" id="12_qxx2k"] [ext_resource type="PackedScene" uid="uid://bdnesuqroi7ss" path="res://vfx/collectable_particles.tscn" id="12_qxx2k"]
[ext_resource type="Texture2D" uid="uid://d005qvnbnishb" path="res://import/interface-elements/cursor_grab.png" id="13_lqj71"] [ext_resource type="Texture2D" uid="uid://d005qvnbnishb" path="res://import/interface-elements/cursor_grab.png" id="13_lqj71"]
[ext_resource type="Script" path="res://base-environments/youth_room/catch_all.gd" id="16_tddlc"] [ext_resource type="PackedScene" uid="uid://brk4hjdf2x81a" path="res://logic-scenes/card_picker/card_picker.tscn" id="19_a4n1o"]
[ext_resource type="ArrayMesh" uid="uid://bfc3d4g40n0wy" path="res://logic-scenes/collectable/import/old-mask.res" id="19_jr2bb"]
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_kcdrx"] [sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_kcdrx"]
sky_top_color = Color(0, 0, 1, 1) sky_top_color = Color(0, 0, 1, 1)
@ -64,10 +67,28 @@ adjustment_enabled = true
[sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_26mp0"] [sub_resource type="CameraAttributesPractical" id="CameraAttributesPractical_26mp0"]
auto_exposure_enabled = true auto_exposure_enabled = true
auto_exposure_scale = 0.2 auto_exposure_scale = 0.2
dof_blur_far_enabled = true
dof_blur_far_distance = 0.4
dof_blur_far_transition = 0.2
dof_blur_near_distance = 0.79 dof_blur_near_distance = 0.79
dof_blur_amount = 0.4 dof_blur_amount = 0.0
auto_exposure_min_sensitivity = 100.0 auto_exposure_min_sensitivity = 100.0
[sub_resource type="GDScript" id="GDScript_wb8kg"]
script/source = "extends WorldEnvironment
func _ready():
focus_env()
func focus_env():
var dof_strength_tween: Tween = create_tween()
dof_strength_tween.tween_property(camera_attributes, \"dof_blur_amount\", 0, 1)
func focus_object():
var dof_strength_tween: Tween = create_tween()
dof_strength_tween.tween_property(camera_attributes, \"dof_blur_amount\", 0.6, 1)
"
[sub_resource type="GDScript" id="GDScript_35dmj"] [sub_resource type="GDScript" id="GDScript_35dmj"]
script/source = "extends SpotLight3D script/source = "extends SpotLight3D
@ -94,6 +115,10 @@ func _process(delta):
func switch_on(): func switch_on():
var tween:Tween = create_tween() var tween:Tween = create_tween()
tween.tween_property(self, \"litnes\", 1, 10) tween.tween_property(self, \"litnes\", 1, 10)
func switch_off():
var tween:Tween = create_tween()
tween.tween_property(self, \"litnes\", 0, 1)
" "
[sub_resource type="GDScript" id="GDScript_xqa3d"] [sub_resource type="GDScript" id="GDScript_xqa3d"]
@ -136,7 +161,7 @@ tracks/0/keys = {
tracks/1/type = "method" tracks/1/type = "method"
tracks/1/imported = false tracks/1/imported = false
tracks/1/enabled = true tracks/1/enabled = true
tracks/1/path = NodePath("SpotLight3D") tracks/1/path = NodePath("desk_light")
tracks/1/interp = 1 tracks/1/interp = 1
tracks/1/loop_wrap = true tracks/1/loop_wrap = true
tracks/1/keys = { tracks/1/keys = {
@ -148,6 +173,36 @@ tracks/1/keys = {
}] }]
} }
[sub_resource type="Animation" id="Animation_wa80i"]
resource_name = "lights_out"
length = 2.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("OmniLight3D2:light_energy")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 2),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [1.0, 0.0]
}
tracks/1/type = "method"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("desk_light")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"switch_off"
}]
}
[sub_resource type="Animation" id="Animation_upogh"] [sub_resource type="Animation" id="Animation_upogh"]
resource_name = "menu" resource_name = "menu"
tracks/0/type = "value" tracks/0/type = "value"
@ -160,13 +215,14 @@ tracks/0/keys = {
"times": PackedFloat32Array(0), "times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1), "transitions": PackedFloat32Array(1),
"update": 0, "update": 0,
"values": [1.0] "values": [0.0]
} }
[sub_resource type="AnimationLibrary" id="AnimationLibrary_k8op5"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_k8op5"]
_data = { _data = {
"RESET": SubResource("Animation_hqls1"), "RESET": SubResource("Animation_hqls1"),
"light_up": SubResource("Animation_hxk3n"), "light_up": SubResource("Animation_hxk3n"),
"lights_out": SubResource("Animation_wa80i"),
"menu": SubResource("Animation_upogh") "menu": SubResource("Animation_upogh")
} }
@ -232,6 +288,78 @@ tracks/4/keys = {
"update": 0, "update": 0,
"values": [0.0] "values": [0.0]
} }
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("AudioPlayer/childhood/PanelContainer/VBoxContainer/ScrollContainer/Label:visible_ratio")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.0]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("AudioPlayer/childhood/PanelContainer/VBoxContainer/ScrollContainer:scroll_vertical")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("AudioPlayer/childhood/PanelContainer/VBoxContainer/ScrollContainer:mouse_filter")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [1]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("AudioPlayer/childhood/PanelContainer/VBoxContainer/ScrollContainer:custom_minimum_size")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector2(800, 750)]
}
tracks/9/type = "value"
tracks/9/imported = false
tracks/9/enabled = true
tracks/9/path = NodePath("AudioPlayer/childhood:modulate")
tracks/9/interp = 1
tracks/9/loop_wrap = true
tracks/9/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
tracks/10/type = "value"
tracks/10/imported = false
tracks/10/enabled = true
tracks/10/path = NodePath("AudioPlayer/childhood/PanelContainer:self_modulate")
tracks/10/interp = 1
tracks/10/loop_wrap = true
tracks/10/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 1)]
}
[sub_resource type="Animation" id="Animation_g5l1m"] [sub_resource type="Animation" id="Animation_g5l1m"]
resource_name = "childhood" resource_name = "childhood"
@ -275,6 +403,92 @@ tracks/2/keys = {
"times": PackedFloat32Array(1.6) "times": PackedFloat32Array(1.6)
} }
tracks/2/use_blend = true tracks/2/use_blend = true
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("AudioPlayer/childhood/PanelContainer/VBoxContainer/ScrollContainer/Label:visible_ratio")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0.3, 0.8, 3, 14.6, 17.2, 26.4, 28.6, 36.3, 36.8, 50.0759, 51, 53.4, 54.7, 60.8, 61.7, 66.8, 67.8, 74.7, 76.6, 78.3, 81, 81.6, 87.2),
"transitions": PackedFloat32Array(1, 1, 0.615572, 1, 0.435275, 1, 0.615572, 1, 0.594604, 1, 0.378929, 1, 0.63728, 1, 0.535887, 1, 1, 1, 0.435275, 0.63728, 1, 1, 1),
"update": 0,
"values": [0.0, 0.014, 0.014, 0.15, 0.153, 0.287, 0.287, 0.38, 0.38, 0.528, 0.528, 0.563, 0.563, 0.663, 0.663, 0.746, 0.746, 0.859, 0.859, 0.876, 0.92, 0.92, 1.0]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("AudioPlayer/childhood/PanelContainer/VBoxContainer/ScrollContainer:scroll_vertical")
tracks/4/interp = 2
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(74.8, 76.2),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0, 74]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("AudioPlayer/childhood/PanelContainer/VBoxContainer/ScrollContainer:mouse_filter")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 90),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [2, 0]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("AudioPlayer/childhood/PanelContainer/VBoxContainer/ScrollContainer:custom_minimum_size")
tracks/6/interp = 2
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.4),
"transitions": PackedFloat32Array(0.466516, 1),
"update": 0,
"values": [Vector2(800, 750), Vector2(800, 800)]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("AudioPlayer/childhood:modulate")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0, 0.4, 91.7, 92.6),
"transitions": PackedFloat32Array(1, 1, 1.93187, 1),
"update": 0,
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("AudioPlayer/childhood/PanelContainer:self_modulate")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(89.3, 91.8),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
}
tracks/9/type = "method"
tracks/9/imported = false
tracks/9/enabled = true
tracks/9/path = NodePath(".")
tracks/9/interp = 1
tracks/9/loop_wrap = true
tracks/9/keys = {
"times": PackedFloat32Array(91.9),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"_on_childhood_done"
}]
}
[sub_resource type="Animation" id="Animation_as75l"] [sub_resource type="Animation" id="Animation_as75l"]
resource_name = "childhood_intro" resource_name = "childhood_intro"
@ -561,17 +775,19 @@ _data = {
[sub_resource type="GDScript" id="GDScript_tfc2r"] [sub_resource type="GDScript" id="GDScript_tfc2r"]
script/source = "extends AnimationPlayer script/source = "extends AnimationPlayer
func start_soundtrack(): func start_soundtrack():
$Moving.play(70) $Moving.play(70)
$Childhood.play(70) $Childhood.play(70)
$VoiceTraining.play(70) $VoiceTraining.play(70)
func _on_childhood_collected():
play(\"childhood\")
" "
[sub_resource type="BoxShape3D" id="BoxShape3D_cb3g8"] [sub_resource type="BoxShape3D" id="BoxShape3D_cb3g8"]
size = Vector3(1.81843, 2.13395, 0.0774798) size = Vector3(1.81843, 2.13395, 0.0774798)
[sub_resource type="ViewportTexture" id="ViewportTexture_gwx6q"] [sub_resource type="ViewportTexture" id="ViewportTexture_7hana"]
viewport_path = NodePath("Collectable/UiWrapper/UiSprite/SubViewport") viewport_path = NodePath("Collectable/UiWrapper/UiSprite/SubViewport")
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_72g2i"] [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_72g2i"]
@ -620,6 +836,9 @@ size = Vector3(1, 0.305693, 0.775269)
[node name="youth room" type="Node3D"] [node name="youth room" type="Node3D"]
script = ExtResource("1_aitp0") script = ExtResource("1_aitp0")
[node name="picker" parent="." instance=ExtResource("19_a4n1o")]
visible = false
[node name="youth_room" parent="." instance=ExtResource("1_jf3oi")] [node name="youth_room" parent="." instance=ExtResource("1_jf3oi")]
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="youth_room"] [node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="youth_room"]
@ -640,9 +859,10 @@ bus = &"sfx"
[node name="WorldEnvironment" type="WorldEnvironment" parent="."] [node name="WorldEnvironment" type="WorldEnvironment" parent="."]
environment = SubResource("Environment_pllnm") environment = SubResource("Environment_pllnm")
camera_attributes = SubResource("CameraAttributesPractical_26mp0") camera_attributes = SubResource("CameraAttributesPractical_26mp0")
script = SubResource("GDScript_wb8kg")
[node name="SpotLight3D" type="SpotLight3D" parent="."] [node name="desk_light" type="SpotLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.416868, 0.908967, 0, -0.908967, 0.416868, -0.599038, 1.39757, 1.64821) transform = Transform3D(1, 0, 0, 0, 0.30009, 0.953911, 0, -0.953911, 0.30009, -0.599038, 1.39757, 1.64821)
light_color = Color(0.94902, 0.737255, 0.627451, 1) light_color = Color(0.94902, 0.737255, 0.627451, 1)
light_energy = 8.0 light_energy = 8.0
light_size = 0.1 light_size = 0.1
@ -653,7 +873,7 @@ spot_angle = 58.1539
spot_angle_attenuation = 0.812252 spot_angle_attenuation = 0.812252
script = SubResource("GDScript_35dmj") script = SubResource("GDScript_35dmj")
[node name="OmniLight3D" type="OmniLight3D" parent="SpotLight3D"] [node name="OmniLight3D" type="OmniLight3D" parent="desk_light"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.127422, -0.00326544, -0.389614) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.127422, -0.00326544, -0.389614)
light_color = Color(0.952941, 0.662745, 0.54902, 1) light_color = Color(0.952941, 0.662745, 0.54902, 1)
light_energy = 0.5 light_energy = 0.5
@ -664,7 +884,7 @@ shadow_blur = 0.5
omni_range = 5.48365 omni_range = 5.48365
omni_attenuation = 0.90125 omni_attenuation = 0.90125
[node name="OmniLight3D2" type="OmniLight3D" parent="SpotLight3D"] [node name="OmniLight3D2" type="OmniLight3D" parent="desk_light"]
light_color = Color(0.94902, 0.737255, 0.627451, 1) light_color = Color(0.94902, 0.737255, 0.627451, 1)
light_energy = 0.5 light_energy = 0.5
omni_range = 0.147682 omni_range = 0.147682
@ -783,10 +1003,9 @@ libraries = {
} }
[node name="PlayerController" parent="." groups=["camera_owner"] instance=ExtResource("3_foj4y")] [node name="PlayerController" parent="." groups=["camera_owner"] instance=ExtResource("3_foj4y")]
transform = Transform3D(0.686123, 0, 0.727485, 0, 1, 0, -0.727485, 0, 0.686123, 1.14815, 1.19209e-07, 0.730062) transform = Transform3D(0.686123, 0, 0.727485, 0, 1, 0, -0.727485, 0, 0.686123, 1.04786, 2.38418e-07, 1.14663)
[node name="AudioPlayer" type="AnimationPlayer" parent="."] [node name="AudioPlayer" type="AnimationPlayer" parent="."]
autoplay = "RESET"
libraries = { libraries = {
"": SubResource("AnimationLibrary_ilekd") "": SubResource("AnimationLibrary_ilekd")
} }
@ -804,6 +1023,78 @@ bus = &"music"
stream = ExtResource("9_i8mqk") stream = ExtResource("9_i8mqk")
bus = &"music" bus = &"music"
[node name="childhood" type="CenterContainer" parent="AudioPlayer"]
modulate = Color(1, 1, 1, 0)
self_modulate = Color(1, 1, 1, 0.923078)
anchors_preset = 15
anchor_right = 1.0
anchor_bottom = 1.0
offset_right = -424.0
grow_horizontal = 2
grow_vertical = 2
[node name="PanelContainer" type="PanelContainer" parent="AudioPlayer/childhood"]
layout_mode = 2
[node name="StartFrame" type="TextureRect" parent="AudioPlayer/childhood/PanelContainer"]
custom_minimum_size = Vector2(0, 900)
layout_mode = 2
size_flags_vertical = 0
texture = ExtResource("2_21x33")
expand_mode = 2
stretch_mode = 4
[node name="Panel" type="PanelContainer" parent="AudioPlayer/childhood/PanelContainer/StartFrame"]
show_behind_parent = true
layout_mode = 2
offset_left = 199.0
offset_top = -112.0
offset_right = 1039.0
offset_bottom = 697.0
rotation = 0.459022
[node name="VBoxContainer" type="VBoxContainer" parent="AudioPlayer/childhood/PanelContainer"]
layout_mode = 2
[node name="Label" type="Label" parent="AudioPlayer/childhood/PanelContainer/VBoxContainer"]
layout_mode = 2
theme_type_variation = &"HeaderLarge"
text = " Childhood"
[node name="ScrollContainer" type="ScrollContainer" parent="AudioPlayer/childhood/PanelContainer/VBoxContainer"]
custom_minimum_size = Vector2(800, 750)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
horizontal_scroll_mode = 0
vertical_scroll_mode = 3
[node name="Label" type="Label" parent="AudioPlayer/childhood/PanelContainer/VBoxContainer/ScrollContainer"]
layout_mode = 2
size_flags_horizontal = 3
text = "Oh, my old mask. I have so many good memories about theatre club. I would stand on my bed for entire afternoons, weeks on end, practicing my lines. Pretending to be on the big stage ... my mom would get mad at me, when she had to call me three or four times for dinner. I just … didnt like the interruptions. We both were often mad at each other.
Dinner was difficult. I just couldnt bring myself to eat, because I couldnt deal with the bread and my mom. She was always so worried. Lisa, you forgot your homework, Lisa why wont you play with the other girls, Lisa why didnt Steffi invite you to her birthday, Lisa this, Lisa that.
But I was fine. She just wouldnt listen.
Yes, I didnt do homework, but my teachers didnt mind it as much with me - which the other kids wouldnt shut up about. But like … they also made fun of me reading school books and talking to my teachers during breaks.
But at least I could fucking talk to teachers and they had stuff to say. Mr Thomas probably even understood me better than my own mom.
He said I was gifted. He said I just didnt need homework for good grades. And he also made sure to always include extra credits. So my silly slip-ups wouldnt get me a B."
autowrap_mode = 3
visible_characters = 0
visible_characters_behavior = 1
visible_ratio = 0.0
[node name="StartBottom" type="TextureRect" parent="AudioPlayer/childhood/PanelContainer/VBoxContainer"]
custom_minimum_size = Vector2(0, 64)
layout_mode = 2
size_flags_vertical = 8
texture = ExtResource("3_xqd4w")
expand_mode = 2
stretch_mode = 4
[node name="VoiceTraining" type="AudioStreamPlayer" parent="AudioPlayer"] [node name="VoiceTraining" type="AudioStreamPlayer" parent="AudioPlayer"]
stream = ExtResource("10_wwwdq") stream = ExtResource("10_wwwdq")
bus = &"music" bus = &"music"
@ -816,7 +1107,7 @@ bus = &"music"
bus = &"music" bus = &"music"
[node name="Collectable" type="Area3D" parent="." groups=["collectables"]] [node name="Collectable" type="Area3D" parent="." groups=["collectables"]]
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -0.940637, 1.34703, 0.817837) transform = Transform3D(-0.863025, 0, 0.50516, 0, 1, 0, -0.50516, 0, -0.863025, 0.121309, 0.803665, 2.4765)
collision_layer = 16 collision_layer = 16
script = ExtResource("11_6fwv8") script = ExtResource("11_6fwv8")
@ -824,8 +1115,7 @@ script = ExtResource("11_6fwv8")
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00898492, -0.14171, 0.152755) transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00898492, -0.14171, 0.152755)
[node name="UiWrapper" type="Area3D" parent="Collectable"] [node name="UiWrapper" type="Area3D" parent="Collectable"]
transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, -2.38419e-07, 0, 0.071894) transform = Transform3D(0.1, -1.86265e-09, 0, 0, 0.0906676, 0.0421827, 0, -0.0421827, 0.0906676, -2.38419e-07, 0, 0.0718942)
visible = false
script = ExtResource("11_7uxd8") script = ExtResource("11_7uxd8")
[node name="UI_click_collider" type="CollisionShape3D" parent="Collectable/UiWrapper"] [node name="UI_click_collider" type="CollisionShape3D" parent="Collectable/UiWrapper"]
@ -836,7 +1126,7 @@ shape = SubResource("BoxShape3D_cb3g8")
transform = Transform3D(1, 0, 2.4869e-14, 0, 1, 0, -2.4869e-14, 0, 1, 0, 0, 0.610758) transform = Transform3D(1, 0, 2.4869e-14, 0, 1, 0, -2.4869e-14, 0, 1, 0, 0, 0.610758)
pixel_size = 0.015 pixel_size = 0.015
no_depth_test = true no_depth_test = true
texture = SubResource("ViewportTexture_gwx6q") texture = SubResource("ViewportTexture_7hana")
[node name="SubViewport" type="SubViewport" parent="Collectable/UiWrapper/UiSprite"] [node name="SubViewport" type="SubViewport" parent="Collectable/UiWrapper/UiSprite"]
transparent_bg = true transparent_bg = true
@ -844,6 +1134,7 @@ size = Vector2i(300, 350)
render_target_update_mode = 4 render_target_update_mode = 4
[node name="Collectable_ui" parent="Collectable/UiWrapper/UiSprite/SubViewport" instance=ExtResource("11_jxai0")] [node name="Collectable_ui" parent="Collectable/UiWrapper/UiSprite/SubViewport" instance=ExtResource("11_jxai0")]
visible = false
is_story = true is_story = true
item_name = "my old Mask" item_name = "my old Mask"
content_notes = "CN: testing testing 123" content_notes = "CN: testing testing 123"
@ -917,6 +1208,7 @@ grow_vertical = 2
mouse_filter = 1 mouse_filter = 1
[node name="Mouse" type="CenterContainer" parent="SceneUI"] [node name="Mouse" type="CenterContainer" parent="SceneUI"]
visible = false
layout_mode = 1 layout_mode = 1
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -925,15 +1217,33 @@ grow_horizontal = 2
grow_vertical = 2 grow_vertical = 2
[node name="TextureRect" type="TextureRect" parent="SceneUI/Mouse"] [node name="TextureRect" type="TextureRect" parent="SceneUI/Mouse"]
visible = false
layout_mode = 2 layout_mode = 2
texture = ExtResource("13_lqj71") texture = ExtResource("13_lqj71")
[node name="catch_all" type="Node3D" parent="."] [node name="old-mask" type="Node3D" parent="."]
script = ExtResource("16_tddlc")
[node name="old_mask" type="MeshInstance3D" parent="old-mask"]
transform = Transform3D(-0.51156, -0.746323, -0.425804, 0.144568, -0.563249, 0.813542, -0.846999, 0.354618, 0.396029, -0.0221631, 0.492276, 2.56703)
mesh = ExtResource("19_jr2bb")
skeleton = NodePath("")
[node name="OmniLight3D" type="OmniLight3D" parent="old-mask/old_mask"]
transform = Transform3D(1, -3.8743e-07, 5.96046e-08, 3.57628e-07, 1, 8.9407e-08, -5.96046e-08, -8.9407e-08, 1, 0.083235, -0.219628, 0.176047)
light_color = Color(0.972549, 0.752941, 0.592157, 1)
light_energy = 0.1
light_specular = 0.0
omni_range = 0.457129
omni_attenuation = 0.659754
[connection signal="ui_entered" from="PlayerController" to="SceneUI" method="show"] [connection signal="ui_entered" from="PlayerController" to="SceneUI" method="show"]
[connection signal="ui_exited" from="PlayerController" to="SceneUI" method="hide"] [connection signal="ui_exited" from="PlayerController" to="SceneUI" method="hide"]
[connection signal="animation_finished" from="AudioPlayer" to="PlayerController" method="_on_childhood_done"]
[connection signal="input_event" from="Collectable/UiWrapper" to="Collectable/UiWrapper" method="_on_input_event" flags=18] [connection signal="input_event" from="Collectable/UiWrapper" to="Collectable/UiWrapper" method="_on_input_event" flags=18]
[connection signal="card_collected" from="Collectable/UiWrapper/UiSprite/SubViewport/Collectable_ui" to="." method="_on_childhood_collected"]
[connection signal="card_collected" from="Collectable/UiWrapper/UiSprite/SubViewport/Collectable_ui" to="WorldEnvironment" method="focus_object"]
[connection signal="card_collected" from="Collectable/UiWrapper/UiSprite/SubViewport/Collectable_ui" to="PlayerController" method="_on_childhood_collected"]
[connection signal="card_collected" from="Collectable/UiWrapper/UiSprite/SubViewport/Collectable_ui" to="AudioPlayer" method="_on_childhood_collected"]
[connection signal="body_entered" from="Bed and Ladders/ladder_trigger" to="PlayerController" method="_on_bed_enter"] [connection signal="body_entered" from="Bed and Ladders/ladder_trigger" to="PlayerController" method="_on_bed_enter"]
[connection signal="body_entered" from="Bed and Ladders/ladder_trigger" to="Bed and Ladders/ladder" method="raise"] [connection signal="body_entered" from="Bed and Ladders/ladder_trigger" to="Bed and Ladders/ladder" method="raise"]
[connection signal="body_exited" from="Bed and Ladders/ladder_reset" to="PlayerController" method="_on_bed_exit"] [connection signal="body_exited" from="Bed and Ladders/ladder_reset" to="PlayerController" method="_on_bed_exit"]

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=4 format=3 uid="uid://bvowj4l8dtceu"] [gd_scene load_steps=3 format=3 uid="uid://bvowj4l8dtceu"]
[ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="1_xrckx"] [ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="1_xrckx"]
[ext_resource type="PackedScene" uid="uid://vkcdj8c3ytbq" path="res://logic-scenes/board/post-it.tscn" id="2_ucudl"] [ext_resource type="PackedScene" uid="uid://vkcdj8c3ytbq" path="res://logic-scenes/board/post-it.tscn" id="2_ucudl"]

View File

@ -156,6 +156,7 @@ clip_children = 2
position = Vector2(150, 110) position = Vector2(150, 110)
scale = Vector2(0.6, 0.6) scale = Vector2(0.6, 0.6)
sprite_frames = SubResource("SpriteFrames_ckivt") sprite_frames = SubResource("SpriteFrames_ckivt")
frame = 2
script = SubResource("GDScript_8bs16") script = SubResource("GDScript_8bs16")
[node name="GPUParticles2D" type="GPUParticles2D" parent="BackgroundSprite"] [node name="GPUParticles2D" type="GPUParticles2D" parent="BackgroundSprite"]

View File

@ -10,6 +10,15 @@ enum {
@onready var debug_board:Control = $"board of devs" @onready var debug_board:Control = $"board of devs"
var has_focus = false:
set(focus):
if not focus == has_focus:
if focus:
for player in anim_players: player.play("reveal")
selection_state = CARDS # fixme
self.show()
has_focus = focus
var selection_state var selection_state
var anim_players:Array var anim_players:Array
@ -37,14 +46,14 @@ func _ready():
for control in card_controls: for control in card_controls:
options.append(control.get_child(1)) options.append(control.get_child(1))
anim_players.append(control.get_child(0)) anim_players.append(control.get_child(0))
selection_state = CARDS selection_state = INI
fill_card_slots() fill_card_slots()
func fill_card_slots(): func fill_card_slots():
for i in range($cards.get_child_count()): for i in range($cards.get_child_count()):
var card:Card = $cards.get_child(i).get_child(1) var card:Card = $cards.get_child(i).get_child(1)
card.replace_with(debug_board.get_child(2).get_child(i) as Card) card.replace_with(debug_board.get_child(0).get_child(i) as Card)
func fill_post_slots(): func fill_post_slots():
var post_its: Array[PostIt] = [] var post_its: Array[PostIt] = []
@ -56,19 +65,15 @@ func fill_post_slots():
options[i].replace_with(post_its[i]) options[i].replace_with(post_its[i])
func _unhandled_input(event): func _unhandled_input(event):
if event.is_action_pressed("ui_up") or event.is_action_pressed("ui_left") or event.is_action_pressed("ui_focus_next"): if has_focus:
curr_selection_id -= 1 if event.is_action_pressed("ui_up") or event.is_action_pressed("ui_left") or event.is_action_pressed("ui_focus_next"):
elif event.is_action_pressed("ui_down") or event.is_action_pressed("ui_right") or event.is_action_pressed("ui_focus_prev"): curr_selection_id -= 1
curr_selection_id += 1 elif event.is_action_pressed("ui_down") or event.is_action_pressed("ui_right") or event.is_action_pressed("ui_focus_prev"):
if event.is_action_pressed("ui_accept"): curr_selection_id += 1
pick(curr_selection_id) if event.is_action_pressed("ui_accept"):
pick(curr_selection_id)
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func pick(id: int): func pick(id: int):
print("meep")
if id == -1: if id == -1:
curr_selection_id = 0 curr_selection_id = 0
return return

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=62 format=3 uid="uid://brk4hjdf2x81a"] [gd_scene load_steps=65 format=3 uid="uid://brk4hjdf2x81a"]
[ext_resource type="Script" path="res://logic-scenes/card_picker/card_picker.gd" id="1_pjntm"] [ext_resource type="Script" path="res://logic-scenes/card_picker/card_picker.gd" id="1_pjntm"]
[ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="2_dqebt"] [ext_resource type="PackedScene" uid="uid://dy5rd437h5hsw" path="res://logic-scenes/board/card.tscn" id="2_dqebt"]
@ -208,11 +208,40 @@ tracks/1/keys = {
"values": [-0.109599, 0.5044, 3.4924] "values": [-0.109599, 0.5044, 3.4924]
} }
[sub_resource type="Animation" id="Animation_3304u"]
resource_name = "reveal"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.3),
"transitions": PackedFloat32Array(0.435275, 1),
"update": 0,
"values": [Vector2(0, 256), Vector2(-317, 25)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.3),
"transitions": PackedFloat32Array(0.435275, 1),
"update": 0,
"values": [0.174533, -0.109599]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_gdxmh"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_gdxmh"]
_data = { _data = {
"RESET": SubResource("Animation_dinvx"), "RESET": SubResource("Animation_dinvx"),
"deselect": SubResource("Animation_4dp1g"), "deselect": SubResource("Animation_4dp1g"),
"pick": SubResource("Animation_76klu"), "pick": SubResource("Animation_76klu"),
"reveal": SubResource("Animation_3304u"),
"select": SubResource("Animation_ldr2c"), "select": SubResource("Animation_ldr2c"),
"shuffle": SubResource("Animation_abihp"), "shuffle": SubResource("Animation_abihp"),
"unshuffle": SubResource("Animation_d68d2") "unshuffle": SubResource("Animation_d68d2")
@ -397,11 +426,40 @@ tracks/1/keys = {
"values": [0.0, 0.0436332, 3.22362] "values": [0.0, 0.0436332, 3.22362]
} }
[sub_resource type="Animation" id="Animation_orrwn"]
resource_name = "reveal"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.1, 0.4),
"transitions": PackedFloat32Array(0.517633, 1),
"update": 0,
"values": [Vector2(0, 256), Vector2(0, 0)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.1, 0.4),
"transitions": PackedFloat32Array(0.517633, 1),
"update": 0,
"values": [0.349066, 0.0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_oxheu"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_oxheu"]
_data = { _data = {
"RESET": SubResource("Animation_pcher"), "RESET": SubResource("Animation_pcher"),
"deselect": SubResource("Animation_5q97d"), "deselect": SubResource("Animation_5q97d"),
"pick": SubResource("Animation_16dsw"), "pick": SubResource("Animation_16dsw"),
"reveal": SubResource("Animation_orrwn"),
"select": SubResource("Animation_2c94q"), "select": SubResource("Animation_2c94q"),
"shuffle": SubResource("Animation_pdic8"), "shuffle": SubResource("Animation_pdic8"),
"unshuffle": SubResource("Animation_sa974") "unshuffle": SubResource("Animation_sa974")
@ -610,11 +668,40 @@ tracks/1/keys = {
"values": [0.10472, 0.0436332, 3.22362] "values": [0.10472, 0.0436332, 3.22362]
} }
[sub_resource type="Animation" id="Animation_ep22n"]
resource_name = "reveal"
length = 0.5
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath(".:position")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.2, 0.5),
"transitions": PackedFloat32Array(0.482968, 1),
"update": 0,
"values": [Vector2(0, 256), Vector2(315, 22)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath(".:rotation")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0.2, 0.5),
"transitions": PackedFloat32Array(0.482968, 1),
"update": 0,
"values": [0.349066, 0.10472]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_8blxm"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_8blxm"]
_data = { _data = {
"RESET": SubResource("Animation_pf55g"), "RESET": SubResource("Animation_pf55g"),
"deselect": SubResource("Animation_6ar8x"), "deselect": SubResource("Animation_6ar8x"),
"pick": SubResource("Animation_wp0c8"), "pick": SubResource("Animation_wp0c8"),
"reveal": SubResource("Animation_ep22n"),
"select": SubResource("Animation_pcu23"), "select": SubResource("Animation_pcu23"),
"shuffle": SubResource("Animation_vu874"), "shuffle": SubResource("Animation_vu874"),
"unshuffle": SubResource("Animation_mj8e0") "unshuffle": SubResource("Animation_mj8e0")
@ -1376,6 +1463,7 @@ script = ExtResource("1_pjntm")
layout_mode = 2 layout_mode = 2
[node name="label" type="Label" parent="Control"] [node name="label" type="Label" parent="Control"]
visible = false
layout_mode = 2 layout_mode = 2
offset_left = -359.0 offset_left = -359.0
offset_top = -256.0 offset_top = -256.0

View File

@ -4,7 +4,7 @@ class_name Collectable_Ui
@export var collapsed = true: @export var collapsed = true:
set(collapse): set(collapse):
if is_inside_tree(): if is_inside_tree() and not Engine.is_editor_hint():
if State.reduce_motion: if State.reduce_motion:
collapsed = false collapsed = false
return return
@ -25,21 +25,19 @@ class_name Collectable_Ui
if has_focus == focused: return if has_focus == focused: return
if focused: if focused:
has_focus = State.request_focus(self) has_focus = true
if has_focus: print(visible)
collapsed = false if not visible: show()
if collected: collapsed = false
$Panel/Content/Buttons/VBoxContainer/put_back.grab_focus() if collected:
else: $Panel/Content/Buttons/VBoxContainer/put_back.grab_focus()
$Panel/Content/Buttons/VBoxContainer/collect_or_listen.grab_focus() else:
$Panel/Content/Buttons/VBoxContainer/collect_or_listen.grab_focus()
elif has_focus: elif has_focus:
has_focus = false # How did we get here? has_focus = false
State.focus_cleared(self)
get_viewport().gui_release_focus() get_viewport().gui_release_focus()
hide() #hide()
if not visible:
show()
@export var collected: bool = false: @export var collected: bool = false:
@ -72,6 +70,8 @@ class_name Collectable_Ui
if is_inside_tree(): if is_inside_tree():
$Content/Name.text = new_notes $Content/Name.text = new_notes
signal card_collected
# Called when the node enters the scene tree for the first time. # Called when the node enters the scene tree for the first time.
func _ready(): func _ready():
#$Panel/Content/ContentNotes.visible = State.show_content_notes #$Panel/Content/ContentNotes.visible = State.show_content_notes
@ -80,11 +80,15 @@ func _ready():
if visible and not collapsed: _show_buttons() if visible and not collapsed: _show_buttons()
func _hide_buttons(): func _hide_buttons():
if not State.reduce_motion: $AnimationPlayer.play_backwards("show_buttons") if is_inside_tree():
if not State.reduce_motion: $AnimationPlayer.play_backwards("show_buttons")
func _show_buttons(): func _show_buttons():
if State.reduce_motion: if is_inside_tree():
$AnimationPlayer.play("show_buttons") if not State.reduce_motion:
$AnimationPlayer.play("show_buttons")
else:
$AnimationPlayer.play("RESET")
else: else:
$AnimationPlayer.play("RESET") $AnimationPlayer.play("RESET")
@ -106,4 +110,12 @@ func show():
tween.tween_property(self, "modulate", Color(1, 1, 1), 0.4) tween.tween_property(self, "modulate", Color(1, 1, 1), 0.4)
func _yoink_focus(): func _yoink_focus():
State.request_focus(self, true) return # fixme
if not has_focus:
State.request_focus_for(self, true)
func _on_pick_button_pressed():
hide()
print("card collected!")
emit_signal("card_collected")
State.drop_focus(self)

View File

@ -171,6 +171,7 @@ libraries = {
[connection signal="resized" from="Panel/Content/Buttons/VBoxContainer" to="Panel/Content/Buttons" method="_on_v_box_container_resized"] [connection signal="resized" from="Panel/Content/Buttons/VBoxContainer" to="Panel/Content/Buttons" method="_on_v_box_container_resized"]
[connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/collect_or_listen" to="." method="_yoink_focus"] [connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/collect_or_listen" to="." method="_yoink_focus"]
[connection signal="pressed" from="Panel/Content/Buttons/VBoxContainer/collect_or_listen" to="." method="_on_pick_button_pressed"]
[connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/Summary" to="." method="_yoink_focus"] [connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/Summary" to="." method="_yoink_focus"]
[connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/skip" to="." method="_yoink_focus"] [connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/skip" to="." method="_yoink_focus"]
[connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/put_back" to="." method="_yoink_focus"] [connection signal="focus_entered" from="Panel/Content/Buttons/VBoxContainer/put_back" to="." method="_yoink_focus"]

Binary file not shown.

View File

@ -0,0 +1,51 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://bixvvxjlt1g24"
path="res://.godot/imported/old-mask.glb-1316622a7340cbc9493e3e0eb9b621cd.scn"
[deps]
source_file="res://logic-scenes/collectable/import/old-mask.glb"
dest_files=["res://.godot/imported/old-mask.glb-1316622a7340cbc9493e3e0eb9b621cd.scn"]
[params]
nodes/root_type="Node3D"
nodes/root_name="Scene Root"
nodes/apply_root_scale=true
nodes/root_scale=1.0
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
import_script/path=""
_subresources={
"materials": {
"desk-utilities": {
"use_external/enabled": true,
"use_external/path": "res://base-environments/youth_room/import/materials/desk-utilities.tres"
}
},
"meshes": {
"old-mask_old_mask": {
"generate/lightmap_uv": 0,
"generate/lods": 0,
"generate/shadow_meshes": 0,
"lods/normal_merge_angle": 60.0,
"lods/normal_split_angle": 25.0,
"save_to_file/enabled": true,
"save_to_file/make_streamable": "",
"save_to_file/path": "res://logic-scenes/collectable/import/old-mask.res"
}
}
}
gltf/embedded_image_handling=1

Binary file not shown.

View File

@ -1,11 +1,11 @@
extends RigidBody3D extends RigidBody3D
var has_focus: bool = false : var has_focus: bool = false:
set(focused): set(focused):
if has_focus != focused: if has_focus != focused:
if focused: if focused:
has_focus = State.request_focus(self) has_focus = true
if is_inside_tree() and has_focus: if is_inside_tree():
camera.make_current() camera.make_current()
get_viewport().gui_release_focus() get_viewport().gui_release_focus()
Input.mouse_mode = Input.MOUSE_MODE_CAPTURED Input.mouse_mode = Input.MOUSE_MODE_CAPTURED
@ -24,7 +24,6 @@ var has_focus: bool = false :
else: else:
jitter_strength = 0 jitter_strength = 0
has_focus = false has_focus = false
State.focus_cleared(self)
sleeping = has_focus sleeping = has_focus
@ -64,7 +63,7 @@ var has_entered:bool = false
signal ui_exited signal ui_exited
func _ready(): func _ready():
if has_focus: _handle_jitter(0) _handle_jitter(0)
func _process(delta): func _process(delta):
@ -77,7 +76,7 @@ func _process(delta):
emit_signal("ui_exited") emit_signal("ui_exited")
has_entered = false has_entered = false
if Input.is_action_just_pressed("ui_accept"): if Input.is_action_just_pressed("ui_accept"):
State.assign_focus_to(focus_ray.get_collider()) State.pass_focus_to(focus_ray.get_collider())
func _physics_process(delta:float): func _physics_process(delta:float):
if has_focus: if has_focus:
@ -108,7 +107,7 @@ func _handle_movement(delta:float):
func _handle_rotation(delta:float): func _handle_rotation(delta:float):
var smoothness = min(3, 60.0/Engine.get_frames_per_second()) var smoothness = min(3, 60.0/Engine.get_frames_per_second())
var input_speed = Vector2( Input.get_action_strength("look_right")-Input.get_action_strength("look_left"), Input.get_action_strength("look_down")-Input.get_action_strength("look_up")) * gamepad_response var input_speed = Vector2( Input.get_action_strength("look_right")-Input.get_action_strength("look_left"), Input.get_action_strength("look_up")-Input.get_action_strength("look_down")) * gamepad_response
if current_mouse_rotation.length()>0: if current_mouse_rotation.length()>0:
input_speed = current_mouse_rotation input_speed = current_mouse_rotation
@ -150,14 +149,14 @@ func _unhandled_input(event:InputEvent):
_handle_mouse_input(event) _handle_mouse_input(event)
get_viewport().set_input_as_handled() get_viewport().set_input_as_handled()
if event is InputEventMouseButton and has_entered: if event is InputEventMouseButton and has_entered:
has_focus = false State.free_focus()
get_viewport().set_input_as_handled()
if event.is_action("ui_accept"):
State.assign_focus_to(focus_ray.get_collider())
get_viewport().set_input_as_handled() get_viewport().set_input_as_handled()
#if event.is_action_pressed("ui_accept"):
# State.pass_focus_to(focus_ray.get_collider())
# get_viewport().set_input_as_handled()
func _on_empty_click(): func _on_empty_click():
State.pass_focus_to(self) State.request_focus_for(self, true)
func _on_bed_enter(_body): func _on_bed_enter(_body):
if not (crouched or on_crouch_cooldown): if not (crouched or on_crouch_cooldown):

View File

@ -1,10 +1,18 @@
[gd_scene load_steps=8 format=3 uid="uid://mkccbig41bqb"] [gd_scene load_steps=11 format=3 uid="uid://mkccbig41bqb"]
[ext_resource type="Script" path="res://logic-scenes/player_controller/player_controller.gd" id="1_0b4mi"] [ext_resource type="Script" path="res://logic-scenes/player_controller/player_controller.gd" id="1_0b4mi"]
[ext_resource type="ArrayMesh" uid="uid://bfc3d4g40n0wy" path="res://logic-scenes/collectable/import/old-mask.res" id="2_vnej0"]
[sub_resource type="PhysicsMaterial" id="10"] [sub_resource type="PhysicsMaterial" id="10"]
friction = 0.0 friction = 0.0
[sub_resource type="GDScript" id="GDScript_r0b38"]
script/source = "extends MeshInstance3D
func _process(delta):
rotate_y(delta/3)
"
[sub_resource type="SphereShape3D" id="8"] [sub_resource type="SphereShape3D" id="8"]
radius = 0.307047 radius = 0.307047
@ -34,6 +42,114 @@ tracks/1/keys = {
"update": 0, "update": 0,
"values": [Vector3(0, 0, 0)] "values": [Vector3(0, 0, 0)]
} }
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Yaw/Pitch/Mount/Camera3D/memory mount/old_mask2:rotation")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector3(5.96046e-08, 1.74846e-07, -7.10543e-15)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Yaw/Pitch/Mount/Camera3D/memory mount:position")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector3(0.11067, -0.0251684, -0.309266)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Yaw/Pitch/Mount/Camera3D/memory mount:rotation")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Vector3(1.49012e-07, 0, 0)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Yaw/Pitch/Mount/Camera3D/SpotLight3D:light_energy")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [0.4]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Yaw/Pitch/Mount/Camera3D/SpotLight3D2:light_energy")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [1.5]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("Yaw/Pitch/Mount/Camera3D/SpotLight3D:visible")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/8/type = "value"
tracks/8/imported = false
tracks/8/enabled = true
tracks/8/path = NodePath("Yaw/Pitch/Mount/Camera3D/SpotLight3D2:layers")
tracks/8/interp = 1
tracks/8/loop_wrap = true
tracks/8/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [1]
}
tracks/9/type = "value"
tracks/9/imported = false
tracks/9/enabled = true
tracks/9/path = NodePath("Yaw/Pitch/Mount/Camera3D/SpotLight3D2:visible")
tracks/9/interp = 1
tracks/9/loop_wrap = true
tracks/9/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/10/type = "value"
tracks/10/imported = false
tracks/10/enabled = true
tracks/10/path = NodePath("Yaw/Pitch/Mount/Camera3D/memory mount/old_mask2:visible")
tracks/10/interp = 1
tracks/10/loop_wrap = true
tracks/10/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="12"] [sub_resource type="Animation" id="12"]
resource_name = "crouch" resource_name = "crouch"
@ -63,6 +179,106 @@ tracks/1/keys = {
"values": [Vector3(0, 0, 0), Vector3(-30, 0, -10), Vector3(-20, 0, 3), Vector3(0, 0, 0), Vector3(0, 0, 0)] "values": [Vector3(0, 0, 0), Vector3(-30, 0, -10), Vector3(-20, 0, 3), Vector3(0, 0, 0), Vector3(0, 0, 0)]
} }
[sub_resource type="Animation" id="Animation_5o0sk"]
resource_name = "mask_reveal"
length = 3.0
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Yaw/Pitch/Mount/Camera3D/memory mount:position")
tracks/0/interp = 2
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 3),
"transitions": PackedFloat32Array(0.366021, 1),
"update": 0,
"values": [Vector3(0.376781, -0.521269, -0.513588), Vector3(0.18, -0.025, -0.309)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("Yaw/Pitch/Mount/Camera3D/memory mount:rotation")
tracks/1/interp = 2
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 3),
"transitions": PackedFloat32Array(1, 0.378929),
"update": 0,
"values": [Vector3(0, -0.698132, 0), Vector3(1.49012e-07, 0, 0)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("Yaw/Pitch/Mount/Camera3D/SpotLight3D:light_energy")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0.8, 3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.0, 0.4]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("Yaw/Pitch/Mount/Camera3D/SpotLight3D2:light_energy")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0.2, 3),
"transitions": PackedFloat32Array(1, 1),
"update": 0,
"values": [0.0, 1.5]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("Yaw/Pitch/Mount/Camera3D/SpotLight3D:visible")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [false, true]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("Yaw/Pitch/Mount/Camera3D/SpotLight3D2:layers")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [1]
}
tracks/6/type = "value"
tracks/6/imported = false
tracks/6/enabled = true
tracks/6/path = NodePath("Yaw/Pitch/Mount/Camera3D/SpotLight3D2:visible")
tracks/6/interp = 1
tracks/6/loop_wrap = true
tracks/6/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [false, true]
}
tracks/7/type = "value"
tracks/7/imported = false
tracks/7/enabled = true
tracks/7/path = NodePath("Yaw/Pitch/Mount/Camera3D/memory mount/old_mask2:visible")
tracks/7/interp = 1
tracks/7/loop_wrap = true
tracks/7/keys = {
"times": PackedFloat32Array(0, 0.1),
"transitions": PackedFloat32Array(1, 1),
"update": 1,
"values": [false, true]
}
[sub_resource type="Animation" id="14"] [sub_resource type="Animation" id="14"]
resource_name = "stand_up" resource_name = "stand_up"
length = 3.0 length = 3.0
@ -95,6 +311,7 @@ tracks/1/keys = {
_data = { _data = {
"RESET": SubResource("11"), "RESET": SubResource("11"),
"crouch": SubResource("12"), "crouch": SubResource("12"),
"mask_reveal": SubResource("Animation_5o0sk"),
"stand_up": SubResource("14") "stand_up": SubResource("14")
} }
@ -126,12 +343,49 @@ collision_mask = 17
collide_with_areas = true collide_with_areas = true
collide_with_bodies = false collide_with_bodies = false
[node name="memory mount" type="Node3D" parent="Yaw/Pitch/Mount/Camera3D"]
transform = Transform3D(0.8, 0, 0, 0, 0.8, -7.15258e-08, 0, 1.1921e-07, 0.48, 0.11067, -0.0251684, -0.309266)
[node name="old_mask2" type="MeshInstance3D" parent="Yaw/Pitch/Mount/Camera3D/memory mount"]
transform = Transform3D(1, 1.75271e-14, 1.74846e-07, -7.10543e-15, 1, -5.96046e-08, -1.74846e-07, 5.96046e-08, 1, 0.0250661, 0, 0)
visible = false
mesh = ExtResource("2_vnej0")
skeleton = NodePath("")
script = SubResource("GDScript_r0b38")
[node name="OmniLight3D" type="OmniLight3D" parent="Yaw/Pitch/Mount/Camera3D/memory mount/old_mask2"]
transform = Transform3D(1, -3.8743e-07, 5.96046e-08, 3.57628e-07, 1, 8.9407e-08, -5.96046e-08, -8.9407e-08, 1, 0.083235, -0.219628, 0.176047)
light_color = Color(0.972549, 0.752941, 0.592157, 1)
light_energy = 0.1
light_specular = 0.0
omni_range = 0.457129
omni_attenuation = 0.659754
[node name="SpotLight3D" type="SpotLight3D" parent="Yaw/Pitch/Mount/Camera3D"]
transform = Transform3D(0.584488, 0.621177, -0.522028, 0.363951, 0.374307, 0.852897, 0.725199, -0.688501, -0.00729993, 0.0601956, 0.21754, -0.271749)
visible = false
light_color = Color(0.97599, 0.669299, 0.509314, 1)
light_energy = 0.4
light_size = 0.1
shadow_enabled = true
spot_range = 0.394683
spot_angle = 27.7927
[node name="SpotLight3D2" type="SpotLight3D" parent="Yaw/Pitch/Mount/Camera3D"]
transform = Transform3D(0.456583, 0.0747244, 0.886537, 0.819566, -0.423063, -0.386432, 0.346185, 0.903014, -0.254405, 0.475638, -0.147216, -0.329875)
visible = false
light_color = Color(0.317647, 0.427451, 1, 1)
light_energy = 1.5
light_size = 0.1
shadow_enabled = true
spot_range = 0.624277
spot_angle = 22.1657
[node name="PlayerCollision" type="CollisionShape3D" parent="."] [node name="PlayerCollision" type="CollisionShape3D" parent="."]
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0.322255, 0) transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0.322255, 0)
shape = SubResource("8") shape = SubResource("8")
[node name="PlayerAnimationPlayer" type="AnimationPlayer" parent="."] [node name="PlayerAnimationPlayer" type="AnimationPlayer" parent="."]
autoplay = "RESET"
libraries = { libraries = {
"": SubResource("AnimationLibrary_xbx3w") "": SubResource("AnimationLibrary_xbx3w")
} }

View File

@ -1,9 +1,9 @@
[gd_scene load_steps=10 format=3 uid="uid://gldtxysavetf"] [gd_scene load_steps=10 format=3 uid="uid://gldtxysavetf"]
[ext_resource type="Texture2D" uid="uid://d0ucjqi8tx6vt" path="res://logic-scenes/startup/start_frame.png" id="1_8giso"] [ext_resource type="Texture2D" uid="uid://d0ucjqi8tx6vt" path="res://import/interface-elements/frame.png" id="1_8giso"]
[ext_resource type="Theme" uid="uid://b056fn288p8ha" path="res://logic-scenes/themes/messy.theme" id="1_b01tw"] [ext_resource type="Theme" uid="uid://b056fn288p8ha" path="res://logic-scenes/themes/messy.theme" id="1_b01tw"]
[ext_resource type="Script" path="res://logic-scenes/startup/volume_sliders.gd" id="3_q2gbh"] [ext_resource type="Script" path="res://logic-scenes/startup/volume_sliders.gd" id="3_q2gbh"]
[ext_resource type="Texture2D" uid="uid://bwicl5q0lw06q" path="res://logic-scenes/startup/start_bottom.png" id="3_s5ssh"] [ext_resource type="Texture2D" uid="uid://bwicl5q0lw06q" path="res://import/interface-elements/bottom.png" id="3_s5ssh"]
[sub_resource type="GDScript" id="GDScript_ia432"] [sub_resource type="GDScript" id="GDScript_ia432"]
script/source = "extends TabContainer script/source = "extends TabContainer

Binary file not shown.

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=8 format=3 uid="uid://befxf8uruwnrl"] [gd_scene load_steps=8 format=3 uid="uid://befxf8uruwnrl"]
[ext_resource type="Texture2D" uid="uid://balmcptv73l2j" path="res://dev-util/menu_background.png" id="1_0oiki"] [ext_resource type="Texture2D" uid="uid://balmcptv73l2j" path="res://dev-util/menu_background.png" id="1_0oiki"]
[ext_resource type="PackedScene" uid="uid://df3ppd08g84f3" path="res://logic-scenes/startup/startup.tscn" id="1_v5rpm"] [ext_resource type="PackedScene" uid="uid://gldtxysavetf" path="res://logic-scenes/startup/startup.tscn" id="1_v5rpm"]
[ext_resource type="PackedScene" uid="uid://b3b0gyvklqn50" path="res://base-environments/youth_room/youth_room.tscn" id="2_23ia3"] [ext_resource type="PackedScene" uid="uid://b3b0gyvklqn50" path="res://base-environments/youth_room/youth_room.tscn" id="2_23ia3"]
[ext_resource type="Theme" uid="uid://b056fn288p8ha" path="res://logic-scenes/themes/messy.theme" id="3_8hrj7"] [ext_resource type="Theme" uid="uid://b056fn288p8ha" path="res://logic-scenes/themes/messy.theme" id="3_8hrj7"]
[ext_resource type="Texture2D" uid="uid://d3ewjumh0b0g6" path="res://logic-scenes/main menu/logo.png" id="4_kslkj"] [ext_resource type="Texture2D" uid="uid://d3ewjumh0b0g6" path="res://logic-scenes/main menu/logo.png" id="4_kslkj"]
@ -23,6 +23,8 @@ texture = ExtResource("1_0oiki")
[node name="Startup Menu" parent="." instance=ExtResource("1_v5rpm")] [node name="Startup Menu" parent="." instance=ExtResource("1_v5rpm")]
visible = false visible = false
[node name="youth room" parent="." instance=ExtResource("2_23ia3")]
[node name="Main Menu" type="Panel" parent="."] [node name="Main Menu" type="Panel" parent="."]
anchors_preset = 15 anchors_preset = 15
anchor_right = 1.0 anchor_right = 1.0
@ -63,7 +65,5 @@ grow_vertical = 2
layout_mode = 2 layout_mode = 2
text = "new Game" text = "new Game"
[node name="youth room" parent="." instance=ExtResource("2_23ia3")]
[connection signal="pressed" from="Main Menu/PanelContainer/Button" to="Main Menu" method="hide"]
[connection signal="pressed" from="Main Menu/PanelContainer/Button" to="youth room" method="start"] [connection signal="pressed" from="Main Menu/PanelContainer/Button" to="youth room" method="start"]
[connection signal="pressed" from="Main Menu/PanelContainer/Button" to="Main Menu" method="hide"]

View File

@ -38,6 +38,14 @@ theme/custom="res://logic-scenes/themes/messy.theme"
[input] [input]
ui_accept={
"deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194309,"physical_keycode":0,"key_label":0,"unicode":4194309,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":4194310,"physical_keycode":0,"key_label":0,"unicode":4194310,"echo":false,"script":null)
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":32,"physical_keycode":0,"key_label":0,"unicode":32,"echo":false,"script":null)
, Object(InputEventJoypadButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"button_index":0,"pressure":0.0,"pressed":true,"script":null)
]
}
player_right={ player_right={
"deadzone": 0.5, "deadzone": 0.5,
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null) "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"echo":false,"script":null)

View File

@ -12,57 +12,54 @@ var allow_skipping: bool = false
var focus_list:Array = [] var focus_list:Array = []
var lock_focus: bool = false var lock_focus: bool = false
func request_focus(new_focus: Node, reclaim_focus: bool = false) -> bool: # Intented for use when me wants focus for itself, can reclaim focus, thus dropping the stack that focused.
func request_focus_for(me: Object, reclaim: bool = false) -> bool:
if reclaim:
focus_list.front().has_focus = false
if focus_list.has(me):
while focus_list.pop_front() != me: break
me.has_focus = true
return me.has_focus
push_warning(me, " wanted to reclaim focus, but was not on list.")
return pass_focus_to(me)
assert(is_instance_valid(new_focus)) # Element no longer wants focus, if Element itself is also dropped, this option can be chosen aswell.
func drop_focus(of:Object, dropObject: bool = false) -> bool:
if lock_focus or get_tree().paused: if lock_focus or get_tree().paused:
push_warning(new_focus.name, " attempted to get focus while tree was paused or fokus had been locked.") push_error(of, " wanted to drop focus while it was locked or tree is paused.")
return false
if not focus_list.size() == 0: _pass_focus_of(focus_list[0]) if not dropObject: of.has_focus = false
if reclaim_focus: focus_list.erase(of)
if focus_list.has(new_focus):
while not focus_list[0] == new_focus: focus_list.pop_front() focus_list.front().has_focus = true
return true
else: return false
focus_list.push_front(new_focus)
push_warning(new_focus.name, " attempted to reclaim focus it did not previousely have.") func get_current_focus(): return focus_list.front()
return true
# Used to put a new target on top of the Focus Stack.
func pass_focus_to(target:Object) -> bool:
if "focus_forward" in target:
pass_focus_to(target.focus_forward)
if lock_focus or get_tree().paused:
push_error(target, " requested focus while it was locked or tree is paused.")
elif !is_instance_valid(target):
push_error("Focus instance not valid")
elif !"has_focus" in target:
push_error(target, " has no has focus method")
else: else:
focus_list.append(new_focus) if not focus_list.front() == null: focus_list.front().has_focus = false
return true target.has_focus = true
if target.has_focus:
focus_list.push_front(target)
assert(focus_list.size() < 100)
return true
return false
func assign_focus_to(focusable: Node) -> bool: # Currently focused element loses focus, but remains in stack.
if "focus_forward" in focusable: func free_focus():
assign_focus_to(focusable.focus_forward) if not focus_list.front() == null: focus_list.front().has_focus = false
if "has_focus" in focusable:
if not focus_list.size() == 0:
_pass_focus_of(focus_list[0])
focusable.has_focus = true
return true
else: return false
func pass_focus_to_unkown(from: Node): func queue_for_focus(target: Object, index: int):
pass focus_list.insert(index, target)
func drop_own_focus(node: Node):
if focus_list[0] == node:
focus_list.pop_front().has_focus = false
assert(focus_list.size() == 0)
focus_list[0].has_focus = true
else:
push_warning(node.name + " attempted to drop focus while not owning it.")
func clear_focus_stack_and_focus_on(focus: Node):
assert(is_instance_valid(focus))
if focus_list.size() > 0: focus_list[0].has_focus = false
focus_list = [focus]
focus.has_focus = true
func _pass_focus_of(previous_focus: Node):
previous_focus.has_focus = false
func focus_cleared(from: Node):
if from == focus_list[0]:
push_warning(from.name, " cleared focus without validating!")