feat: Enhance interaction and inventory systems with new components and functionality

- Added BPC_UsableWorldObjectSystem for handling various interactable world objects with detailed manual implementation guide.
- Introduced BPC_ActiveItemSystem to manage quick slots and active item usage, including cycling and selection logic.
- Implemented BPC_DocumentArchiveSystem for managing collectible documents with read tracking and categorization.
- Developed BPC_JournalSystem for narrative entries with auto-adding features based on gameplay events.
- Created BPC_KeyItemSystem for key management with consumable and persistent key support.
- Enhanced BPC_FirearmSystem for ranged weapon mechanics, including hitscan and projectile firing.
- Updated BPC_MeleeSystem for melee combat with combo and blocking mechanics.
- Established BPC_ReloadSystem for managing weapon reloading processes, including partial reloads and state management.
This commit is contained in:
Lefteris Notas
2026-05-19 18:37:42 +03:00
parent f272257cb3
commit eeb1bf82c9
11 changed files with 1361 additions and 11 deletions

View File

@@ -46,4 +46,129 @@
| `BPC_LoreUnlockSystem` | Lore document triggers |
## 6. Reuse Notes
- Documents are inventory items with `E_ItemCategory = Document`
- Documents are inventory items with `E_ItemCategory = Document`
---
## 7. Manual Implementation Guide
### 7.1 Class Setup
1. Create Blueprint Class: Parent = `ActorComponent`, Name = `BPC_DocumentArchiveSystem`
2. Add to Player Character
3. Define struct `S_DocumentEntry` with fields: `DocumentID` (Guid), `DocumentTag` (GameplayTag), `Title` (Text), `Body` (Text), `Category` (Enum), `bIsRead` (Boolean), `DateCollected` (Float), `bIsFlagged` (Boolean)
### 7.2 Variable Initialization (BeginPlay)
```
Event BeginPlay
├─ Set CollectedDocuments = empty Array<S_DocumentEntry>
├─ Set UnreadCount = 0
├─ Set bShowUnreadBadge = true
├─ Get Owner → Find Component by Class (BPC_InventorySystem) → Cache
│ └─ Bind to OnItemAdded → OnItemAddedHandler
└─ Get Owner → Find BP_DocumentArchiveSystem → self (ensure only one)
```
### 7.3 Function Implementations
#### `AddDocument(ItemData: DA_ItemData)` → `Boolean`
```
[Function: AddDocument]
Step 1: Branch on ItemData.ItemType == Document → If not, return false
Step 2: Check if document with same ItemTag already in CollectedDocuments:
ForEach CollectedDocuments → if Entry.DocumentTag == ItemData.ItemTag:
Return false (already collected)
Step 3: Create S_DocumentEntry struct:
- DocumentID = New Guid
- DocumentTag = ItemData.ItemTag
- Title = ItemData.DisplayName
- Body = ItemData.Description (document content)
- Category = determine from tag (ItemTag starts with "Document.Notes" → Notes, etc.)
- bIsRead = false
- DateCollected = Get Game Time in Seconds
- bIsFlagged = false
Step 4: Add to CollectedDocuments array
Step 5: UnreadCount += 1
Step 6: Fire OnDocumentCollected(NewEntry)
Step 7: Also notify BPC_LoreUnlockSystem if category is Lore
Step 8: Return true
```
**Nodes:** `New Guid`, `Make S_DocumentEntry`, `Add`, `Get Game Time in Seconds`, `Starts With (String)`
#### `MarkAsRead(DocumentID: Guid)` → `void`
```
[Function: MarkAsRead]
Step 1: Find document in CollectedDocuments by DocumentID:
ForEach with Break → if Entry.DocumentID == DocumentID:
Branch on Entry.bIsRead:
False → Set bIsRead = true, UnreadCount -= 1
True → Return (already read)
Step 2: Fire OnDocumentRead(DocumentID)
Step 3: Branch on UnreadCount == 0:
True → Fire OnAllDocumentsRead
```
#### `MarkAllAsRead()` → `void`
```
[Function: MarkAllAsRead]
Step 1: ForEach CollectedDocuments:
Set bIsRead = true
Step 2: Set UnreadCount = 0
Step 3: Fire OnAllDocumentsRead
```
#### `GetDocumentsByCategory(Category: E_DocumentCategory, bUnreadOnly: Boolean)` → `Array<S_DocumentEntry>`
```
[Function: GetDocumentsByCategory] (Pure)
Step 1: Create empty Array → Results
Step 2: ForEach CollectedDocuments:
If Entry.Category == Category AND (NOT bUnreadOnly OR NOT Entry.bIsRead):
Add to Results
Step 3: Return Results
```
#### `GetUnreadCount()` → `Integer`
```
[Function: GetUnreadCount] (Pure)
Return UnreadCount
```
#### `HasDocument(DocumentTag: GameplayTag)` → `Boolean`
```
[Function: HasDocument] (Pure)
Step 1: ForEach CollectedDocuments:
If Entry.DocumentTag == DocumentTag → Return true
Step 2: Return false
```
#### `ToggleFlag(DocumentID: Guid)` → `void`
```
[Function: ToggleFlag]
Step 1: Find document by DocumentID in CollectedDocuments
Step 2: Entry.bIsFlagged = NOT Entry.bIsFlagged
Step 3: If flagged → move to top of array (optional sorting)
```
### 7.4 Event Dispatcher Bindings
| Bind to Dispatcher | Custom Event | Logic |
|-------------------|-------------|-------|
| `BPC_InventorySystem.OnItemAdded(Item)` | `OnItemAddedHandler` | If Item.ItemData.ItemType == Document → Call AddDocument(Item.ItemData) |
### 7.5 Blueprint Build Checklist
- [ ] Define enum `E_DocumentCategory`: Notes, Letters, Audio, Data, Photos
- [ ] Define struct `S_DocumentEntry` with all fields
- [ ] Create BPC_DocumentArchiveSystem, add to Player Character
- [ ] Add variables: CollectedDocuments, DocumentCategories, bShowUnreadBadge, UnreadCount
- [ ] Implement AddDocument with duplicate check and struct creation
- [ ] Implement MarkAsRead with UnreadCount tracking
- [ ] Implement GetDocumentsByCategory with optional unread filter
- [ ] Implement HasDocument for narrative queries
- [ ] Bind to BPC_InventorySystem.OnItemAdded
- [ ] Test: pick up document item → archive updates → UI shows badge