Added spread for weapons
This commit is contained in:
@ -99,6 +99,7 @@ func _add_first_view_model() -> Error :
|
||||
# Define a format string with placeholder '%s'
|
||||
var path_tmpl := "res://scenes/weapon/guns/%s/with_hands.tscn"
|
||||
var path := path_tmpl % current_gun
|
||||
print(path)
|
||||
if not ResourceLoader.exists(path):
|
||||
return ERR_DOES_NOT_EXIST
|
||||
var scene: PackedScene = ResourceLoader.load(path)
|
||||
@ -168,7 +169,7 @@ var jump_vel: Vector3 # Jumping velocity
|
||||
@export_range(0.1, 3.0, 0.1) var jump_height: float = 1 # m
|
||||
@export_range(0.1, 3.0, 0.1, "or_greater") var camera_sens: float = 1
|
||||
|
||||
|
||||
var is_shooting: bool = false
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if _is_current_player():
|
||||
if event is InputEventMouseMotion:
|
||||
@ -176,7 +177,10 @@ func _unhandled_input(event: InputEvent) -> void:
|
||||
if mouse_captured: _rotate_camera()
|
||||
#if Input.is_action_just_pressed("jump"): jumping = true
|
||||
if Input.is_action_just_pressed("exit"): get_tree().quit()
|
||||
if Input.is_action_pressed("shot"): _shoot()
|
||||
if Input.is_action_pressed("shot"): is_shooting = true
|
||||
if Input.is_action_just_released("shot"):
|
||||
is_shooting = false
|
||||
gun_with_hands.reset_spread()
|
||||
#if str($"..".name).to_int() == multiplayer.get_unique_id():
|
||||
#if Input.is_action_just_pressed("shot"): $UpperTorso/ViewModelCamera.shot()
|
||||
#if Input.is_action_just_pressed("reload"): $Body/UpperTorso/CameraMount/Camera.reload()
|
||||
@ -201,6 +205,8 @@ func _process(delta: float) -> void:
|
||||
model.reparent(get_tree().get_root())
|
||||
model.die()
|
||||
queue_free()
|
||||
if is_shooting == true:
|
||||
_shoot()
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
|
Reference in New Issue
Block a user