Integrate per-save identity and interaction UI

This commit is contained in:
Alexander Sellite 2026-09-01 17:30:50 -04:00
parent ac82a28f3b
commit 4fda6e97f6
58 changed files with 3471 additions and 461 deletions

View file

@ -31,6 +31,7 @@ func _run_host() -> void:
"%PlayerSpawnService"
) as PlayerSpawnService
var save_manager := main.get("_save_manager") as PlayerSaveManager
var home_state := main.get_node("%PlayerHomeState") as PlayerHomeState
assert(bool(main.call(
"_apply_world", WorldLayout.STARTER_ISLAND, 1, true
)))
@ -59,6 +60,60 @@ func _run_host() -> void:
await physics_frame
assert(_same_door_position(host_avatar.global_position, host_spawn.origin))
assert(_faces_away_from_home(host_avatar, home_world, host_fingerprint))
var upgrade_result_id := "home-test-upgrade"
network_home.authorize_home_upgrade(
session.get_local_peer_id(),
PlayerHomeState.STARTER_RV_TIER,
upgrade_result_id,
)
assert(home_state.upgrade_to_next_tier())
var rv_deadline: int = Time.get_ticks_msec() + 5000
while (
Time.get_ticks_msec() < rv_deadline
and home_world.get_interior_exit_positions(host_fingerprint).size() < 2
):
await process_frame
var rv_exits: Array[Vector3] = home_world.get_interior_exit_positions(
host_fingerprint
)
assert(rv_exits.size() == 2)
network_home.finalize_home_upgrade(
session.get_local_peer_id(), upgrade_result_id, true
)
assert(rv_exits[0].x < rv_exits[1].x)
for exit_position: Vector3 in rv_exits:
host_avatar.global_position = (
exit_position
+ home_world.get_interior_exit_direction_near(
host_fingerprint, exit_position
) * 0.05
)
assert(home_world.has_avatar_crossed_interior_exit_threshold(
host_avatar, host_fingerprint
))
host_avatar.global_position = rv_exits[0] + Vector3(0.0, 0.0, 1.1)
assert(not home_world.has_avatar_crossed_interior_exit_threshold(
host_avatar, host_fingerprint
))
var presentations: Dictionary = home_world.get(
"_presentations_by_fingerprint"
)
var host_presentation: Dictionary = presentations.get(host_fingerprint, {})
var host_interior := host_presentation.get("interior") as Node3D
assert(host_interior != null)
var wall_collision := host_interior.find_child(
"WallWestCollision", true, false
) as StaticBody3D
assert(wall_collision != null)
assert(bool(wall_collision.get_meta(
HomeWorldService.INTERIOR_SHELL_COLLISION_META, false
)))
var wall_shape := wall_collision.get_child(0) as CollisionShape3D
assert(wall_shape != null)
assert((wall_shape.shape as ConcavePolygonShape3D).backface_collision)
host_avatar.global_position = host_spawn.origin
assert(network_home.request_enter(host_fingerprint))
await physics_frame
var remote_peer_id: int = await _wait_for_remote_peer(session)
assert(remote_peer_id > 1)
@ -66,6 +121,53 @@ func _run_host() -> void:
var remote_fingerprint: String = remote_record.identity_fingerprint
assert(await _wait_for_home(network_home, remote_fingerprint))
var remote_avatar: Player = spawn_service.get_avatar(remote_peer_id)
assert(not remote_avatar.is_remote_presentation_visible())
var chat_ui := main.get_node("%GameUI").get_node("%ChatUI") as ChatUI
chat_ui.call(
"_show_speech_bubble", remote_peer_id, "outside", remote_fingerprint
)
var speech_states: Dictionary = chat_ui.get("_speech")
assert(not speech_states.has(remote_peer_id))
var toolbar := main.get_node("%GameUI").get_node(
"%HomeDecorToolbar"
) as HomeDecorToolbar
assert(toolbar.visible)
var exit_button := toolbar.find_child(
"ExitRVButton", true, false
) as Button
assert(exit_button != null and exit_button.text == "Exit RV")
var storage := main.get_node("%GameUI").get_node(
"%PlayerStorage"
) as PlayerStorage
assert(storage.open_storage_from_home(true))
var close_storage_event := InputEventAction.new()
close_storage_event.action = &"interact"
close_storage_event.pressed = true
storage._unhandled_input(close_storage_event)
assert(not storage.visible)
exit_button.pressed.emit()
var exit_deadline: int = Time.get_ticks_msec() + 5000
while (
Time.get_ticks_msec() < exit_deadline
and not network_home.get_local_home_owner_fingerprint().is_empty()
):
await process_frame
assert(network_home.get_local_home_owner_fingerprint().is_empty())
var visibility_deadline: int = Time.get_ticks_msec() + 1000
while (
Time.get_ticks_msec() < visibility_deadline
and is_instance_valid(remote_avatar)
and not remote_avatar.is_remote_presentation_visible()
):
await process_frame
assert(is_instance_valid(remote_avatar))
assert(remote_avatar.is_remote_presentation_visible())
chat_ui.call(
"_show_speech_bubble", remote_peer_id, "inside", remote_fingerprint
)
speech_states = chat_ui.get("_speech")
assert(speech_states.has(remote_peer_id))
chat_ui.call("_on_peer_removed", remote_peer_id)
var remote_spawn: Transform3D = home_world.get_exterior_spawn_transform(
remote_fingerprint
)
@ -124,6 +226,10 @@ func _run_client() -> void:
player.global_position, exterior_spawn.origin
))
assert(_faces_away_from_home(player, home_world, fingerprint))
# Keep the peer present long enough for the host to rebuild the upgraded RV,
# exercise late-spawn visibility, and use the toolbar transition back to the
# shared world. A two-second grace period raced the host on slower machines.
await create_timer(10.0).timeout
print("Home spawn multiplayer client validation: PASS")
await _cleanup(main, session)