forked from unfa/liblast
Shell casing sounds implemented and some other stuff.
parent
ea643d7a6d
commit
0426c10ca3
|
@ -5,10 +5,13 @@ extends RigidBody
|
|||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
var collisions = 0
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
$CollisionCoarse.disabled = false
|
||||
$CollisionFine.disabled = true
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
|
@ -18,3 +21,20 @@ func _ready():
|
|||
|
||||
func _on_FreeTimer_timeout():
|
||||
queue_free()
|
||||
|
||||
func _on_Casing_body_entered(body):
|
||||
|
||||
$AudioStreamPlayer3D.max_db = max(100 - (linear_velocity.length() * 10), 0)
|
||||
$AudioStreamPlayer3D.pitch_scale = rand_range(0.98, 1.02)
|
||||
print($AudioStreamPlayer3D.max_db)
|
||||
$AudioStreamPlayer3D.play()
|
||||
|
||||
collisions += 1
|
||||
#print("collision: ", String(collisions))
|
||||
|
||||
if collisions == 3:
|
||||
$CollisionCoarse.disabled = true
|
||||
$CollisionFine.disabled = false
|
||||
|
||||
if collisions == 10:
|
||||
queue_free()
|
||||
|
|
|
@ -1,11 +1,16 @@
|
|||
[gd_scene load_steps=5 format=2]
|
||||
[gd_scene load_steps=7 format=2]
|
||||
|
||||
[ext_resource path="res://Assets/Weapons/Handgun/Casing.material" type="Material" id=1]
|
||||
[ext_resource path="res://Assets/Weapons/Handgun/Casing.gd" type="Script" id=2]
|
||||
[ext_resource path="res://Assets/SFX/Collision-ShellCasing.wav" type="AudioStream" id=3]
|
||||
|
||||
[sub_resource type="CylinderShape" id=3]
|
||||
radius = 0.024889
|
||||
height = 0.139563
|
||||
|
||||
[sub_resource type="CylinderShape" id=1]
|
||||
radius = 0.0117538
|
||||
height = 0.0549308
|
||||
radius = 0.1
|
||||
height = 0.5
|
||||
|
||||
[sub_resource type="ArrayMesh" id=2]
|
||||
surfaces/0 = {
|
||||
|
@ -22,20 +27,32 @@ surfaces/0 = {
|
|||
}
|
||||
|
||||
[node name="Casing" type="RigidBody"]
|
||||
mass = 0.2
|
||||
sleeping = true
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 8.58307e-05, 0, 0.000259399 )
|
||||
mass = 0.27
|
||||
contacts_reported = 3
|
||||
contact_monitor = true
|
||||
script = ExtResource( 2 )
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="."]
|
||||
[node name="CollisionFine" type="CollisionShape" parent="."]
|
||||
transform = Transform( -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0, 0, 1, 0, 0, 0 )
|
||||
shape = SubResource( 3 )
|
||||
|
||||
[node name="CollisionCoarse" type="CollisionShape" parent="."]
|
||||
transform = Transform( -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0, 0, 1, -0.000679016, 0, 0.00038147 )
|
||||
shape = SubResource( 1 )
|
||||
disabled = true
|
||||
|
||||
[node name="Casing" type="MeshInstance" parent="."]
|
||||
mesh = SubResource( 2 )
|
||||
material/0 = null
|
||||
|
||||
[node name="FreeTimer" type="Timer" parent="."]
|
||||
wait_time = 15.0
|
||||
wait_time = 10.0
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[node name="AudioStreamPlayer3D" type="AudioStreamPlayer3D" parent="."]
|
||||
stream = ExtResource( 3 )
|
||||
attenuation_filter_cutoff_hz = 20000.0
|
||||
[connection signal="body_entered" from="." to="." method="_on_Casing_body_entered"]
|
||||
[connection signal="timeout" from="FreeTimer" to="." method="_on_FreeTimer_timeout"]
|
||||
|
|
|
@ -68,6 +68,9 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.331868, 0.125291, 0 )
|
|||
[node name="Ejector" parent="Handgun" index="1"]
|
||||
transform = Transform( -1.62921e-07, -1, 0, 1, -1.62921e-07, 0, 0, 0, 1, -0.0373496, 0.126382, -0.00737098 )
|
||||
|
||||
[node name="Shell" parent="Handgun" index="3"]
|
||||
visible = false
|
||||
|
||||
[node name="SoundShoot" type="AudioStreamPlayer3D" parent="."]
|
||||
stream = ExtResource( 3 )
|
||||
|
||||
|
|
|
@ -249,6 +249,12 @@ func _input(event):
|
|||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
|
||||
for i in $Player/Gibs.get_children():
|
||||
print(i)
|
||||
#disabled = true
|
||||
#$"Player/Gibs/PlayerGibs _cell /shape0".set_disabled(true)
|
||||
|
||||
rset_config("translation", MultiplayerAPI.RPC_MODE_SYNC)
|
||||
|
||||
# only show the debug label on local machine
|
||||
|
|
225
Player.tscn
225
Player.tscn
|
@ -193,229 +193,4 @@ visible = false
|
|||
[node name="shape0" parent="Player/Alive/Player /static_collision" index="0"]
|
||||
disabled = true
|
||||
|
||||
[node name="PlayerGibs cell cell " parent="Player/Gibs" index="0"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell cell_001 " parent="Player/Gibs" index="1"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell cell_002 " parent="Player/Gibs" index="2"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_001 " parent="Player/Gibs" index="3"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_003 " parent="Player/Gibs" index="4"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_004 " parent="Player/Gibs" index="5"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_005 " parent="Player/Gibs" index="6"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_006 cell " parent="Player/Gibs" index="7"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_006 cell_001 " parent="Player/Gibs" index="8"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_006 cell_002 " parent="Player/Gibs" index="9"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_007 " parent="Player/Gibs" index="10"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_008 " parent="Player/Gibs" index="11"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_009 cell " parent="Player/Gibs" index="12"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_009 cell_001 " parent="Player/Gibs" index="13"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_009 cell_002 " parent="Player/Gibs" index="14"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_012 " parent="Player/Gibs" index="15"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_013 cell " parent="Player/Gibs" index="16"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_013 cell_001 " parent="Player/Gibs" index="17"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_013 cell_002 " parent="Player/Gibs" index="18"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_014 " parent="Player/Gibs" index="19"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_015 " parent="Player/Gibs" index="20"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_016 " parent="Player/Gibs" index="21"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_017 cell " parent="Player/Gibs" index="22"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_017 cell_001 " parent="Player/Gibs" index="23"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_017 cell_002 " parent="Player/Gibs" index="24"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_018 " parent="Player/Gibs" index="25"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_019 " parent="Player/Gibs" index="26"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_020 " parent="Player/Gibs" index="27"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_021 " parent="Player/Gibs" index="28"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_022 " parent="Player/Gibs" index="29"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_023 " parent="Player/Gibs" index="30"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_024 " parent="Player/Gibs" index="31"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_026 " parent="Player/Gibs" index="32"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_029 " parent="Player/Gibs" index="33"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_030 " parent="Player/Gibs" index="34"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_031 " parent="Player/Gibs" index="35"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_032 " parent="Player/Gibs" index="36"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_033 " parent="Player/Gibs" index="37"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_034 cell " parent="Player/Gibs" index="38"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_034 cell_001 " parent="Player/Gibs" index="39"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_034 cell_002 " parent="Player/Gibs" index="40"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_035 " parent="Player/Gibs" index="41"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_037 " parent="Player/Gibs" index="42"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_038 " parent="Player/Gibs" index="43"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_039 " parent="Player/Gibs" index="44"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_041 " parent="Player/Gibs" index="45"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_043 cell " parent="Player/Gibs" index="46"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_043 cell_001 " parent="Player/Gibs" index="47"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_043 cell_002 " parent="Player/Gibs" index="48"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_044 " parent="Player/Gibs" index="49"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_045 cell " parent="Player/Gibs" index="50"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_045 cell_001 " parent="Player/Gibs" index="51"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_045 cell_002 " parent="Player/Gibs" index="52"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_046 " parent="Player/Gibs" index="53"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_048 " parent="Player/Gibs" index="54"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_049 " parent="Player/Gibs" index="55"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_051 " parent="Player/Gibs" index="56"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_052 cell " parent="Player/Gibs" index="57"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_052 cell_001 " parent="Player/Gibs" index="58"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_053 cell " parent="Player/Gibs" index="59"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_053 cell_001 " parent="Player/Gibs" index="60"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_053 cell_002 " parent="Player/Gibs" index="61"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_054 cell " parent="Player/Gibs" index="62"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_054 cell_001 " parent="Player/Gibs" index="63"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_054 cell_002 " parent="Player/Gibs" index="64"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_055 " parent="Player/Gibs" index="65"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_056 " parent="Player/Gibs" index="66"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_057 " parent="Player/Gibs" index="67"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_058 " parent="Player/Gibs" index="68"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_059 " parent="Player/Gibs" index="69"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_060 " parent="Player/Gibs" index="70"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_062 " parent="Player/Gibs" index="71"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_063 " parent="Player/Gibs" index="72"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_064 " parent="Player/Gibs" index="73"]
|
||||
sleeping = true
|
||||
|
||||
[node name="PlayerGibs cell_065 " parent="Player/Gibs" index="74"]
|
||||
sleeping = true
|
||||
|
||||
[editable path="Player"]
|
||||
|
|
Loading…
Reference in New Issue