4.3 KiB
4.3 KiB
BPC_PlayerRespawnSystem — Actor Component (Respawn)
File: Content/Framework/Save/BPC_PlayerRespawnSystem
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, BP_Checkpoint, SS_SaveManager, BPC_HealthSystem, BPC_StaminaSystem, BPC_StressSystem
Used By: BPC_DeathHandlingSystem (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 |
Direct call | Orchestrator triggers respawn |
BP_Checkpoint |
Direct call | Get respawn transform |
BPC_HealthSystem |
Direct call | Restore health on respawn |
BPC_StaminaSystem |
Direct call | Restore stamina on respawn |
BPC_StressSystem |
Direct call | Reset stress on respawn |
SS_SaveManager |
Direct call | Load respawn state |
WBP_HUDController |
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.mdper Clean Slate refactoring plan