97 lines
4.3 KiB
Markdown
97 lines
4.3 KiB
Markdown
# BPC_PlayerRespawnSystem — Actor Component (Respawn)
|
|
|
|
**File:** [`Content/Framework/Save/BPC_PlayerRespawnSystem`](Content/Framework/Save/BPC_PlayerRespawnSystem.uasset)
|
|
|
|
**Purpose:** Handles the actual respawn mechanics after death outcome is determined. Reads respawn transform from `BP_Checkpoint`, applies state restoration from `SS_SaveManager`, and runs the respawn transition.
|
|
|
|
**Depends On:** [`BPC_DeathHandlingSystem`](BPC_DeathHandlingSystem.md), [`BP_Checkpoint`](BP_Checkpoint.md), [`SS_SaveManager`](35_SS_SaveManager.md), [`BPC_HealthSystem`](../02-player/08_BPC_HealthSystem.md), [`BPC_StaminaSystem`](../02-player/09_BPC_StaminaSystem.md), [`BPC_StressSystem`](../02-player/10_BPC_StressSystem.md)
|
|
**Used By:** [`BPC_DeathHandlingSystem`](BPC_DeathHandlingSystem.md) (orchestrator)
|
|
|
|
---
|
|
|
|
## Variables
|
|
|
|
| Name | Type | Description |
|
|
|------|------|-------------|
|
|
| `RespawnDelay` | Float | Seconds before respawn after death (default 2.0) |
|
|
| `RespawnFadeDuration` | Float | Seconds for camera fade (default 1.0) |
|
|
| `bRestoreHealthOnRespawn` | Bool | Should health be fully restored? (default true) |
|
|
| `HealthRestorePercent` | Float | If bRestoreHealthOnRespawn is false, what % HP to restore (0.0-1.0) |
|
|
| `bClearStressOnRespawn` | Bool | Reset stress to minimum on respawn? (default true) |
|
|
| `bRestoreStaminaOnRespawn` | Bool | Reset stamina to maximum on respawn? (default true) |
|
|
|
|
---
|
|
|
|
## Functions
|
|
|
|
| Name | Inputs | Outputs | Description |
|
|
|------|--------|---------|-------------|
|
|
| `RespawnPlayer` | Outcome: E_DeathOutcome, Context: S_DeathContext | — | Orchestrates the full respawn sequence |
|
|
| `GetRespawnTransform` | — | Transform | Delegates to BP_Checkpoint |
|
|
| `ApplyRespawnState` | — | — | Restores health, stamina, stress via their respective components |
|
|
| `ResetPlayerAtTransform` | Transform: Transform | — | Moves the character to the respawn location |
|
|
| `PlayRespawnTransition` | — | — | Camera fade-in, post-process effects |
|
|
|
|
---
|
|
|
|
## Event Dispatchers
|
|
|
|
| Name | Parameters | Fired When |
|
|
|------|-----------|------------|
|
|
| `OnRespawnStarted` | Outcome: E_DeathOutcome | Respawn sequence begins |
|
|
| `OnRespawnCompleted` | — | Player is fully respawned and controllable |
|
|
| `OnRespawnFailed` | Reason: FText | Respawn could not be completed |
|
|
|
|
---
|
|
|
|
## Blueprint Flow
|
|
|
|
```
|
|
[RespawnPlayer: Outcome, Context]
|
|
└─► Broadcast OnRespawnStarted(Outcome)
|
|
└─► Delay RespawnDelay seconds
|
|
└─► GetRespawnTransform() → RespawnLocation
|
|
└─► If RespawnLocation is invalid:
|
|
Broadcast OnRespawnFailed("No valid respawn point")
|
|
return
|
|
└─► ResetPlayerAtTransform(RespawnLocation)
|
|
└─► ApplyRespawnState()
|
|
└─► PlayRespawnTransition()
|
|
└─► Re-enable player input
|
|
└─► Broadcast OnRespawnCompleted
|
|
|
|
[ApplyRespawnState]
|
|
└─► If bRestoreHealthOnRespawn:
|
|
BPC_HealthSystem.SetHealth(MaxHealth)
|
|
└─► Else:
|
|
BPC_HealthSystem.SetHealth(MaxHealth * HealthRestorePercent)
|
|
└─► If bClearStressOnRespawn:
|
|
BPC_StressSystem.ResetStress()
|
|
└─► If bRestoreStaminaOnRespawn:
|
|
BPC_StaminaSystem.SetStamina(MaxStamina)
|
|
|
|
[GetRespawnTransform]
|
|
└─► Get BP_Checkpoint from Owner
|
|
└─► Return BP_Checkpoint.GetRespawnTransform()
|
|
```
|
|
|
|
---
|
|
|
|
## Communications With
|
|
|
|
| Target System | Method | Why |
|
|
|---------------|--------|-----|
|
|
| [`BPC_DeathHandlingSystem`](BPC_DeathHandlingSystem.md) | Direct call | Orchestrator triggers respawn |
|
|
| [`BP_Checkpoint`](BP_Checkpoint.md) | Direct call | Get respawn transform |
|
|
| [`BPC_HealthSystem`](../02-player/08_BPC_HealthSystem.md) | Direct call | Restore health on respawn |
|
|
| [`BPC_StaminaSystem`](../02-player/09_BPC_StaminaSystem.md) | Direct call | Restore stamina on respawn |
|
|
| [`BPC_StressSystem`](../02-player/10_BPC_StressSystem.md) | Direct call | Reset stress on respawn |
|
|
| [`SS_SaveManager`](35_SS_SaveManager.md) | Direct call | Load respawn state |
|
|
| [`WBP_HUDController`](../06-ui/WBP_HUDController.md) | Dispatcher | Fade transitions |
|
|
|
|
---
|
|
|
|
## Reuse Notes
|
|
- RespawnDelay and RespawnFadeDuration are configurable per difficulty level
|
|
- State restoration values (health %, stress reset, stamina) can be tuned via data assets
|
|
- Split from original bundled `31_BPC_DeathHandlingSystem.md` per Clean Slate refactoring plan |