TargetToggleandBosstargetting

版本 v1.0.2·更新於 2026-04-04

Adds a configurable hotkey to switch between Closest Enemy, Smart Aim in real time and Boss projectile targeting support, with a visible indicator on the HUD at the bottom right.

模組介紹 作者原文

TargetToggle — Megabonk Mod

A BepInEx (IL2CPP) mod that adds two configurable hotkeys to toggle targeting behavior in real time, with a HUD indicator in the bottom-right corner that only appears during a run.

Features

  • Targeting mode toggle — switch between Closest Enemy and Smart Aim on the fly
  • Boss Focus toggle — when active, prioritizes any boss over regular enemies. Falls back to your chosen targeting mode if no boss is in range
  • In-game HUD — shows current state in the bottom-right corner, only visible during a run
  • Fully configurable hotkeys — edit the BepInEx config file to use any key you want

Requirements

| Dependency | Version |

|---|---|

| BepInEx IL2CPP Pack | 6.0.738+ |

|.NET SDK (to compile) | 6.0+ |

| Megabonk | latest |

Installation

  • Make sure BepInEx IL2CPP is installed in your Megabonk folder.
  • Compile the project or download the release.dll.
  • Place TargetToggleMod.dll in BepInEx/plugins.
  • Launch the game once — BepInEx will generate the config file automatically.

Default Hotkeys

| Key | Action |

|---|---|

| T | Toggle between Closest Enemy and Smart Aim |

| Y | Toggle Boss Focus mode |

Configuration

Edit the generated config file at:

BepInEx/config/com.tuusuario.targettoggle.cfg

[Hotkeys]

ToggleTargetingMode = T

ToggleBossFocus = Y

Any Unity KeyCode value is valid — see the full list at:

HUD

  • Appears only during a run (hidden in menus and loading screens)
  • Displays the current targeting mode and boss focus state:
  • TARGET: Closest / TARGET: Smart Aim
  • TARGET: Closest | BOSS when Boss Focus is active
  • Text turns yellow when Boss Focus is enabled
  • Flashes briefly when you press a hotkey to confirm the change

How It Works

This mod uses a Harmony patch on EnemyTargeting.GetTargetedEnemy() to intercept targeting in real time — no save file modification needed.

  • Closest Enemy: directly calls GetClosestEnemy(), skipping the default logic
  • Smart Aim: lets the original method run normally
  • Boss Focus: scans colliders for any enemy with EEnemyFlag.AnyBoss and targets the closest one. If no boss is found, falls back to the active targeting mode

Project Structure

TargetToggleMod/

├── TargetTogglePlugin.cs — main plugin (hotkeys, HUD, Harmony patch)

├── MyPluginInfo.cs — GUID, name, version

├── TargetToggleMod.csproj — C# project with BepInEx references

├── manifest.json — package manifest

├── icon.png — 256x256 mod icon

└── README.md — this file

License

MIT — do whatever you want with the code.

安裝與使用 安裝:按包內說明操作

  1. 解壓本站下載的壓縮包,先讀包內的 readme / 說明檔案。
  2. 多數模組依賴遊戲的模組載入器:常見做法是用社群模組管理器(如 r2modman)選中本遊戲安裝,由管理器自動處理載入器與依賴。
  3. 手動安裝時,把模組檔案放進遊戲目錄下對應的 Mod / plugins 資料夾。
  4. 啟動遊戲確認載入成功;帶「前置依賴」的模組需要把依賴一併安裝。

不同模組的安裝位置差異較大,包內說明是最可靠的依據。

前置依賴

下面這些內容需要先安裝,否則該模組不會生效:

BepInEx-BepInExPack_IL2CPP

檔案與校驗

檔案名稱
TargetToggleandBosstargetting-1.0.2.zip
檔案大小
10.6 KiB
SHA-256
a76ac885a8d5826c66c4a02e69cebe68292f8f961fb3e444bf8639835b723d81
入庫時間
2026-10-10 18:19