feat: add nearby social interactions

This commit is contained in:
ANG-Server
2026-07-21 22:19:41 +08:00
parent 0bab768b14
commit 9dee47492c
43 changed files with 1499 additions and 77 deletions

View File

@@ -46,6 +46,7 @@ var _inventoryRequestInFlight: bool = false
var _inventoryRequestReportsErrors: bool = false
func _ready() -> void:
add_to_group("whaletown_escape_dismissible")
_leave_multiplayer_world()
_apply_spawn_point()
_configure_camera()
@@ -54,8 +55,17 @@ func _ready() -> void:
_build_room_decor_ui()
_connect_room_decor_events()
_fetch_room_decor_inventory()
_discover_destination()
set_process(false)
func _discover_destination() -> void:
var destination_id := SceneManager.get_next_destination_id()
if destination_id.is_empty():
destination_id = "personal_room"
var socialManager := get_node_or_null("/root/SocialManager")
if socialManager != null and socialManager.has_method("discover_destination"):
socialManager.call("discover_destination", destination_id)
func _leave_multiplayer_world() -> void:
var chatManager := get_node_or_null("/root/ChatManager")
if chatManager != null and chatManager.has_method("leave_world"):
@@ -73,6 +83,8 @@ func _exit_tree() -> void:
saveManager.decor_save_failed.disconnect(_on_decor_save_failed)
func _input(event: InputEvent) -> void:
if get_viewport().is_input_handled():
return
if event is InputEventMouseButton:
var mouseEvent := event as InputEventMouseButton
if mouseEvent.button_index != MOUSE_BUTTON_LEFT:
@@ -91,7 +103,22 @@ func _process(_delta: float) -> void:
if _draggedDecor != null:
_update_dragged_decor_position()
func is_escape_dismissible() -> bool:
return _draggedDecor != null or (is_instance_valid(_inventoryPanel) and _inventoryPanel.visible)
func get_escape_priority() -> int:
return 500
func request_escape_close() -> void:
if _draggedDecor != null:
_finish_decor_drag()
return
if is_instance_valid(_inventoryPanel):
_inventoryPanel.visible = false
func _apply_spawn_point() -> void:
if player.has_scene_position_override:
return
var spawnName: String = SceneManager.get_next_spawn_name()
var markerName: String = spawnName if not spawnName.is_empty() else "DefaultSpawn"
var marker := $Markers.get_node_or_null(markerName) as Marker2D