Add starter RV progression and fishing feedback

This commit is contained in:
Alexander Sellite 2026-08-31 16:03:55 -04:00
parent eed361681a
commit d8bf59bca0
47 changed files with 2268 additions and 467 deletions

View file

@ -53,7 +53,7 @@ func _run() -> void:
)
assert(player != null)
assert(catalog != null and catalog.candidates.size() == 316)
assert(LogbookCatalog.ordered_species(catalog.candidates).size() == 313)
assert(LogbookCatalog.ordered_species(catalog.candidates).size() == 314)
assert(sale_service != null)
assert(shop_service != null)
assert(session != null and session.is_host())
@ -82,7 +82,7 @@ func _run() -> void:
main, player, catalog, sale_service, reservations
)
_test_host_backpack_purchase(player, shop_service)
_test_host_storage_purchase(player, shop_service)
await _test_host_home_upgrade(main, player, shop_service)
assert(not sale_service.is_local_sale_pending())
assert(not shop_service.is_local_purchase_pending())
@ -175,7 +175,6 @@ func _run_multiplayer_client() -> void:
assert(player.inventory_layout.restore_backpack_level(
PlayerInventoryLayout.MAX_BACKPACK_LEVEL
))
assert(player.cooler_capacity.restore_level(PlayerCoolerCapacity.MAX_LEVEL))
player.inventory.set_inventory_layout(null)
var catch_ids: Array[StringName] = []
for fish: FishData in catalog.candidates:
@ -202,7 +201,6 @@ func _run_multiplayer_client() -> void:
assert(not player.inventory.contains_catch_id(catch_id))
assert(not sale_service.is_local_sale_pending())
assert(player.inventory_layout.restore_backpack_level(0))
assert(player.cooler_capacity.restore_level(0))
var interaction := main.get("_shop_interaction") as FishingShopInteraction
player.global_position = interaction.global_position
@ -567,27 +565,49 @@ func _test_host_backpack_purchase(
assert(layout.get_next_backpack_cost() == -1)
func _test_host_storage_purchase(
func _test_host_home_upgrade(
main: Node,
player: Player,
shop_service: NetworkShopService,
) -> void:
var interaction := main.get(
"_rv_upgrade_shop_interaction"
) as RVUpgradeInteraction
var home_state := main.get("_home_state") as PlayerHomeState
var capacity := player.cooler_capacity
assert(interaction != null and home_state != null)
player.global_position = interaction.global_position
for _frame: int in 4:
await physics_frame
assert(interaction.is_avatar_in_range(player))
assert(home_state.get_tier() == PlayerHomeState.STARTER_TIER)
assert(
interaction.get_dialogue_text(home_state.get_tier())
== RVUpgradeInteraction.TENT_DIALOGUE_TEXT
)
assert(capacity.get_capacity() == 9)
var total_cost: int = 0
for cost: int in PlayerCoolerCapacity.EXPANSION_COSTS:
total_cost += cost
if player.wallet.get_balance() < total_cost:
assert(player.wallet.credit(total_cost - player.wallet.get_balance()))
var upgrade_cost: int = home_state.get_next_upgrade_cost()
assert(upgrade_cost == PlayerHomeState.HOME_UPGRADE_COSTS.front())
assert(upgrade_cost == 50)
if player.wallet.get_balance() < upgrade_cost:
assert(player.wallet.credit(
upgrade_cost - player.wallet.get_balance()
))
var balance_before := player.wallet.get_balance()
for expected_capacity: int in [18, 27, 36, 45, 54, 63, 72]:
_shop_result.clear()
assert(not shop_service.request_cooler_capacity_upgrade().is_empty())
assert(
not _shop_result.is_empty() and bool(_shop_result[1]),
"Cooler purchase failed: %s" % [_shop_result],
)
assert(capacity.get_capacity() == expected_capacity)
assert(player.wallet.get_balance() == balance_before - total_cost)
_shop_result.clear()
assert(not shop_service.request_home_upgrade().is_empty())
assert(
not _shop_result.is_empty() and bool(_shop_result[1]),
"Home purchase failed: %s" % [_shop_result],
)
assert(home_state.get_tier() == PlayerHomeState.STARTER_RV_TIER)
assert(
interaction.get_dialogue_text(home_state.get_tier())
== RVUpgradeInteraction.RV_DIALOGUE_TEXT
)
assert(capacity.get_capacity() == 18)
assert(player.wallet.get_balance() == balance_before - upgrade_cost)
assert(home_state.get_next_upgrade_cost() == -1)
assert(capacity.get_next_cost() == -1)

View file

@ -49,6 +49,7 @@ func _run_host() -> void:
host_fingerprint
)
assert(_same_door_position(host_avatar.global_position, host_spawn.origin))
assert(_faces_away_from_home(host_avatar, home_world, host_fingerprint))
assert(network_home.request_enter(host_fingerprint))
await physics_frame
host_avatar.global_position = home_world.get_interior_exit_position(
@ -57,6 +58,7 @@ func _run_host() -> void:
assert(network_home.request_exit())
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 remote_peer_id: int = await _wait_for_remote_peer(session)
assert(remote_peer_id > 1)
@ -70,6 +72,9 @@ func _run_host() -> void:
assert(_same_door_position(
remote_avatar.global_position, remote_spawn.origin
))
assert(_faces_away_from_home(
remote_avatar, home_world, remote_fingerprint
))
var disconnect_deadline: int = Time.get_ticks_msec() + 12000
while (
@ -118,6 +123,7 @@ func _run_client() -> void:
assert(_same_door_position(
player.global_position, exterior_spawn.origin
))
assert(_faces_away_from_home(player, home_world, fingerprint))
print("Home spawn multiplayer client validation: PASS")
await _cleanup(main, session)
@ -151,6 +157,23 @@ func _wait_for_home(
return false
func _faces_away_from_home(
avatar: Player,
home_world: HomeWorldService,
fingerprint: String,
) -> bool:
var exterior_basis: Basis = home_world.get_exterior_transform(
fingerprint
).basis
var outward_direction := exterior_basis.z
outward_direction.y = 0.0
if outward_direction.is_zero_approx():
return false
return avatar.get_facing_direction().dot(
outward_direction.normalized()
) >= 0.99
func _wait_for_remote_peer(session: NetworkSession) -> int:
var deadline: int = Time.get_ticks_msec() + 20000
while Time.get_ticks_msec() < deadline:

View file

@ -143,7 +143,7 @@ func _validate_save_round_trip(
assert(catalog != null)
assert(catalog.candidates.size() == 316)
var active_species := LogbookCatalog.ordered_species(catalog.candidates)
assert(active_species.size() == 313)
assert(active_species.size() == 314)
# Keep this runtime save fixture within maximum player capacity while the
# focused catalog validation exercises every active species individually.
var round_trip_species: Array[FishData] = []
@ -164,12 +164,14 @@ func _validate_save_round_trip(
player.inventory_layout.restore_backpack_level(
PlayerInventoryLayout.MAX_BACKPACK_LEVEL
)
player.cooler_capacity.restore_level(PlayerCoolerCapacity.MAX_LEVEL)
var home_state := main.get("_home_state") as PlayerHomeState
assert(home_state != null)
assert(home_state.upgrade_to_next_tier())
assert(
player.inventory_layout.get_backpack_level()
== PlayerInventoryLayout.MAX_BACKPACK_LEVEL
)
assert(player.cooler_capacity.get_level() == PlayerCoolerCapacity.MAX_LEVEL)
assert(player.cooler_capacity.get_capacity() == 18)
player.inventory.set_inventory_layout(null)
for index: int in 4:
_add_test_catch(player, round_trip_species[index])