Wall switch action SFX

This commit is contained in:
Rob Kelly 2025-04-02 21:03:36 -06:00
parent dc6ff96ea0
commit 3dc1011c6b
6 changed files with 60 additions and 3 deletions

BIN
assets/sfx/wall_switch.wav Normal file

Binary file not shown.

View File

@ -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

View File

@ -12,6 +12,8 @@ const CLEAN_THRESHOLD := 1400
@onready var light_animation: AnimationPlayer = %LightAnimation @onready var light_animation: AnimationPlayer = %LightAnimation
@onready var gunk_body: GunkBody = %GunkBody @onready var gunk_body: GunkBody = %GunkBody
@onready var interactive: Interactive = %Interactive @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? # 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: func _activate() -> void:
animation_player.play("activate") animation_player.play("activate")
activated.emit() action_sfx.play()
action_delay.start()
# Disable while animation is playing # Disable while animation is playing
interactive.enabled = false 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: func _on_gunk_body_clear_total_updated(clear_total: float) -> void:
if not clean and clear_total >= CLEAN_THRESHOLD: if not clean and clear_total >= CLEAN_THRESHOLD:
_on_clean() _on_clean()
func _on_action_delay_timeout() -> void:
activated.emit()

View File

@ -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="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"] [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="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="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://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"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jtkkw"]
resource_local_to_scene = true resource_local_to_scene = true
@ -300,6 +301,19 @@ script = ExtResource("10_qw6jt")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Interactive" index="0"] [node name="CollisionShape3D" type="CollisionShape3D" parent="Interactive" index="0"]
shape = SubResource("BoxShape3D_6maql") 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="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="clear_total_updated" from="GunkBody" to="." method="_on_gunk_body_clear_total_updated"]
[connection signal="activated" from="Interactive" to="." method="_activate"] [connection signal="activated" from="Interactive" to="." method="_activate"]
[connection signal="timeout" from="ActionDelay" to="." method="_on_action_delay_timeout"]

View File

@ -58,7 +58,7 @@
- [x] spray noises - [x] spray noises
- [ ] switch klaxon - [ ] switch klaxon
- [x] switch OK - [x] switch OK
- [ ] switch activation - [x] switch activation
- [x] bulkhead opening - [x] bulkhead opening
- [x] grunk alarm shriek - [x] grunk alarm shriek
- [ ] grunk relay chitter - [ ] grunk relay chitter

View File

@ -69,4 +69,16 @@
- CC0 - CC0
- retrieved from https://freesound.org/people/audione/sounds/161404/ - retrieved from https://freesound.org/people/audione/sounds/161404/
- assets/sfx/grunk/alarm_screech.wav - 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 - modified