This commit is contained in:
veclavtalica 2025-02-14 12:34:43 +03:00
parent 1132015349
commit 1e5f6990ad
9 changed files with 76 additions and 7 deletions

2
assets/sfx/LICENSES Normal file
View File

@ -0,0 +1,2 @@
land.wav - https://opengameart.org/content/3-item-sounds - CC-BY 3.0
coinsplash.ogg - https://opengameart.org/content/coin-splash - No Rights Reserved

BIN
assets/sfx/coinsplash.ogg Normal file

Binary file not shown.

View File

@ -0,0 +1,19 @@
[remap]
importer="oggvorbisstr"
type="AudioStreamOggVorbis"
uid="uid://dkxv7wbq8s1gs"
path="res://.godot/imported/coinsplash.ogg-f4cc7a136a244c66d0c3ed8863b3a3e6.oggvorbisstr"
[deps]
source_file="res://assets/sfx/coinsplash.ogg"
dest_files=["res://.godot/imported/coinsplash.ogg-f4cc7a136a244c66d0c3ed8863b3a3e6.oggvorbisstr"]
[params]
loop=false
loop_offset=0
bpm=0
beat_count=0
bar_beats=4

BIN
assets/sfx/land.wav Normal file

Binary file not shown.

View File

@ -0,0 +1,24 @@
[remap]
importer="wav"
type="AudioStreamWAV"
uid="uid://dy3ngeohp1uqf"
path="res://.godot/imported/land.wav-6f339f0cb8abb44d119c317df4f4b636.sample"
[deps]
source_file="res://assets/sfx/land.wav"
dest_files=["res://.godot/imported/land.wav-6f339f0cb8abb44d119c317df4f4b636.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=0

View File

@ -1,7 +1,6 @@
[gd_resource type="AudioBusLayout" format=3 uid="uid://dcxpomrfumov"]
[resource]
bus/0/mute = true
bus/1/name = &"Music"
bus/1/solo = false
bus/1/mute = false

View File

@ -1,7 +1,9 @@
class_name Bomb extends Node3D
# TODO: have those in item db instead ?
@export var _splash_small_sound: AudioStreamPlayer3D
@export var _splash_small_quiet_sound: AudioStreamPlayer3D
@export var _sell_sound: AudioStreamPlayer3D
@export var _model: Node3D
@export var _splash_particles: GPUParticles3D
@export var _picking_area: Area3D
@ -11,8 +13,9 @@ class_name Bomb extends Node3D
## Initials to construct from
@export var item_id := &"ID"
@export var item_count := 0
## Will be constructed as { item_id, item_count }, but could be edited after
## Use init_with_bundle() if it's dynamically assigned
## Use set_item_bundle() if it's dynamically assigned, after adding to the scene
@export var item_bundle: Dictionary
## Effect of splhashing.
@ -81,6 +84,12 @@ func _on_body_entered(p_body: Node3D) -> void:
var item := GameState.fetch().INVENTORY_ITEM_DB[item_bundle["item_id"]] as InventoryItem
if item.sells_for != 0:
get_node("/root/Main").add_inventory_item.rpc(&"coin", item.sells_for * item_bundle["count"])
if _sell_sound != null:
_sell_sound.play()
is_dead = true
_model.hide()
_disable_body.rpc()
await _sell_sound.finished
queue_free()
return
@ -88,7 +97,7 @@ func _on_body_entered(p_body: Node3D) -> void:
for area: Area3D in _in_splash_range:
area.get_parent_node_3d().water.rpc_id(1, sender_id)
if _splash_small_sound != null:
if _splash_small_sound != null and sender_id != 0:
_splash_small_sound.play()
if _splash_small_quiet_sound:
_splash_small_quiet_sound.play()
@ -98,10 +107,12 @@ func _on_body_entered(p_body: Node3D) -> void:
is_dead = true
_model.hide()
_disable_body.rpc()
if _splash_small_sound != null:
if _splash_small_sound != null and sender_id != 0:
await _splash_small_sound.finished
if _splash_small_quiet_sound != null and _splash_small_quiet_sound.playing:
await _splash_small_quiet_sound.finished
queue_free()

View File

@ -1,7 +1,9 @@
[gd_scene load_steps=9 format=3 uid="uid://bpvbnlhpth4w7"]
[gd_scene load_steps=11 format=3 uid="uid://bpvbnlhpth4w7"]
[ext_resource type="Script" path="res://src/ingame/bomb.gd" id="1_27lur"]
[ext_resource type="PackedScene" uid="uid://dxb5f3il2h1ur" path="res://src/ingame/quad_viewmodel.tscn" id="2_fy6j6"]
[ext_resource type="AudioStream" uid="uid://dy3ngeohp1uqf" path="res://assets/sfx/land.wav" id="3_1vo65"]
[ext_resource type="AudioStream" uid="uid://dkxv7wbq8s1gs" path="res://assets/sfx/coinsplash.ogg" id="4_fyu6c"]
[sub_resource type="SceneReplicationConfig" id="SceneReplicationConfig_0ebrr"]
properties/0/path = NodePath(".:position")
@ -41,8 +43,10 @@ radius = 0.2
[sub_resource type="SphereShape3D" id="SphereShape3D_y6453"]
radius = 1.5
[node name="ItemBomb" type="Node3D" node_paths=PackedStringArray("_model", "_picking_area", "body")]
[node name="ItemBomb" type="Node3D" node_paths=PackedStringArray("_splash_small_sound", "_sell_sound", "_model", "_picking_area", "body")]
script = ExtResource("1_27lur")
_splash_small_sound = NodePath("DropSound")
_sell_sound = NodePath("SellSound")
_model = NodePath("Model")
_picking_area = NodePath("PickingArea")
body = NodePath("RigidBody3D")
@ -93,6 +97,16 @@ monitoring = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="PickingArea"]
shape = SubResource("SphereShape3D_6c830")
[node name="DropSound" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource("3_1vo65")
volume_db = 10.0
bus = &"SoundEffects"
[node name="SellSound" type="AudioStreamPlayer3D" parent="."]
stream = ExtResource("4_fyu6c")
volume_db = 2.0
bus = &"SoundEffects"
[connection signal="body_entered" from="RigidBody3D" to="." method="_on_body_entered"]
[connection signal="area_entered" from="RigidBody3D/SplashArea" to="." method="_on_splash_area_entered"]
[connection signal="area_exited" from="RigidBody3D/SplashArea" to="." method="_on_splash_area_exited"]

View File

@ -27,7 +27,7 @@ mesh = SubResource("PlaneMesh_g3bb5")
[node name="ProjectileHolder" type="Node" parent="."]
[node name="DropTimer" type="Timer" parent="."]
wait_time = 2.0
wait_time = 2.5
autostart = true
[connection signal="timeout" from="DropTimer" to="." method="_on_drop_timer_timeout"]