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:
@@ -102,4 +102,61 @@ Ranged weapon specialization. Handles line trace / projectile fire, weapon sprea
|
||||
- Spread is cumulative while firing, resets on recovery timer.
|
||||
- Projectile type requires a child BP implementing `AP_BaseProjectile` with velocity and lifetime.
|
||||
- Renamed from `BP_RangedWeapon` to `BPC_FirearmSystem` per Master naming convention.
|
||||
- Cross-references updated: `BPC_DamageHandlerComponent` → `BPC_DamageReceptionSystem`, `BPC_PlayerCameraManager` → `BPC_CameraStateLayer`, `DA_WeaponData` → `14-data-assets/`.
|
||||
- Cross-references updated: `BPC_DamageHandlerComponent` → `BPC_DamageReceptionSystem`, `BPC_PlayerCameraManager` → `BPC_CameraStateLayer`, `DA_WeaponData` → `14-data-assets/`.
|
||||
|
||||
---
|
||||
|
||||
## Manual Implementation Guide
|
||||
|
||||
### Class Setup
|
||||
1. Create Blueprint Class: Parent = `ActorComponent`, Name = `BPC_FirearmSystem`
|
||||
2. Attach to `BP_WeaponBase` subclass: `BP_RangedWeapon`
|
||||
3. Add FireSocket SceneComponent on weapon mesh (muzzle position)
|
||||
|
||||
### Variable Init (BeginPlay)
|
||||
```
|
||||
Event BeginPlay
|
||||
├─ Read WeaponData from Owner BP_WeaponBase
|
||||
├─ Set FireType = WeaponData.FireType (Hitscan/Projectile/Hybrid)
|
||||
├─ Set Range = WeaponData.EffectiveRange
|
||||
├─ Set SpreadAngle = WeaponData.BaseSpread
|
||||
├─ Set BulletsPerShot = WeaponData.PelletsPerShot
|
||||
├─ Set CurrentSpread = 0.0
|
||||
└─ Cache: BPC_AmmoComponent, BPC_CombatFeedbackComponent, BPC_CameraStateLayer
|
||||
```
|
||||
|
||||
### Function Node-by-Node
|
||||
|
||||
#### `OnFire_Implementation()` *(Overrides BP_WeaponBase.OnFire)*
|
||||
```
|
||||
Step 1: Get Camera Forward Vector
|
||||
Step 2: Switch on FireType:
|
||||
Hitscan: ForLoop (BulletsPerShot):
|
||||
AimDir = Forward + CalculateSpread()
|
||||
LineTraceByChannel: Start=Camera, End=Camera+AimDir*Range
|
||||
If Hit & Implements I_Damageable: ApplyDamage(WeaponData.Damage, HitResult)
|
||||
SpawnImpactFX(HitResult)
|
||||
Projectile: ForLoop (BulletsPerShot):
|
||||
Spawn ProjectileClass at FireSocket, velocity=AimDir*Speed
|
||||
Hybrid: Hitscan + projectile for near-miss area
|
||||
Step 3: ApplyRecoil → CameraShake or AddControllerPitch/Yaw
|
||||
Step 4: ConsumeAmmo on BPC_AmmoComponent
|
||||
Step 5: PlayMuzzleFlash + PlayFireSound on CombatFeedback
|
||||
Step 6: CurrentSpread += SpreadIncreasePerShot (clamped to MaxSpread)
|
||||
```
|
||||
|
||||
#### `CalculateSpread()` → Vector *(Pure)*
|
||||
```
|
||||
RandomFloat(-1,1)*CurrentSpread → YawOffset
|
||||
RandomFloat(-1,1)*CurrentSpread → PitchOffset
|
||||
MakeRotator(PitchOffset, YawOffset, 0) → GetForwardVector
|
||||
```
|
||||
|
||||
### Build Checklist
|
||||
- [ ] Create BPC_FirearmSystem, attach to BP_RangedWeapon
|
||||
- [ ] Add FireSocket at muzzle
|
||||
- [ ] Implement OnFire with hitscan/projectile/hybrid switch
|
||||
- [ ] Implement CalculateSpread
|
||||
- [ ] Wire to AmmoComponent, CombatFeedback, CameraStateLayer
|
||||
- [ ] Create ProjectileClass with ProjectileMovement for projectile weapons
|
||||
- [ ] Test: fire at target → damage registers → FX plays → ammo count drops
|
||||
Reference in New Issue
Block a user