fix: scoping
This commit is contained in:
+10
-4
@@ -76,16 +76,22 @@ func _process(delta: float) -> void:
|
||||
super._process(delta)
|
||||
|
||||
if camera:
|
||||
if Input.is_action_just_pressed("fire_alt"):
|
||||
is_ads = not is_ads
|
||||
target_fov = ads_fov if is_ads else default_fov
|
||||
|
||||
camera.fov = lerpf(camera.fov, target_fov, 15.0 * delta)
|
||||
|
||||
# Move model slightly based on ADS
|
||||
var target_pos = Vector3(0.0, -0.15, -0.6) if is_ads else Vector3(0.3, -0.3, -0.8)
|
||||
position = position.lerp(target_pos, 15.0 * delta)
|
||||
|
||||
func _input(event: InputEvent) -> void:
|
||||
super._input(event)
|
||||
|
||||
if Input.get_mouse_mode() != Input.MOUSE_MODE_CAPTURED:
|
||||
return
|
||||
|
||||
if event.is_action_pressed("fire_alt"):
|
||||
is_ads = not is_ads
|
||||
target_fov = ads_fov if is_ads else default_fov
|
||||
|
||||
func _start_reload() -> void:
|
||||
super._start_reload()
|
||||
is_ads = false # Drop out of ADS on reload
|
||||
|
||||
@@ -64,6 +64,9 @@ func _build_model() -> void:
|
||||
func _process(delta: float) -> void:
|
||||
super._process(delta)
|
||||
|
||||
if not visible:
|
||||
return
|
||||
|
||||
if camera:
|
||||
is_targeting = Input.is_action_pressed("fire_alt")
|
||||
targeting_laser.visible = is_targeting
|
||||
|
||||
Reference in New Issue
Block a user