# cloudsixteen/hl2rp architecture

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

- Interactive diagram: https://gitdiagram.com/cloudsixteen/hl2rp
- Repository: https://github.com/cloudsixteen/hl2rp

## Overview

##### Plugin Architecture
- Books Plugin
- Flashlight Plugin
- Stamina Plugin
- Writing Plugin

Each plugin should show:
- Client-side components (cl_*.lua)
- Server-side components (sv_*.lua)
- Shared components (sh_*.lua)
- Entity definitions
- Language support

##### Entity Relationship System
- Custom entities (cw_book, cw_paper, cw_radio, etc.)
- Their related items
- Their interactions with players
- Data flow (→)
- Dependencies (⇢)
- Inheritance (↣)

##### Resource Management
- Models (/models)
- Materials (/materials)
- Language files
- Configuration files

##### Gameplay Systems
Interconnection between:
- Factions (Administrator, Citizen, MPF, OTA, etc.)
- Classes (within each faction)
- Attributes (strength, agility, stamina, etc.)
- Commands (dispatch, broadcast, etc.)

- Blue: Core systems
- Green: Plugins
- Yellow: Entities
- Orange: Resources
- Purple: Gameplay elements

Important Implementation Details:
##### Relationship between items and their entities

Key Architectural Patterns to Highlight:
##### Entity-Component System

- All symbols used
- Connection types
- Component types
- File type indicators

Remember to maintain proper abstraction levels while showing critical implementation details that affect the system's architecture.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Framework Layer
    GarrysMod["Garry's Mod / Source Engine"]:::engine
    Clockwork["Clockwork Framework"]:::framework
    
    %% Schema Layer
    Schema["HL2RP Schema"]:::schema
    click Schema "https://github.com/CloudSixteen/HL2RP/tree/master/upload/gamemodes/clockwork_hl2rp/schema/"
    
    %% Main Systems
    GameMode["Gamemode System"]:::system
    PluginSystem["Plugin System"]:::system
    click PluginSystem "https://github.com/CloudSixteen/HL2RP/tree/master/upload/gamemodes/clockwork_hl2rp/plugins/"
    EntitySystem["Entity System"]:::system
    click EntitySystem "https://github.com/CloudSixteen/HL2RP/tree/master/upload/gamemodes/clockwork_hl2rp/schema/entities/"
    ItemSystem["Item System"]:::system
    click ItemSystem "https://github.com/CloudSixteen/HL2RP/tree/master/upload/gamemodes/clockwork_hl2rp/schema/items/"
    FactionSystem["Faction System"]:::system
    click FactionSystem "https://github.com/CloudSixteen/HL2RP/tree/master/upload/gamemodes/clockwork_hl2rp/schema/factions/"
    
    %% Additional Systems
    CommandSystem["Command System"]:::system
    click CommandSystem "https://github.com/CloudSixteen/HL2RP/tree/master/upload/gamemodes/clockwork_hl2rp/schema/commands/"
    AttributeSystem["Attribute System"]:::system
    click AttributeSystem "https://github.com/CloudSixteen/HL2RP/tree/master/upload/gamemodes/clockwork_hl2rp/schema/attributes/"
    LanguageSystem["Language System"]:::system
    click LanguageSystem "https://github.com/CloudSixteen/HL2RP/tree/master/upload/gamemodes/clockwork_hl2rp/schema/language/"
    
    %% Plugins
    subgraph Plugins
        BooksPlugin["Books Plugin"]:::plugin
        click BooksPlugin "https://github.com/CloudSixteen/HL2RP/tree/master/upload/gamemodes/clockwork_hl2rp/plugins/books/"
        FlashlightPlugin["Flashlight Plugin"]:::plugin
        click FlashlightPlugin "https://github.com/CloudSixteen/HL2RP/tree/master/upload/gamemodes/clockwork_hl2rp/plugins/flashlight/"
        StaminaPlugin["Stamina Plugin"]:::plugin
        click StaminaPlugin "https://github.com/CloudSixteen/HL2RP/tree/master/upload/gamemodes/clockwork_hl2rp/plugins/stamina/"
        WritingPlugin["Writing Plugin"]:::plugin
        click WritingPlugin "https://github.com/CloudSixteen/HL2RP/tree/master/upload/gamemodes/clockwork_hl2rp/plugins/writing/"
    end
    
    %% Resources
    subgraph Resources
        Models["Models"]:::resource
        click Models "https://github.com/CloudSixteen/HL2RP/tree/master/upload/models/"
        Materials["Materials"]:::resource
        click Materials "https://github.com/CloudSixteen/HL2RP/tree/master/upload/materials/"
    end
    
    %% Gameplay Elements
    subgraph Factions
        Administrator["Administrator"]:::faction
        Citizen["Citizen"]:::faction
        MPF["MPF"]:::faction
        OTA["OTA"]:::faction
    end
    
    %% Relationships
    GarrysMod --> Clockwork
    Clockwork --> Schema
    Schema --> GameMode
    Schema --> PluginSystem
    Schema --> EntitySystem
    Schema --> ItemSystem
    Schema --> FactionSystem
    Schema --> CommandSystem
    Schema --> AttributeSystem
    Schema --> LanguageSystem
    
    PluginSystem --> BooksPlugin
    PluginSystem --> FlashlightPlugin
    PluginSystem --> StaminaPlugin
    PluginSystem --> WritingPlugin
    
    FactionSystem --> Administrator
    FactionSystem --> Citizen
    FactionSystem --> MPF
    FactionSystem --> OTA
    
    %% Styling
    classDef engine fill:#d4d4d4,stroke:#333,stroke-width:2px
    classDef framework fill:#b3e0ff,stroke:#333,stroke-width:2px
    classDef schema fill:#99ccff,stroke:#333,stroke-width:2px
    classDef system fill:#80b3ff,stroke:#333,stroke-width:2px
    classDef plugin fill:#90EE90,stroke:#333,stroke-width:2px
    classDef resource fill:#ffb366,stroke:#333,stroke-width:2px
    classDef faction fill:#cc99ff,stroke:#333,stroke-width:2px
    
    %% Legend
    subgraph Legend
        L1["Engine"]:::engine
        L2["Framework"]:::framework
        L3["Schema"]:::schema
        L4["System"]:::system
        L5["Plugin"]:::plugin
        L6["Resource"]:::resource
        L7["Faction"]:::faction
    end
```
