# khaomi/cotl_api architecture

> Architecture diagram of the GitHub repository khaomi/cotl_api, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/khaomi/cotl_api
- Repository: https://github.com/khaomi/cotl_api

## Overview

COTL_API is a Unity/BepInEx modding library for adding content and game integrations to Cult of the Lamb. Mod authors define custom content and register it through managers; runtime patches expose that content in game systems, while shared GUID/type and save support preserve identity and state. The README describes the product broadly, and the tree confirms many additional content domains. Unsampled subsystems are represented at their exact directories; edges are limited to relationships supported by the README or source index and excerpts.

Main entry points: [`COTL_API/Plugin.cs`](https://github.com/khaomi/cotl_api/blob/main/COTL_API/Plugin.cs) (Plugin lifecycle), [`COTL_API/Debug/DebugManager.cs`](https://github.com/khaomi/cotl_api/blob/main/COTL_API/Debug/DebugManager.cs) (Debug content), [`COTL_API/CustomStructures/CustomStructureManager.cs`](https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomStructures/CustomStructureManager.cs) (Structures), [`COTL_API/CustomInventory`](https://github.com/khaomi/cotl_api/tree/main/COTL_API/CustomInventory) (Items and food)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Runtime Core"]
  node_plugin["Plugin lifecycle<br/>[Plugin.cs]"]
  node_guid["Stable IDs<br/>[GuidManager.cs]"]
  node_types["Type lookup<br/>[TypeManager.cs]"]
end

subgraph group_content["Custom Content"]
  node_items["Items and food"]
  node_commands["Follower commands"]
  node_skins["Custom skins"]
  node_structures["Structures"]
  node_enemies["Custom enemies"]
  node_objectives["Objectives"]
  node_othercontent["Other content types"]
end

subgraph group_integration["Game Integration"]
  node_patches["Game patches"]
  node_prefabs["Prefab integration"]
  node_settings["Mod settings"]
  node_localization["Localization"]
  node_saves["Mod save data"]
end

subgraph group_support["Mod Support"]
  node_ui["UI helpers<br/>[UIManager.cs]"]
  node_assets["Assets and icons<br/>[TextureHelper.cs]"]
  node_audio["Custom audio<br/>[SoundLoader.cs]"]
  node_debug["Debug content<br/>[DebugManager.cs]"]
end

node_modder(("Mod author"))
node_game(("Cult of the Lamb"))
node_save[("Game save/config")]

node_modder -.->|"initializes"| node_plugin
node_plugin -->|"configures"| node_settings
node_plugin -->|"loads"| node_saves
node_plugin -->|"enables"| node_debug
node_debug -->|"registers"| node_commands
node_debug -->|"registers"| node_skins
node_debug -->|"registers"| node_structures
node_debug -->|"exercises"| node_objectives
node_items -->|"allocates IDs"| node_guid
node_commands -->|"allocates IDs"| node_guid
node_structures -->|"allocates IDs"| node_guid
node_objectives -->|"adds quests"| node_game
node_items -.->|"extended by"| node_patches
node_patches -.->|"patches runtime"| node_game
node_structures -->|"resolves structures"| node_prefabs
node_prefabs -->|"instantiates"| node_game
node_settings -->|"binds config"| node_save
node_saves -.->|"persists data"| node_save
node_plugin -->|"configures"| node_skins
node_plugin -->|"registers"| node_items
node_plugin -->|"restores data"| node_objectives
node_types -->|"patches type lookup"| node_game
node_items -->|"loads icons"| node_assets
node_structures -->|"loads sprites"| node_assets
node_skins -.->|"applies skins"| node_game
node_othercontent -.->|"extends gameplay"| node_game
node_localization -.->|"localizes content"| node_game
node_audio -.->|"loads sounds"| node_game
node_ui -.->|"supports UI"| node_game

click node_plugin "https://github.com/khaomi/cotl_api/blob/main/COTL_API/Plugin.cs"
click node_guid "https://github.com/khaomi/cotl_api/blob/main/COTL_API/Guid/GuidManager.cs"
click node_types "https://github.com/khaomi/cotl_api/blob/main/COTL_API/Guid/TypeManager.cs"
click node_items "https://github.com/khaomi/cotl_api/tree/main/COTL_API/CustomInventory"
click node_commands "https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomFollowerCommand/CustomFollowerCommand.cs"
click node_skins "https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomSkins/CustomSkinManager.cs"
click node_structures "https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomStructures/CustomStructureManager.cs"
click node_enemies "https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomEnemy/CustomEnemyManager.cs"
click node_objectives "https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomObjectives/CustomObjectiveManager.cs"
click node_othercontent "https://github.com/khaomi/cotl_api/tree/main/COTL_API"
click node_patches "https://github.com/khaomi/cotl_api/tree/main/COTL_API/CustomInventory/Patches"
click node_prefabs "https://github.com/khaomi/cotl_api/blob/main/COTL_API/Prefabs/CustomPrefabManager.cs"
click node_settings "https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomSettings/CustomSettingsManager.cs"
click node_localization "https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomLocalization/CustomLocalizationManager.cs"
click node_saves "https://github.com/khaomi/cotl_api/blob/main/COTL_API/Saves/ModdedSaveManager.cs"
click node_ui "https://github.com/khaomi/cotl_api/blob/main/COTL_API/UI/UIManager.cs"
click node_assets "https://github.com/khaomi/cotl_api/blob/main/COTL_API/Helpers/TextureHelper.cs"
click node_audio "https://github.com/khaomi/cotl_api/blob/main/COTL_API/Sounds/SoundLoader.cs"
click node_debug "https://github.com/khaomi/cotl_api/blob/main/COTL_API/Debug/DebugManager.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_plugin,node_guid,node_types toneBlue
class node_items,node_commands,node_skins,node_structures,node_enemies,node_objectives,node_othercontent,node_save toneAmber
class node_patches,node_prefabs,node_settings,node_localization,node_saves toneMint
class node_ui,node_assets,node_audio,node_debug toneRose
class node_modder,node_game toneIndigo
```

## Components

### Runtime Core

- [Plugin lifecycle](https://github.com/khaomi/cotl_api/blob/main/COTL_API/Plugin.cs): `COTL_API/Plugin.cs`
- [Stable IDs](https://github.com/khaomi/cotl_api/blob/main/COTL_API/Guid/GuidManager.cs): `COTL_API/Guid/GuidManager.cs`
- [Type lookup](https://github.com/khaomi/cotl_api/blob/main/COTL_API/Guid/TypeManager.cs): `COTL_API/Guid/TypeManager.cs`

### Custom Content

- [Items and food](https://github.com/khaomi/cotl_api/tree/main/COTL_API/CustomInventory): `COTL_API/CustomInventory`
- [Follower commands](https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomFollowerCommand/CustomFollowerCommand.cs): `COTL_API/CustomFollowerCommand/CustomFollowerCommand.cs`
- [Custom skins](https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomSkins/CustomSkinManager.cs): `COTL_API/CustomSkins/CustomSkinManager.cs`
- [Structures](https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomStructures/CustomStructureManager.cs): `COTL_API/CustomStructures/CustomStructureManager.cs`
- [Custom enemies](https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomEnemy/CustomEnemyManager.cs): `COTL_API/CustomEnemy/CustomEnemyManager.cs`
- [Objectives](https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomObjectives/CustomObjectiveManager.cs): `COTL_API/CustomObjectives/CustomObjectiveManager.cs`
- [Other content types](https://github.com/khaomi/cotl_api/tree/main/COTL_API): `COTL_API`

### Game Integration

- [Game patches](https://github.com/khaomi/cotl_api/tree/main/COTL_API/CustomInventory/Patches): `COTL_API/CustomInventory/Patches`
- [Prefab integration](https://github.com/khaomi/cotl_api/blob/main/COTL_API/Prefabs/CustomPrefabManager.cs): `COTL_API/Prefabs/CustomPrefabManager.cs`
- [Mod settings](https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomSettings/CustomSettingsManager.cs): `COTL_API/CustomSettings/CustomSettingsManager.cs`
- [Localization](https://github.com/khaomi/cotl_api/blob/main/COTL_API/CustomLocalization/CustomLocalizationManager.cs): `COTL_API/CustomLocalization/CustomLocalizationManager.cs`
- [Mod save data](https://github.com/khaomi/cotl_api/blob/main/COTL_API/Saves/ModdedSaveManager.cs): `COTL_API/Saves/ModdedSaveManager.cs`

### Mod Support

- [UI helpers](https://github.com/khaomi/cotl_api/blob/main/COTL_API/UI/UIManager.cs): `COTL_API/UI/UIManager.cs`
- [Assets and icons](https://github.com/khaomi/cotl_api/blob/main/COTL_API/Helpers/TextureHelper.cs): `COTL_API/Helpers/TextureHelper.cs`
- [Custom audio](https://github.com/khaomi/cotl_api/blob/main/COTL_API/Sounds/SoundLoader.cs): `COTL_API/Sounds/SoundLoader.cs`
- [Debug content](https://github.com/khaomi/cotl_api/blob/main/COTL_API/Debug/DebugManager.cs): `COTL_API/Debug/DebugManager.cs`

### Other components

- **Mod author**
- **Cult of the Lamb**
- **Game save/config**

## Connections

- Mod author → Plugin lifecycle: initializes
- Plugin lifecycle → Mod settings: configures (evidence: `COTL_API/Plugin.cs`)
- Plugin lifecycle → Mod save data: loads (evidence: `COTL_API/Plugin.cs`)
- Plugin lifecycle → Debug content: enables (evidence: `COTL_API/Plugin.cs`)
- Debug content → Follower commands: registers (evidence: `COTL_API/Debug/DebugManager.cs`)
- Debug content → Custom skins: registers (evidence: `COTL_API/Debug/DebugManager.cs`)
- Debug content → Structures: registers (evidence: `COTL_API/Debug/DebugManager.cs`)
- Debug content → Objectives: exercises (evidence: `COTL_API/Debug/DebugManager.cs`)
- Items and food → Stable IDs: allocates IDs (evidence: `COTL_API/CustomInventory/CustomItemManager.cs`)
- Follower commands → Stable IDs: allocates IDs (evidence: `COTL_API/CustomFollowerCommand/CustomFollowerCommandManager.cs`)
- Structures → Stable IDs: allocates IDs (evidence: `COTL_API/CustomStructures/CustomStructureManager.cs`)
- Objectives → Cult of the Lamb: adds quests (evidence: `COTL_API/CustomObjectives/CustomObjectiveManager.cs`)
- Items and food → Game patches: extended by
- Game patches → Cult of the Lamb: patches runtime
- Structures → Prefab integration: resolves structures (evidence: `COTL_API/Prefabs/CustomPrefabManager.cs`)
- Prefab integration → Cult of the Lamb: instantiates (evidence: `COTL_API/Prefabs/CustomPrefabManager.cs`)
- Mod settings → Game save/config: binds config (evidence: `COTL_API/CustomSettings/CustomSettingsManager.cs`)
- Mod save data → Game save/config: persists data
- Plugin lifecycle → Custom skins: configures (evidence: `COTL_API/Plugin.cs`)
- Plugin lifecycle → Items and food: registers (evidence: `COTL_API/Plugin.cs`)
- Plugin lifecycle → Objectives: restores data (evidence: `COTL_API/Plugin.cs`)
- Type lookup → Cult of the Lamb: patches type lookup (evidence: `COTL_API/Guid/TypeManager.cs`)
- Items and food → Assets and icons: loads icons (evidence: `COTL_API/CustomInventory/CustomInventoryItem.cs`)
- Structures → Assets and icons: loads sprites
- Custom skins → Cult of the Lamb: applies skins
- Other content types → Cult of the Lamb: extends gameplay (evidence: `README.md`)
- Localization → Cult of the Lamb: localizes content
- Custom audio → Cult of the Lamb: loads sounds
- UI helpers → Cult of the Lamb: supports UI
