diff --git a/assets/sfx/wall_switch.wav b/assets/sfx/wall_switch.wav new file mode 100644 index 0000000..3e24514 Binary files /dev/null and b/assets/sfx/wall_switch.wav differ diff --git a/assets/sfx/wall_switch.wav.import b/assets/sfx/wall_switch.wav.import new file mode 100644 index 0000000..fbe5920 --- /dev/null +++ b/assets/sfx/wall_switch.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://cnje66wrijwxw" +path="res://.godot/imported/wall_switch.wav-e47e5727c2106a3c962a073b6d4d5240.sample" + +[deps] + +source_file="res://assets/sfx/wall_switch.wav" +dest_files=["res://.godot/imported/wall_switch.wav-e47e5727c2106a3c962a073b6d4d5240.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=2 diff --git a/src/props/wall_switch/wall_switch.gd b/src/props/wall_switch/wall_switch.gd index a1585bc..d777e48 100644 --- a/src/props/wall_switch/wall_switch.gd +++ b/src/props/wall_switch/wall_switch.gd @@ -12,6 +12,8 @@ const CLEAN_THRESHOLD := 1400 @onready var light_animation: AnimationPlayer = %LightAnimation @onready var gunk_body: GunkBody = %GunkBody @onready var interactive: Interactive = %Interactive +@onready var action_sfx: AudioStreamPlayer3D = %ActionSFX +@onready var action_delay: Timer = %ActionDelay # XXX I must have been smoking crack when I wrote this logic. Why so complicated? @@ -62,7 +64,8 @@ func _on_clean() -> void: func _activate() -> void: animation_player.play("activate") - activated.emit() + action_sfx.play() + action_delay.start() # Disable while animation is playing interactive.enabled = false @@ -75,3 +78,7 @@ func _animation_finished(anim_name: StringName) -> void: func _on_gunk_body_clear_total_updated(clear_total: float) -> void: if not clean and clear_total >= CLEAN_THRESHOLD: _on_clean() + + +func _on_action_delay_timeout() -> void: + activated.emit() diff --git a/src/props/wall_switch/wall_switch.tscn b/src/props/wall_switch/wall_switch.tscn index e29d546..60235a9 100644 --- a/src/props/wall_switch/wall_switch.tscn +++ b/src/props/wall_switch/wall_switch.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=29 format=4 uid="uid://b6eg8t04rkh0c"] +[gd_scene load_steps=30 format=4 uid="uid://b6eg8t04rkh0c"] [ext_resource type="Script" uid="uid://bkmn5m47mt1gh" path="res://src/props/wall_switch/wall_switch.gd" id="2_kfvqd"] [ext_resource type="Texture2D" uid="uid://1wjcyqynwlb6" path="res://assets/props/wall_switch/wall_switch_C.png" id="2_vufqs"] @@ -11,6 +11,7 @@ [ext_resource type="FastNoiseLite" uid="uid://cnlvdtx68giv6" path="res://assets/materials/gunk_noise.tres" id="9_7shuc"] [ext_resource type="Script" uid="uid://deg5xd87cy8rg" path="res://src/props/interactive.gd" id="10_qw6jt"] [ext_resource type="AudioStream" uid="uid://bgayfws34lg7q" path="res://assets/sfx/click_electronic_04.wav" id="11_7shuc"] +[ext_resource type="AudioStream" uid="uid://cnje66wrijwxw" path="res://assets/sfx/wall_switch.wav" id="12_2qpft"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jtkkw"] resource_local_to_scene = true @@ -300,6 +301,19 @@ script = ExtResource("10_qw6jt") [node name="CollisionShape3D" type="CollisionShape3D" parent="Interactive" index="0"] shape = SubResource("BoxShape3D_6maql") +[node name="ActionSFX" type="AudioStreamPlayer3D" parent="." index="5"] +unique_name_in_owner = true +stream = ExtResource("12_2qpft") +volume_db = -12.0 +unit_size = 3.0 +bus = &"SFX" + +[node name="ActionDelay" type="Timer" parent="." index="6"] +unique_name_in_owner = true +wait_time = 2.8 +one_shot = true + [connection signal="animation_finished" from="AnimationPlayer" to="." method="_animation_finished"] [connection signal="clear_total_updated" from="GunkBody" to="." method="_on_gunk_body_clear_total_updated"] [connection signal="activated" from="Interactive" to="." method="_activate"] +[connection signal="timeout" from="ActionDelay" to="." method="_on_action_delay_timeout"] diff --git a/vault/TODO.md b/vault/TODO.md index 68d85f6..4a76d1d 100644 --- a/vault/TODO.md +++ b/vault/TODO.md @@ -58,7 +58,7 @@ - [x] spray noises - [ ] switch klaxon - [x] switch OK - - [ ] switch activation + - [x] switch activation - [x] bulkhead opening - [x] grunk alarm shriek - [ ] grunk relay chitter diff --git a/vault/assets/asset credits.md b/vault/assets/asset credits.md index fb2c96f..90b16ac 100644 --- a/vault/assets/asset credits.md +++ b/vault/assets/asset credits.md @@ -69,4 +69,16 @@ - CC0 - retrieved from https://freesound.org/people/audione/sounds/161404/ - assets/sfx/grunk/alarm_screech.wav + - modified + - "Breaker-1.wav" + - author: Deathscyp + - CC0 + - retrieved from https://freesound.org/people/Deathscyp/sounds/404049/ + - assets/sfx/wall_switch.wav + - modified + - "Pulling a lever.mp3" + - author: A_Kuha + - CC0 + - retrieved from https://freesound.org/people/A_Kuha/sounds/676412/ + - assets/sfx/wall_switch.wav - modified \ No newline at end of file