# jazzylucas/calculatescrapforquota architecture

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

- Interactive diagram: https://gitdiagram.com/jazzylucas/calculatescrapforquota
- Repository: https://github.com/jazzylucas/calculatescrapforquota

## Overview

##### Main Components

a. Core Mod Component:
- Main Plugin.cs as the entry point
- Config.cs for mod configuration handling

b. Patch System:
- GrabbableObjectPatch.cs
- HudManagerPatch.cs
These handle the game's code modifications

c. Utility Layer:
- Utils directory containing:
- MathUtil.cs
- DebugUtil.cs

d. Visual/Material System:
- Scripts directory with:
- MaterialSwapper.cs
- Materials.cs

- [Game: Lethal Company]
- ↑
- [Mod Core (Plugin.cs)]
- ↓

- v                v                v
- [Patches]    [Scripts]        [Utils]

##### Key Relationships

a. Data Flow:
- How the scanning feature triggers the calculation system
- Demonstrate how optimal scrap calculation flows through the components
- Highlight system's interaction with the game's rendering

b. Dependencies:
- How Patches interact with the base game
- How MaterialSwapper depends on Materials
- Utility class usage across components

##### Integration Points

- Where the mod hooks into the game's scanning system
- HUD modification points
- Object interaction points for scrap calculation

##### Testing Component
- CalculateScrapForQuota.Tests section
- Relationship to MathUtilTest.cs

- → Direct method calls
- ⇢ Event-based communication
- ⟲ Game hook points
- ⚡ Patch injection points
- 🔍 Scanning functionality
- 💰 Quota calculation points

This will give other developers a clear understanding of:
- How the mod integrates with the game
- The flow of scrap calculation logic
- The visual feedback system
- The patch system's modification points
- The utility system's support role

Remember to keep the focus on the mod's core functionality of scanning, calculating optimal scrap for quota, and providing visual feedback, while showing how these systems interact with the base game.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Game["Lethal Company Game"]
        GameCore["Game Core System"]
    end

    subgraph ModCore["Mod Core"]
        Plugin["Plugin.cs"]:::core
        Config["Config.cs"]:::core
    end

    subgraph Patches["Patch System"]
        GrabPatch["GrabbableObjectPatch.cs"]:::patch
        HUDPatch["HudManagerPatch.cs"]:::patch
    end

    subgraph Scripts["Visual System"]
        MatSwap["MaterialSwapper.cs"]:::visual
        Materials["Materials.cs"]:::visual
    end

    subgraph Utils["Utility Layer"]
        MathUtil["MathUtil.cs"]:::utility
        DebugUtil["DebugUtil.cs"]:::utility
    end

    subgraph Tests["Testing Component"]
        MathTest["MathUtilTest.cs"]:::test
    end

    %% Core Relationships
    GameCore --> Plugin
    Plugin --> Config
    Plugin --> GrabPatch
    Plugin --> HUDPatch

    %% Patch System Relationships
    GrabPatch -.->|"⚡ Patch"| GameCore
    HUDPatch -.->|"⚡ Patch"| GameCore
    GrabPatch -->|"🔍 Scan"| MathUtil
    HUDPatch --> MatSwap

    %% Visual System Relationships
    MatSwap --> Materials
    MatSwap -.->|"⟲ Hook"| GameCore

    %% Utility Usage
    GrabPatch --> DebugUtil
    HUDPatch --> DebugUtil
    MathTest -->|"Test"| MathUtil

    %% Testing Relationships
    MathTest -.->|"Verify"| MathUtil

    %% Click Events
    click Plugin "https://github.com/JazzyLucas/CalculateScrapForQuota/blob/main/CalculateScrapForQuota/Plugin.cs"
    click Config "https://github.com/JazzyLucas/CalculateScrapForQuota/blob/main/CalculateScrapForQuota/Config.cs"
    click GrabPatch "https://github.com/JazzyLucas/CalculateScrapForQuota/blob/main/CalculateScrapForQuota/Patches/GrabbableObjectPatch.cs"
    click HUDPatch "https://github.com/JazzyLucas/CalculateScrapForQuota/blob/main/CalculateScrapForQuota/Patches/HudManagerPatch.cs"
    click MathUtil "https://github.com/JazzyLucas/CalculateScrapForQuota/blob/main/CalculateScrapForQuota/Utils/MathUtil.cs"
    click DebugUtil "https://github.com/JazzyLucas/CalculateScrapForQuota/blob/main/CalculateScrapForQuota/Utils/DebugUtil.cs"
    click MatSwap "https://github.com/JazzyLucas/CalculateScrapForQuota/blob/main/CalculateScrapForQuota/Scripts/MaterialSwapper.cs"
    click Materials "https://github.com/JazzyLucas/CalculateScrapForQuota/blob/main/CalculateScrapForQuota/Scripts/Materials.cs"
    click MathTest "https://github.com/JazzyLucas/CalculateScrapForQuota/blob/main/CalculateScrapForQuota.Tests/Utils/MathUtilTest.cs"

    %% Styling
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef patch fill:#2ecc71,stroke:#27ae60,color:white
    classDef utility fill:#f1c40f,stroke:#f39c12,color:black
    classDef visual fill:#9b59b6,stroke:#8e44ad,color:white
    classDef test fill:#e74c3c,stroke:#c0392b,color:white
    classDef game fill:#95a5a6,stroke:#7f8c8d,color:white

    %% Legend
    subgraph Legend
        L1[" "]:::core
        L2[" "]:::patch
        L3[" "]:::utility
        L4[" "]:::visual
        L5[" "]:::test
        L1---L2---L3---L4---L5
        T1["Core"]
        T2["Patches"]
        T3["Utilities"]
        T4["Visual"]
        T5["Tests"]
        L1---T1
        L2---T2
        L3---T3
        L4---T4
        L5---T5
    end
```
