Made GrenadeLauncher into an unstoppable machinegun temporarily.

remotes/1699310152913738325/tmp_refs/heads/legacy
unfa 2021-04-22 00:01:45 +02:00
parent 9e9ea5ef4a
commit 23cbe81176
6 changed files with 32 additions and 29 deletions

View File

@ -24,9 +24,15 @@ size = Vector2( 0.3, 0.3 )
[node name="Weapon" type="Spatial"]
script = ExtResource( 2 )
Delay = 0.05
Automatic = true
Rounds = 100
[node name="Model" parent="." instance=ExtResource( 1 )]
[node name="Static" parent="Model/Handgun_Armature/Skeleton" index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00201946, 5.96046e-08, -0.000467896 )
[node name="Effects" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, -0.68988, 0.110679, 0 )
@ -64,29 +70,14 @@ script = ExtResource( 3 )
[node name="A" parent="Sounds/Shoot" instance=ExtResource( 7 )]
SoundClip = "res://Assets/Audio/SFX/Weapons_Handgun_Shot_01_A.wav"
AutoPlay = false
MinimumRandomDistance = 0.35
PlayUntilEnd = false
MinDelay = 0.0
PitchScale = 1.0
RandomizePitch = 0.05
[node name="B" parent="Sounds/Shoot" instance=ExtResource( 7 )]
SoundClip = "res://Assets/Audio/SFX/Weapons_Handgun_Shot_01_B.wav"
AutoPlay = false
MinimumRandomDistance = 0.35
PlayUntilEnd = false
MinDelay = 0.0
PitchScale = 1.0
RandomizePitch = 0.05
[node name="C" parent="Sounds/Shoot" instance=ExtResource( 7 )]
SoundClip = "res://Assets/Audio/SFX/Weapons_Handgun_Shot_01_C.wav"
AutoPlay = false
MinimumRandomDistance = 0.35
PlayUntilEnd = false
MinDelay = 0.0
PitchScale = 1.0
RandomizePitch = 0.05
[editable path="Model"]

View File

@ -373,11 +373,11 @@ sync func unset_death():
$HUD/Crosshair.modulate = Color(1,1,1,1)
camera.fov = FOV_NORMAL
func shoot():
func shoot(trigger_held):
# The underscore indicates an unused variable.
# Because it is declared in this scope, it will disappear as soon as the
# function returns. As is, it exists solely to catch the return value of shoot().
var _remaining_ammo = active_weapon.shoot($Camera)
var _remaining_ammo = active_weapon.shoot($Camera, true, trigger_held)
func reload():
active_weapon.reload()
@ -417,9 +417,11 @@ func _unhandled_input(event):
# Weapon
if event.is_action_pressed("WeaponPrimary") and camera.fov == FOV_NORMAL:
shoot()
shoot(true)
if event.is_action_pressed("WeaponReload"):
reload()
if event.is_action_released("WeaponPrimary") or camera.fov != FOV_NORMAL:
shoot(false)
if event.is_action_pressed("WeaponNext"):
rpc("switch_to_next_weapon")

View File

@ -223,7 +223,7 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.53592, -0.0651628 )
[node name="ZoomTween" type="Tween" parent="Camera"]
[node name="Hand" type="Spatial" parent="Camera"]
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.335, -0.399841, -0.559 )
transform = Transform( -4.37114e-08, 0, -1, 0, 1, 0, 1, 0, -4.37114e-08, 0.335, -0.398982, -0.559 )
[node name="WeaponBobAnimationTree" type="AnimationTree" parent="Camera/Hand"]
tree_root = SubResource( 12 )

View File

@ -3,14 +3,11 @@ extends Spatial
signal damage_dealt(kill)
signal ammo_changed(weapon)
export(bool) var Hitscan = false
export(bool) var Hitscan = true
export(int) var Damage = 100
export(float) var Delay = 0.1
export(bool) var Automatic = false
export(int) var Rounds = 10
export(int) var MaxRoundsInClip = 10
export(int) var Clips = 1
export(int) var MaxClips = 4
onready var camera = get_parent().get_parent().get_parent()
onready var player = camera.get_parent()
@ -34,10 +31,11 @@ func _ready():
func switched_to_weapon():
emit_signal("ammo_changed", self)
func shoot(camera):
if cached_fire == true:
return
func shoot(camera, primary, trigger_held):
if not Automatic:
if cached_fire == true:
return
if currently_fireing == true:
cached_fire = true
yield($Model/AnimationPlayer, "animation_finished")
@ -46,7 +44,7 @@ func shoot(camera):
currently_fireing = true
cached_fire = false
if current_rounds > 0:
while current_rounds > 0 and trigger_held:
rpc("fire_weapon", current_rounds)
rpc("compute_bullet_flyby")
@ -80,7 +78,13 @@ func shoot(camera):
#print(get_signal_connection_list("ammo_changed")[0]["target"].name)
emit_signal("ammo_changed", self)
else:
if not Automatic:
break
else:
yield(get_tree().create_timer(Delay),"timeout")
if current_rounds == 0:
reload()
return current_rounds

View File

@ -155,6 +155,8 @@ Voice_Count = 2
[node name="AudioStreamPlayer3D" parent="Sounds/Shoot/C" index="0"]
unit_db = -3.0
[editable path="Model"]
[editable path="Sounds/Shoot/A"]
[editable path="Sounds/Shoot/B"]

View File

@ -318,6 +318,9 @@ theme = ExtResource( 1 )
[node name="PlayerList" type="VBoxContainer" parent="PlayerListContainer/Panel"]
theme = ExtResource( 1 )
alignment = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="TextChat" parent="." instance=ExtResource( 6 )]
visible = false
@ -345,6 +348,7 @@ margin_bottom = -80.5416
[connection signal="value_changed" from="MenuContainer/ControlsMenu/HBoxContainer/SensitivitySlider" to="." method="set_mouse_sensitivity"]
[connection signal="pressed" from="MenuContainer/GraphicsMenu/Back" to="." method="return_to_menu" binds= [ "OptionsMenu" ]]
[connection signal="toggled" from="MenuContainer/GraphicsMenu/Fullscreen" to="." method="set_fullscreen"]
[connection signal="draw" from="PlayerListContainer" to="." method="_on_PlayerListContainer_draw"]
[connection signal="typing_toggled" from="TextChat" to="." method="_on_TextChat_typing_toggled"]
[editable path="MenuContainer/CharacterSelectScreen"]