feat: change camera rotation to be always active when mouse is captured
All checks were successful
Deploy Promiscuity Auth API / deploy (push) Successful in 1m0s
Deploy Promiscuity Character API / deploy (push) Successful in 1m1s
Deploy Promiscuity Crafting API / deploy (push) Successful in 1m0s
Deploy Promiscuity Inventory API / deploy (push) Successful in 1m0s
Deploy Promiscuity Locations API / deploy (push) Successful in 1m0s
Deploy Promiscuity Mail API / deploy (push) Successful in 1m1s
Deploy Promiscuity World API / deploy (push) Successful in 1m1s
k8s smoke test / test (push) Successful in 21s

This commit is contained in:
null 2026-05-12 17:19:34 -05:00
parent 2907fabe85
commit ffee63dc57
4 changed files with 17 additions and 22 deletions

View File

@ -19,7 +19,6 @@ const FIREBALL_SPAWN_UP_OFFSET := 1.2
var mouse_sensitivity := 0.005 var mouse_sensitivity := 0.005
var rotation_x := 0.0 var rotation_x := 0.0
var rotation_y := 0.0 var rotation_y := 0.0
var cameraMoveMode := false
var current_number_of_jumps := 0 var current_number_of_jumps := 0
var _pending_mouse_delta := Vector2.ZERO var _pending_mouse_delta := Vector2.ZERO
var _last_move_forward := Vector3(0, 0, 1) var _last_move_forward := Vector3(0, 0, 1)
@ -86,12 +85,13 @@ func _ready() -> void:
_last_move_right = right.normalized() _last_move_right = right.normalized()
_vehicle_collision_layer = collision_layer _vehicle_collision_layer = collision_layer
_vehicle_collision_mask = collision_mask _vehicle_collision_mask = collision_mask
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _integrate_forces(state): func _integrate_forces(state):
if _in_vehicle: if _in_vehicle:
linear_velocity = Vector3.ZERO linear_velocity = Vector3.ZERO
return return
if cameraMoveMode and _pending_mouse_delta != Vector2.ZERO: if _pending_mouse_delta != Vector2.ZERO:
rotation_x -= _pending_mouse_delta.y * mouse_sensitivity rotation_x -= _pending_mouse_delta.y * mouse_sensitivity
rotation_y -= _pending_mouse_delta.x * mouse_sensitivity rotation_y -= _pending_mouse_delta.x * mouse_sensitivity
rotation_x = clamp(rotation_x, deg_to_rad(-90), deg_to_rad(90)) rotation_x = clamp(rotation_x, deg_to_rad(-90), deg_to_rad(90))
@ -156,20 +156,16 @@ func _input(event):
phone_visible = !phone_visible phone_visible = !phone_visible
if phone: if phone:
phone.visible = phone_visible phone.visible = phone_visible
if phone_visible:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
else:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
return return
if _in_vehicle: if _in_vehicle:
return return
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_MIDDLE:
if event.pressed:
cameraMoveMode = true
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
else:
cameraMoveMode = false
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
if event is InputEventMouseMotion and cameraMoveMode: if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
_pending_mouse_delta += event.relative _pending_mouse_delta += event.relative
if event is InputEventMouseButton and event.pressed: if event is InputEventMouseButton and event.pressed:

View File

@ -17,8 +17,10 @@ func _toggle_menu():
# Center the menu on the mouse or screen # Center the menu on the mouse or screen
global_position = get_viewport().get_mouse_position() global_position = get_viewport().get_mouse_position()
_animate_menu(true) _animate_menu(true)
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
else: else:
_animate_menu(false) _animate_menu(false)
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _arrange_buttons(): func _arrange_buttons():
var buttons = get_children().filter(func(child): return child is Control) var buttons = get_children().filter(func(child): return child is Control)

View File

@ -10,6 +10,7 @@ const PLAYGROUND_SCENE := "res://scenes/Levels/level.tscn"
func _ready(): func _ready():
_register_focus_sounds() _register_focus_sounds()
_update_login_button() _update_login_button()
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
func _register_focus_sounds() -> void: func _register_focus_sounds() -> void:
var button_container := $MarginContainer/CenterContainer/ContentVBox/VBoxContainer var button_container := $MarginContainer/CenterContainer/ContentVBox/VBoxContainer

View File

@ -19,7 +19,6 @@ const FIREBALL_SPAWN_UP_OFFSET := 1.2
var mouse_sensitivity := 0.005 var mouse_sensitivity := 0.005
var rotation_x := 0.0 var rotation_x := 0.0
var rotation_y := 0.0 var rotation_y := 0.0
var cameraMoveMode := false
var current_number_of_jumps := 0 var current_number_of_jumps := 0
var _pending_mouse_delta := Vector2.ZERO var _pending_mouse_delta := Vector2.ZERO
var _last_move_forward := Vector3(0, 0, 1) var _last_move_forward := Vector3(0, 0, 1)
@ -86,12 +85,13 @@ func _ready() -> void:
_last_move_right = right.normalized() _last_move_right = right.normalized()
_vehicle_collision_layer = collision_layer _vehicle_collision_layer = collision_layer
_vehicle_collision_mask = collision_mask _vehicle_collision_mask = collision_mask
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
func _integrate_forces(state): func _integrate_forces(state):
if _in_vehicle: if _in_vehicle:
linear_velocity = Vector3.ZERO linear_velocity = Vector3.ZERO
return return
if cameraMoveMode and _pending_mouse_delta != Vector2.ZERO: if _pending_mouse_delta != Vector2.ZERO:
rotation_x -= _pending_mouse_delta.y * mouse_sensitivity rotation_x -= _pending_mouse_delta.y * mouse_sensitivity
rotation_y -= _pending_mouse_delta.x * mouse_sensitivity rotation_y -= _pending_mouse_delta.x * mouse_sensitivity
rotation_x = clamp(rotation_x, deg_to_rad(-90), deg_to_rad(90)) # Prevent flipping rotation_x = clamp(rotation_x, deg_to_rad(-90), deg_to_rad(90)) # Prevent flipping
@ -164,20 +164,16 @@ func _input(event):
phone_visible = !phone_visible phone_visible = !phone_visible
if phone: if phone:
phone.visible = phone_visible phone.visible = phone_visible
if phone_visible:
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
else:
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
return return
if _in_vehicle: if _in_vehicle:
return return
if event is InputEventMouseButton:
if event.button_index == MOUSE_BUTTON_MIDDLE:
if event.pressed:
cameraMoveMode = true
Input.set_mouse_mode(Input.MOUSE_MODE_CAPTURED)
else:
cameraMoveMode = false
Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE)
if event is InputEventMouseMotion and cameraMoveMode: if event is InputEventMouseMotion and Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED:
_pending_mouse_delta += event.relative _pending_mouse_delta += event.relative
if event is InputEventMouseButton and event.pressed: if event is InputEventMouseButton and event.pressed: