Fix scroll wheel zoom, persist zoom, consolidate player scripts, and migrate GEMINI.md to .agents/AGENTS.md
Deploy Promiscuity Auth API / deploy (push) Successful in 1m23s
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 1m1s
Deploy Promiscuity Locations API / deploy (push) Successful in 1m2s
Deploy Promiscuity Mail API / deploy (push) Successful in 1m2s
Deploy Promiscuity World API / deploy (push) Successful in 59s
k8s smoke test / test (push) Successful in 20s
Deploy Promiscuity Auth API / deploy (push) Successful in 1m23s
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 1m1s
Deploy Promiscuity Locations API / deploy (push) Successful in 1m2s
Deploy Promiscuity Mail API / deploy (push) Successful in 1m2s
Deploy Promiscuity World API / deploy (push) Successful in 59s
k8s smoke test / test (push) Successful in 20s
This commit is contained in:
+39
-10
@@ -11,9 +11,11 @@ const ACCELLERATION := 30.0
|
||||
const DECELLERATION := 40.0
|
||||
const JUMP_SPEED := 4.0
|
||||
const MAX_NUMBER_OF_JUMPS := 2
|
||||
const MIN_FOV := 10.0
|
||||
const MAX_FOV := 179.0
|
||||
const ZOOM_FACTOR := 1.1 # Zoom out when >1, in when < 1
|
||||
const DEFAULT_ZOOM_DIST := 3.0
|
||||
const MIN_ZOOM_DIST := 1.5
|
||||
const MAX_ZOOM_DIST := 8.0
|
||||
const ZOOM_STEP := 0.5
|
||||
var _zoom_dist := DEFAULT_ZOOM_DIST
|
||||
const FIREBALL_SPAWN_FORWARD_OFFSET := 1.5
|
||||
const FIREBALL_SPAWN_UP_OFFSET := 1.2
|
||||
var mouse_sensitivity := 0.005
|
||||
@@ -68,10 +70,12 @@ func _ready() -> void:
|
||||
audio_player.stream = jump_sound
|
||||
audio_player.volume_db = -20
|
||||
if cam:
|
||||
_camera_offset_local = cam.transform.origin
|
||||
if TeleportState != null:
|
||||
_zoom_dist = TeleportState.camera_zoom_dist
|
||||
_camera_pitch = cam.rotation.x
|
||||
_camera_yaw = global_transform.basis.get_euler().y
|
||||
cam.set_as_top_level(true)
|
||||
update_camera_offset()
|
||||
cam.global_position = global_position + (Basis(Vector3.UP, _camera_yaw) * _camera_offset_local)
|
||||
cam.global_rotation = Vector3(_camera_pitch, _camera_yaw, 0.0)
|
||||
var move_basis := cam.global_transform.basis if cam else global_transform.basis
|
||||
@@ -156,6 +160,9 @@ func _integrate_forces(state):
|
||||
cam.global_position = cam.global_position.lerp(target_pos, camera_follow_speed * state.step)
|
||||
cam.global_rotation = Vector3(_camera_pitch, _camera_yaw, 0.0)
|
||||
|
||||
if _model_root:
|
||||
_model_root.visible = (_zoom_dist > 0.0) and not _in_vehicle
|
||||
|
||||
_update_animation(on_floor, state.linear_velocity)
|
||||
_jump_triggered = false
|
||||
|
||||
@@ -178,9 +185,9 @@ func _input(event):
|
||||
|
||||
if event is InputEventMouseButton and event.pressed:
|
||||
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
||||
zoom_camera(1.0 / ZOOM_FACTOR) # Zoom in
|
||||
zoom_camera(true) # Zoom in
|
||||
elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||
zoom_camera(ZOOM_FACTOR) # Zoom out
|
||||
zoom_camera(false) # Zoom out
|
||||
|
||||
if event.is_action_pressed("player_fireball"):
|
||||
shoot_fireball()
|
||||
@@ -189,11 +196,33 @@ func _input(event):
|
||||
if event.is_action_pressed("player_light"):
|
||||
_flashlight.visible = !_flashlight.visible
|
||||
|
||||
func zoom_camera(factor):
|
||||
func zoom_camera(zoom_in: bool) -> void:
|
||||
if cam == null:
|
||||
return
|
||||
var new_fov = cam.fov * factor
|
||||
cam.fov = clamp(new_fov, MIN_FOV, MAX_FOV)
|
||||
if zoom_in:
|
||||
if _zoom_dist == 0.0:
|
||||
return
|
||||
elif _zoom_dist <= MIN_ZOOM_DIST:
|
||||
_zoom_dist = 0.0
|
||||
else:
|
||||
_zoom_dist = max(MIN_ZOOM_DIST, _zoom_dist - ZOOM_STEP)
|
||||
else:
|
||||
if _zoom_dist == 0.0:
|
||||
_zoom_dist = MIN_ZOOM_DIST
|
||||
else:
|
||||
_zoom_dist = min(MAX_ZOOM_DIST, _zoom_dist + ZOOM_STEP)
|
||||
|
||||
if TeleportState != null:
|
||||
TeleportState.camera_zoom_dist = _zoom_dist
|
||||
|
||||
update_camera_offset()
|
||||
|
||||
func update_camera_offset() -> void:
|
||||
if _zoom_dist == 0.0:
|
||||
_camera_offset_local = Vector3(0.0, 1.6, 0.0)
|
||||
else:
|
||||
var height_offset := 0.25 * _zoom_dist
|
||||
_camera_offset_local = Vector3(0.5, 1.6 + height_offset, _zoom_dist)
|
||||
|
||||
func shoot_fireball() -> void:
|
||||
var direction := get_look_direction()
|
||||
@@ -284,7 +313,7 @@ func is_in_vehicle() -> bool:
|
||||
|
||||
|
||||
func get_look_origin() -> Vector3:
|
||||
return global_position + Vector3.UP * 1.2
|
||||
return global_position + Vector3.UP * FIREBALL_SPAWN_UP_OFFSET
|
||||
|
||||
|
||||
func get_look_direction() -> Vector3:
|
||||
|
||||
Reference in New Issue
Block a user