# 80 — BPC_DevCheatManager

## Blueprint Spec — UE 5.5–5.7

---

### Parent Class
`ActorComponent`

### Dependencies
- [`BPC_InventoryComponent`](../04-inventory/24_BPC_InventoryComponent.md) — Spawn items
- [`BPC_Movement`](../02-player/10_BPC_Movement.md) — Toggle noclip/fly
- [`BPC_HealthComponent`](../02-player/08_BPC_HealthComponent.md) — God mode, heal
- [`BPC_NarrativeState`](../07-narrative/36_BPC_NarrativeState.md) — Skip to chapter
- [`BPC_TimeManager`](../01-core/02_BPC_TimeManager.md) — Time scale, pause
- [`BPC_PlayerCamera`](../02-player/11_BPC_PlayerCamera.md) — Camera controls
- [`BPC_FPSCounter`](../11-polish/79_BPC_FPSCounter.md) — Performance overlay
- [`WBP_DebugMenu`](../11-polish/81_WBP_DebugMenu.md) — Visual debug UI
- [`BPC_AudioManager`](../10-adaptive/66_BPC_AudioManager.md) — Audio debug
- [`BPC_LightingManager`](../10-adaptive/65_BPC_LightingManager.md) — Lighting debug

### Purpose
Developer cheat and debug command manager for testing and development builds. Provides console commands and bound functions for common debug operations: god mode, noclip, spawning items, teleporting, time manipulation, AI debugging, narrative skipping, and performance profiling. Only active in non-shipping builds. Accessible via developer console (~) key or bound key combinations.

### Enums

**ECheatCategory**

| Value | Description |
|-------|-------------|
| Player | Player-related cheats |
| World | World manipulation |
| AI | AI behavior debug |
| Narrative | Story skip/advance |
| Performance | Profiling tools |
| Camera | Camera manipulation |
| Inventory | Item spawning |
| Debug | General debug toggles |

### Structs

**FCheatCommand**

| Field | Type | Description |
|-------|------|-------------|
| Command | FString | Console command string |
| Category | ECheatCategory | Grouping |
| Description | FText | Help text |
| bRequiresAuth | Bool | Admin only |
| bAvailableInShipping | Bool | Ship build flag |

### Variables

| Name | Type | Description |
|------|------|-------------|
| `bCheatsEnabled` | Bool | Master toggle |
| `bGodMode` | Bool | Invulnerability |
| `bNoClipEnabled` | Bool | Fly/wall pass |
| `bInfiniteAmmo` | Bool | Unlimited ammo |
| `bInfiniteStamina` | Bool | Unlimited stamina |
| `bInvisibleToAI` | Bool | AI ignore player |
| `bShowAIDebug` | Bool | AI debug visualization |
| `bShowCollision` | Bool | Collision wireframes |
| `bShowPerformance` | Bool | Performance overlay |
| `TimeScale` | Float | World time scale |
| `RegisteredCommands` | TMap\<FString, FCheatCommand\> | Command registry |
| `CheatHistory` | TArray\<FString\> | Command history |

### Functions

| Name | Inputs | Outputs | Description |
|------|--------|---------|-------------|
| `Initialize` | — | — | Register all commands |
| `EnableCheats` | bEnable: Bool | — | Master toggle |
| `ExecuteCheat` | Command: FString, Args: TArray\<FString\> | — | Run cheat command |
| `RegisterCommand` | Command: FCheatCommand | — | Add custom command |
| `ToggleGodMode` | — | — | God mode on/off |
| `ToggleNoClip` | — | — | Noclip on/off |
| `ToggleInfiniteAmmo` | — | — | Infinite ammo |
| `ToggleInfiniteStamina` | — | — | Infinite stamina |
| `ToggleInvisibility` | — | — | AI invisibility |
| `ToggleAIDebug` | — | — | AI visualization |
| `ToggleCollisionDebug` | — | — | Collision vis |
| `TogglePerformanceOverlay` | — | — | Show FPS/stats |
| `ToggleDebugMenu` | — | — | Open debug menu |
| `HealPlayer` | Amount: Float | — | Restore health |
| `SetTimeScale` | Scale: Float | — | Slow-mo/speed-up |
| `AddItem` | ItemID: FName, Count: Int32 | — | Spawn item |
| `TeleportToLocation` | Location: FVector | — | Teleport player |
| `TeleportToLevel` | LevelName: FName | — | Jump to level |
| `SkipToChapter` | ChapterID: FName | — | Narrative skip |
| `KillAllAIDebug` | — | — | Despawn all AI |
| `SpawnAIDebug` | AIType: FName | — | Spawn AI for testing |
| `GetAllCheatNames` | — | TArray\<FString\> | List all cheats |
| `IsCheatEnabled` | CheatID: FName | Bool | State query |

### Blueprint Flow

```
[Initialize]
  └─► If BuildType == Shipping: Disable all, return
  └─► Register default commands:
         "God" -> ToggleGodMode
         "NoClip" -> ToggleNoClip
         "Fly" -> ToggleNoClip
         "Ghost" -> ToggleNoClip + Invisibility
         "Heal" -> HealPlayer(100)
         "KillAll" -> KillAllAIDebug
         "Slomo {value}" -> SetTimeScale(value)
         "Summon {item}" -> AddItem
         "Teleport {x} {y} {z}" -> TeleportToLocation
         "Open {level}" -> TeleportToLevel
         "Chapter {id}" -> SkipToChapter
         "Stat FPS" -> TogglePerformanceOverlay
         "DebugMenu" -> ToggleDebugMenu
         "InfiniteAmmo" -> ToggleInfiniteAmmo
         "Invisible" -> ToggleInvisibility
  └─► bCheatsEnabled = true
  └─► Bind to console input events

[ExecuteCheat]
  └─► Parse Command from input string
  └─► Look up in RegisteredCommands
  └─► If found:
         Validate arguments
         Execute bound function with args
         Add to CheatHistory
         Log: "Cheat: {Command}" (development builds only)
  └─► If not found:
         Log: "Unknown cheat command: {Command}"

[ToggleGodMode]
  └─► bGodMode = !bGodMode
  └─► If bGodMode:
         BPC_HealthComponent.SetInvulnerable(true)
         Set health to max
         Notify: "God mode ON"
  └─► Else:
         BPC_HealthComponent.SetInvulnerable(false)
         Notify: "God mode OFF"

[ToggleNoClip]
  └─► bNoClipEnabled = !bNoClipEnabled
  └─► If bNoClipEnabled:
         BPC_Movement.SetMovementMode(Flying)
         Disable collision with world
         Notify: "NoClip ON"
  └─► Else:
         BPC_Movement.SetMovementMode(Walking)
         Enable collision
         Notify: "NoClip OFF"

[SetTimeScale]
  └─► TimeScale = Clamp(Scale, 0.1, 10.0)
  └─► BPC_TimeManager.SetGlobalTimeDilation(TimeScale)
  └─► Notify: "Time scale: {TimeScale}x"
```

### Event Dispatchers

| Name | Payload | Description |
|------|---------|-------------|
| `OnCheatExecuted` | Command: FString | Command used |
| `OnGodModeChanged` | bEnabled: Bool | God mode toggle |
| `OnNoClipChanged` | bEnabled: Bool | NoClip toggle |

### Communications With

| Target | Method | Why |
|--------|--------|-----|
| [`BPC_HealthComponent`](../02-player/08_BPC_HealthComponent.md) | Direct call | God mode |
| [`BPC_Movement`](../02-player/10_BPC_Movement.md) | Direct call | NoClip |
| [`BPC_InventoryComponent`](../04-inventory/24_BPC_InventoryComponent.md) | Direct call | Spawn items |
| [`BPC_NarrativeState`](../07-narrative/36_BPC_NarrativeState.md) | Direct call | Skip chapter |
| [`BPC_TimeManager`](../01-core/02_BPC_TimeManager.md) | Direct call | Time scale |
| [`BPC_FPSCounter`](../11-polish/79_BPC_FPSCounter.md) | Direct call | Performance overlay |
| [`WBP_DebugMenu`](../11-polish/81_WBP_DebugMenu.md) | Create widget | Debug UI |
| [`BPC_AIDirector`](../09-ai/57_BPC_AIDirector.md) | Direct call | AI debug |

### Reuse Notes
- Completely disabled in shipping builds via build flag check
- All cheats are registered commands; extensible via RegisterCommand
- Command history for repeated use
- Cheat notifications shown via on-screen debug text
- Supports both console and key binding input
- Debug toggles are state-persistent across level transitions
- Intended for development and QA team use only