Fix multiplayer gameplay and UI interaction edge cases

This commit is contained in:
Alexander Sellite 2026-08-10 21:40:55 -04:00
parent e589ca9133
commit d690d74268
7 changed files with 137 additions and 19 deletions

View file

@ -241,6 +241,7 @@ func set_available(value: bool) -> void:
func close_chat() -> void:
var ownership_was_active: bool = _opened or _input_lock_applied
_opened = false
_set_status("")
_entry.virtual_keyboard_enabled = false
_entry.release_focus()
_entry.hide()
@ -743,6 +744,9 @@ func _send() -> void:
if _send_pending:
return
var body := _entry.text
if body.strip_edges().is_empty():
close_chat()
return
if _handle_chat_command(body):
return
_send_pending = true
@ -1114,6 +1118,9 @@ func _update_speech() -> void:
if camera.is_position_behind(world_position):
bubble.hide()
continue
if _is_speech_world_occluded(camera, avatar, world_position):
bubble.hide()
continue
var screen_position := (
camera.unproject_position(world_position) / _output_scale
)
@ -1154,6 +1161,38 @@ func _update_speech() -> void:
bubble.show()
func _is_speech_world_occluded(
camera: Camera3D,
speaker: Player,
world_position: Vector3,
) -> bool:
var world := camera.get_world_3d()
if world == null:
return false
var excluded: Array[RID] = []
if _player != null:
excluded.append(_player.get_rid())
if speaker != _player:
excluded.append(speaker.get_rid())
var query := PhysicsRayQueryParameters3D.create(
camera.global_position,
world_position,
)
query.collide_with_areas = false
query.collide_with_bodies = true
for _attempt: int in range(8):
query.exclude = excluded
var hit: Dictionary = world.direct_space_state.intersect_ray(query)
if hit.is_empty():
return false
var collider := hit.get("collider") as CollisionObject3D
if collider is Player:
excluded.append(collider.get_rid())
continue
return true
return false
func _on_draft_changed(_value: String) -> void:
if _settings == null:
return

View file

@ -342,7 +342,6 @@ func setup(
fishing_spot.bite_prompt_changed.connect(_on_bite_prompt_changed)
fishing_spot.catch_display_changed.connect(_on_catch_display_changed)
fishing_spot.showcase_changed.connect(_on_showcase_changed)
fishing_spot.art_ui_toggle_requested.connect(_toggle_surface_drawing)
_player_menu.menu_visibility_changed.connect(
_on_player_menu_visibility_changed
)
@ -1113,6 +1112,16 @@ func _toggle_surface_drawing() -> void:
_surface_drawing.activate(_drawing_pointer_window_position())
func set_surface_drawing_hotbar_selected(is_selected: bool) -> void:
if _surface_drawing == null:
return
if is_selected:
if not _surface_drawing.is_active() and _surface_drawing.can_activate():
_surface_drawing.activate(_drawing_pointer_window_position())
elif _surface_drawing.is_active():
_surface_drawing.deactivate()
func _drawing_pointer_window_position() -> Vector2:
if _virtual_mouse_active:
return _virtual_mouse_window_position