# BPC_ConsumableSystem — Consumable System **Parent Class:** `ActorComponent` **Category:** Inventory **Target UE Version:** 5.5–5.7 **Build Phase:** 3 — Inventory ## 1. Overview `BPC_ConsumableSystem` manages consumable item usage — health packs, stamina boosters, temporary buff items, and one-time-use consumables. Reads from [`BPC_InventorySystem`](BPC_InventorySystem.md) and applies effects through the relevant player systems. ## 2. Variables | Variable | Type | Description | |----------|------|-------------| | `ConsumableCooldown` | `float` | Global cooldown between consumable uses | | `ActiveBuffs` | `TArray` | Currently active temporary buffs | | `bCanUseConsumables` | `bool` | Master toggle (blocked during certain states) | ## 3. Structs ### `S_ActiveBuff` | Field | Type | Description | |-------|------|-------------| | `BuffTag` | `FGameplayTag` | Buff identifier | | `RemainingDuration` | `float` | Time remaining | | `BuffData` | `DA_ItemData*` | Source item data | | `AffectedStat` | `E_PlayerStat` | Health, Stamina, Speed, Stress, Damage | ## 4. Functions | Function | Description | |----------|-------------| | `UseConsumable` | Uses a consumable item from inventory slot | | `ApplyBuff` | Applies a temporary buff to the player | | `RemoveBuff` | Removes a buff by tag | | `GetActiveBuffs` | Returns all active buffs | | `HasBuff` | Checks if a specific buff is active | | `TickBuffs` | Decrements buff durations, removes expired | ## 5. Event Dispatchers | Dispatcher | Payload | Description | |------------|---------|-------------| | `OnConsumableUsed` | `S_InventoryEntry Item` | Consumable item used | | `OnBuffApplied` | `FGameplayTag BuffTag`, `float Duration` | Buff activated | | `OnBuffExpired` | `FGameplayTag BuffTag` | Buff ended | ## 6. Dependencies | System | Relationship | |--------|--------------| | `BPC_InventorySystem` | Reads and modifies consumable items | | `BPC_HealthSystem` | Health restoration via consumables | | `BPC_StaminaSystem` | Stamina restoration | | `BPC_StressSystem` | Stress reduction items | | `BPC_MovementStateSystem` | Speed buffs | ## 7. Reuse Notes - All consumable effects are data-driven via DA_ItemData - Buffs support stacking (multiple buffs active simultaneously)