# ifbars/snailmucus architecture

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

- Interactive diagram: https://gitdiagram.com/ifbars/snailmucus
- Repository: https://github.com/ifbars/snailmucus

## Overview

##### Project Type and Purpose
- This is a Unity‐based game mod plugin (“Snail Mucus Mod”) for the game “Schedule I,” built using C# and deployed via the MelonLoader mod loader.
- Its goal is to retexture, rename, and hook into existing game items (“Horse Semen”) and replace them with “Snail Mucus” while preserving original game mechanics.

##### File Structure Analysis
Top‐level:
- HS-SFW.sln / HS-SFW.csproj – Visual Studio solution and project files
- Core.cs – main mod entry point
- Assets/ – custom texture and model files
- Patches/ – Harmony patch classes (EquippableViewmodelPatches.cs, ItemShelfPatches.cs, ItemUIPatches.cs, TrashItemPatches.cs)
- README.md – high‐level overview
Observations:
- Core.cs initializes the mod and registers each patch class.
- Patches folder holds discrete hook definitions targeting different game subsystems (UI, 3D models, inventories).
- Assets folder contains texture/model overrides loaded at runtime.

##### README Insights
- Confirms use of MelonLoader and Harmony (implicitly).
- Points out compatibility with Mono/IL2CPP builds.

a. Main Components
1. Game Engine (Unity-based “Schedule I”)
2. Mod Loader (MelonLoader runtime + Harmony patching)
3. Mod Assembly (HS-SFW.dll)
4. Core Module (Core.cs – entry point)
5. Patch Modules (4 classes under Patches/)
6. Asset Overrides (Assets/ folder)
7. Target Game Objects/APIs (Item definitions, UI renderer, model loader, shelf logic, trash logic)
b. Relationships & Interactions
– MelonLoader injects HS-SFW.dll into the game process at startup.
– Core.cs registers Harmony patches from each patch class.
– Each patch intercepts specific game methods:
- EquippableViewmodelPatches → changes in-hand model appearance
- ItemShelfPatches → shelf display override
- TrashItemPatches → behavior in trash interactions
– When a patched method executes, custom asset loaders fetch textures/models from Assets/ and apply them.
c. Architectural Patterns & Design Principles
– Plugin architecture: the mod is a self-contained plugin loaded at runtime.
– Aspect-oriented programming via Harmony patches: cross-cutting concern (retexturing, renaming) separated into patch classes.
– Single responsibility: each Patches class handles one area of the game.
d. Key Technologies
– C# / .NET (HS-SFW.csproj)
– Unity Engine APIs (internal game methods/properties)
– MelonLoader (mod loader, runtime)
– Harmony (method hooking)

##### Detail Level
- Every patch target as a separate node if space allows.
- Runtime sequence: initialization phase vs. in‐game hook phase.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Game Engine"
        Engine["Schedule I\n(Unity Engine)"]:::engine
    end

    subgraph "Mod Loader & Patching"
        Loader["MelonLoader & Harmony"]:::loader
    end

    subgraph "Snail Mucus Mod"
        Assembly["Mod Assembly\n(HS-SFW.dll)"]:::core
        Core["Core.cs\n(Entry Point)"]:::core
        subgraph "Patch Modules"
            EVM["EquippableViewmodelPatches"]:::core
            Shelf["ItemShelfPatches"]:::core
            UI["ItemUIPatches"]:::core
            Trash["TrashItemPatches"]:::core
        end
        Assets["Assets\n(Texture & Model Overrides)"]:::assets
    end

    Docs["README.md"]:::docs

    %% Initialization Flow
    Engine -->|"Startup"| Loader
    Loader -->|"Inject HS-SFW.dll"| Assembly
    Assembly -->|"Initialize Mod"| Core
    Core -->|"Register Patches"| EVM
    Core -->|"Register Patches"| Shelf
    Core -->|"Register Patches"| UI
    Core -->|"Register Patches"| Trash

    %% Hook Interactions
    EVM -->|"OnViewmodelRender() override"| Engine
    Shelf -->|"OnShelfDisplay() override"| Engine
    UI -->|"OnInventoryRender() override"| Engine
    Trash -->|"OnTrashInteract() override"| Engine

    %% Asset Pipeline
    Assets -->|"Load textures/models"| EVM
    Assets -->|"Load textures/models"| Shelf
    Assets -->|"Load textures/models"| UI
    Assets -->|"Load textures/models"| Trash

    %% Documentation
    Docs -.->|Overview| Assembly

    %% Click Events
    click Assembly "https://github.com/ifbars/snailmucus/blob/master/HS-SFW.csproj"
    click Core "https://github.com/ifbars/snailmucus/blob/master/Core.cs"
    click EVM "https://github.com/ifbars/snailmucus/blob/master/Patches/EquippableViewmodelPatches.cs"
    click Shelf "https://github.com/ifbars/snailmucus/blob/master/Patches/ItemShelfPatches.cs"
    click UI "https://github.com/ifbars/snailmucus/blob/master/Patches/ItemUIPatches.cs"
    click Trash "https://github.com/ifbars/snailmucus/blob/master/Patches/TrashItemPatches.cs"
    click Assets "https://github.com/ifbars/snailmucus/tree/master/Assets/"
    click Docs "https://github.com/ifbars/snailmucus/blob/master/README.md"

    %% Styles
    classDef engine fill:#FFA500,stroke:#333,stroke-width:1px
    classDef loader fill:#CCCCCC,stroke:#333,stroke-width:1px
    classDef core fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef assets fill:#90EE90,stroke:#333,stroke-width:1px
    classDef docs fill:#FFFFE0,stroke:#333,stroke-width:1px
```
