summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortpart <tpart120@proton.me>2024-08-11 00:56:35 +0200
committertpart <tpart120@proton.me>2024-08-11 00:56:35 +0200
commitdc5b63e0ec6aa78ace72ef16ea699eafe6b87dbd (patch)
treeabb856a093f533b5b0236467db5b8fc78a294725
parentf98485284b6e3cac9bb3dc4243fd83fb810bcb39 (diff)
downloadhurrycurry-dc5b63e0ec6aa78ace72ef16ea699eafe6b87dbd.tar
hurrycurry-dc5b63e0ec6aa78ace72ef16ea699eafe6b87dbd.tar.bz2
hurrycurry-dc5b63e0ec6aa78ace72ef16ea699eafe6b87dbd.tar.zst
Fix: Input still not being disabled occasionally in lobby
-rw-r--r--client/menu/game.gd5
-rw-r--r--client/player/follow_camera.gd23
2 files changed, 17 insertions, 11 deletions
diff --git a/client/menu/game.gd b/client/menu/game.gd
index 2b837721..6eb87b16 100644
--- a/client/menu/game.gd
+++ b/client/menu/game.gd
@@ -32,9 +32,8 @@ func _input(_event):
open_ingame_menu()
func _menu_cover(state):
- if state == false and game.in_lobby:
- return
- game.camera.disable_input = state
+ game.camera.disable_input_menu = state
+ game.camera.update_disable_input()
func _process(_delta):
if Global.get_setting("debug_info"):
diff --git a/client/player/follow_camera.gd b/client/player/follow_camera.gd
index 41f99d97..516b1ba1 100644
--- a/client/player/follow_camera.gd
+++ b/client/player/follow_camera.gd
@@ -43,7 +43,11 @@ var angle_up: float = 1
var ground: Vector3
var camera_distance: float = 10.
var camera_distance_target: float = camera_distance
-var disable_input := false
+
+var disable_input_menu := false
+var disable_input_lobby := false
+
+var _disable_input := false
func _ready():
if target == null:
@@ -56,7 +60,7 @@ func _process(delta):
follow(delta)
func _input(_event):
- if disable_input: return
+ if _disable_input: return
if Input.is_action_just_pressed("reset"):
reset()
@@ -66,12 +70,12 @@ func reset():
camera_distance_target = 10
func follow(delta):
- if not disable_input: angle_target += Input.get_axis("rotate_left", "rotate_right") * (
+ if not _disable_input: angle_target += Input.get_axis("rotate_left", "rotate_right") * (
ROTATE_SPEED * delta * (-1 if Global.get_setting("invert_camera") else 1)
)
angle = G.interpolate_angle(angle, angle_target, delta * ROTATE_WEIGHT)
- if not disable_input: angle_up_target += Input.get_axis("rotate_down", "rotate_up") * (
+ if not _disable_input: angle_up_target += Input.get_axis("rotate_down", "rotate_up") * (
ROTATE_UP_SPEED * delta * (-1 if Global.get_setting("invert_camera") else 1)
)
angle_up_target = clamp(angle_up_target, ANGLE_UP_MIN, ANGLE_UP_MAX)
@@ -95,7 +99,7 @@ func follow(delta):
# add 0.5, this is the head height
ground = G.interpolate(ground, target.position + Vector3(0., 0.5, 0.), delta * MOVE_WEIGHT)
- if not disable_input:
+ if not _disable_input:
var zoom_dist = Input.get_axis("zoom_in", "zoom_out") * delta
zoom_dist += float(Input.is_action_just_pressed("zoom_out_discrete")) * DISCRETE_DURATION
zoom_dist -= float(Input.is_action_just_pressed("zoom_in_discrete")) * DISCRETE_DURATION
@@ -110,7 +114,10 @@ func set_ingame(state: bool, in_lobby: bool):
# Disable input in lobby
if state and in_lobby:
reset()
- disable_input = true
+ disable_input_lobby = true
else:
- disable_input = false
-
+ disable_input_lobby = false
+ update_disable_input()
+
+func update_disable_input():
+ _disable_input = disable_input_lobby or disable_input_menu