# samuelsbenghe/homingglobalprojectile architecture

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

- Interactive diagram: https://gitdiagram.com/samuelsbenghe/homingglobalprojectile
- Repository: https://github.com/samuelsbenghe/homingglobalprojectile

## Overview

This small tModLoader mod adds per-projectile homing behavior through a GlobalProjectile AI override. For eligible player-owned projectiles, it waits briefly, finds the nearest visible chaseable NPC within range, then turns the projectile toward it while preserving speed. The only runtime implementation is shown; the repository provides no README description or evidence of additional runtime subsystems.

Main entry points: [`HomingGlobalProjectile.cs`](https://github.com/samuelsbenghe/homingglobalprojectile/blob/main/HomingGlobalProjectile.cs) (Projectile AI Hook)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_homing["Projectile Homing"]
  node_projectile["Projectile AI Hook"]
end

node_player(("Local Player"))
node_npc["Chaseable NPCs"]
node_collision["Line-of-Sight Check"]

node_player -->|"owns eligibility"| node_projectile
node_projectile -->|"scans targets"| node_npc
node_projectile -->|"checks visibility"| node_collision
node_npc -->|"guides turning"| node_projectile

click node_projectile "https://github.com/samuelsbenghe/homingglobalprojectile/blob/main/HomingGlobalProjectile.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_projectile toneBlue
class node_player,node_npc,node_collision toneIndigo
```

## Components

### Projectile Homing

- [Projectile AI Hook](https://github.com/samuelsbenghe/homingglobalprojectile/blob/main/HomingGlobalProjectile.cs): `HomingGlobalProjectile.cs`

### Other components

- **Local Player**
- **Chaseable NPCs**
- **Line-of-Sight Check**

## Connections

- Local Player → Projectile AI Hook: owns eligibility (evidence: `HomingGlobalProjectile.cs`)
- Projectile AI Hook → Chaseable NPCs: scans targets (evidence: `HomingGlobalProjectile.cs`)
- Projectile AI Hook → Line-of-Sight Check: checks visibility (evidence: `HomingGlobalProjectile.cs`)
- Chaseable NPCs → Projectile AI Hook: guides turning (evidence: `HomingGlobalProjectile.cs`)
