Files
UE5-Modular-Game-Framework/docs/blueprints/08-weapons/78_BPC_ReloadSystem.md
Lefteris Notas 411edea8ce add blueprints
2026-05-19 13:22:27 +03:00

62 lines
2.6 KiB
Markdown

# BPC_ReloadSystem — Actor Component
**File:** [`Content/Framework/Weapons/BPC_ReloadSystem`](Content/Framework/Weapons/BPC_ReloadSystem.uasset)
**Parent Class:** `UActorComponent`
**Dependencies:** [`DA_WeaponData`](49_BP_WeaponBase.md), [`BPC_FirearmSystem`](BPC_FirearmSystem.md), [`BPC_AmmoResourceSystem`](../04-inventory/BPC_KeyItemSystem.md)
**Purpose:** Manages reload animations, timing, and ammo transfer from pool to weapon magazine. Supports tactical reload, partial reload, and reload interruption.
---
## Variables
| Name | Type | Description |
|------|------|-------------|
| `bIsReloading` | Bool | Reload in progress |
| `ReloadMontage` | AnimMontage | Per-weapon reload animation |
| `AmmoTypeTag` | GameplayTag | Which ammo pool to draw from |
| `bPartialReload` | Bool | Whether partial reload is supported |
| `RoundsToAdd` | Integer | How many rounds to transfer on reload complete |
## Functions / Events
| Name | Inputs | Outputs | What it does |
|------|--------|---------|--------------|
| `RequestReload` | — | — | Player presses reload; checks if reload needed |
| `BeginReload` | — | — | Plays reload montage, locks fire input |
| `CompleteReload` | — | — | Transfers ammo from pool to magazine |
| `InterruptReload` | — | — | Cancels reload, retains partial rounds if configured |
| `CanReload` | — | Bool | Checks magazine not full AND ammo pool has rounds |
## Event Dispatchers
| Name | Parameters | Fired when |
|------|-----------|-----------|
| `OnReloadStarted` | — | Reload begins |
| `OnReloadCompleted` | RoundsAdded: Integer | Reload finishes successfully |
| `OnReloadInterrupted` | RoundsAdded: Integer | Reload cancelled mid-way |
| `OnReloadFailed` | — | Cannot reload (full mag or no ammo) |
## Blueprint Flow
```
[Player presses Reload] -> CanReload?
-> Yes: BeginReload -> Play ReloadMontage -> bIsReloading = true -> Lock fire input
-> Animation Notify "TransferRounds" -> CompleteReload -> Consume ammo from pool
-> Unlock fire input -> Broadcast OnReloadCompleted
-> No: Broadcast OnReloadFailed
```
## Communications With
| Target System | Method | Why |
|---------------|--------|-----|
| `BPC_FirearmSystem` | Direct LockFire / UnlockFire | Prevent firing during reload |
| `BPC_AmmoResourceSystem` | Direct ConsumeAmmo | Draw rounds from ammo pool |
| `ABP_PlayerBody` | Animation Notify events | Reload animation timing |
## Reuse Notes
- ReloadMontage from DA_WeaponData per weapon; swap for each weapon type
- Partial reload enabled per weapon (e.g. shotguns use individual shell reloads)
- AmmoTypeTag links to correct ammo pool in BPC_AmmoResourceSystem