fix terrain collision and water recovery
This commit is contained in:
parent
da7f072365
commit
1ab2a291d2
13 changed files with 110 additions and 11 deletions
|
|
@ -156,6 +156,7 @@ func _validate_portable_water_body() -> void:
|
|||
PlayerWaterTrigger.EntryHeightReference.PLAYER_ORIGIN,
|
||||
)
|
||||
water_body.set("recovery_entry_depth_threshold", 0.1)
|
||||
water_body.set("recovery_entry_confirmation_seconds", 0.2)
|
||||
water_body.set("fish_pool", PondPool)
|
||||
root.add_child(water_body)
|
||||
await process_frame
|
||||
|
|
@ -183,6 +184,34 @@ func _validate_portable_water_body() -> void:
|
|||
== PlayerWaterTrigger.EntryHeightReference.PLAYER_ORIGIN
|
||||
)
|
||||
assert(is_equal_approx(recovery_region.entry_depth_threshold, 0.1))
|
||||
assert(is_equal_approx(recovery_region.entry_confirmation_seconds, 0.2))
|
||||
|
||||
var recovery_player := PlayerScene.instantiate() as Player
|
||||
assert(recovery_player != null)
|
||||
root.add_child(recovery_player)
|
||||
recovery_player.set_process(false)
|
||||
recovery_player.set_physics_process(false)
|
||||
var recovery_requests: Array[float] = []
|
||||
recovery_region.recovery_requested.connect(
|
||||
func(_player: Player, requested_surface_height: float) -> void:
|
||||
recovery_requests.append(requested_surface_height)
|
||||
)
|
||||
recovery_region.call("_on_body_entered", recovery_player)
|
||||
recovery_player.global_position.y = 6.8
|
||||
recovery_region.call("_physics_process", 0.1)
|
||||
assert(recovery_requests.is_empty())
|
||||
# Breaking the submersion resets confirmation rather than carrying a stale
|
||||
# partial fall into a later jump.
|
||||
recovery_player.global_position.y = 7.0
|
||||
recovery_region.call("_physics_process", 0.1)
|
||||
recovery_player.global_position.y = 6.8
|
||||
recovery_region.call("_physics_process", 0.11)
|
||||
assert(recovery_requests.is_empty())
|
||||
recovery_region.call("_physics_process", 0.1)
|
||||
assert(recovery_requests == [7.0])
|
||||
recovery_region.call("_on_body_exited", recovery_player)
|
||||
recovery_player.queue_free()
|
||||
await process_frame
|
||||
|
||||
water_body.queue_free()
|
||||
await process_frame
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue