Skip to content

ModEventMap

The ModEventMap interface defines all typed game events available through the Events.on() and Events.emit() APIs. These events correspond to in-game actions and systems.

Declaration Merging

You can extend ModEventMap to add type-safe custom events:

typescript
declare module "@hotbunny/hackhub-content-sdk" {
    interface ModEventMap {
        "MyMod.BossDefeated": { bossName: string; reward: number };
        "MyMod.LevelUp": { level: number; xp: number };
    }
}

After declaration merging, Events.on() and Events.emit() provide full type inference:

typescript
Events.on("MyMod.BossDefeated", (data) => {
    // data is typed as { bossName: string; reward: number }
    console.log(data.bossName);
});

Built-in Events

The names below are taken from the SDK's ModEventMap type, which is the authoritative, fully-typed source — the payload column summarizes each event's typed payload (the named *Event interfaces are exported from the SDK).

Terminal Events

EventPayload
Terminal.NmapScanNmapScanEvent
Terminal.SSH.Connectedstring (connected server IP)
Terminal.SSH.Disconnectedstring (disconnected server IP)
Terminal.SSH.FileDownloadSSHFileDownloadEvent
Terminal.SSH.ShutdownTerminalSSHShutdownEvent
Terminal.CommandTerminalCommandEvent
Terminal.WhoisWhoisEvent
Terminal.DirhunterDirhunterEvent
Terminal.HydraHydraEvent
Sqlmap.DumpTableSqlmapDumpTableEvent
HashcatHashcatEvent

File System Events

EventPayload
Files.OpenFileOpenEvent
Files.TransferFileTransferEvent
Files.Deleted{ id: string; name: string }

Network Events

EventPayload
Network.PortChanges{ ip: string; port: number; active: boolean }
Network.UserActivity{ userId: string; online: boolean }
Network.WifiConnected{ ip: string; ssid?: string }

Communication Events

EventPayload
WeeChat.Message{ host: string; username: string; message: any }
Mail.Received{ id: string; from: string; subject: string }
Kisscord.MessagingKisscordMessagingEvent

Wireshark Events

EventPayload
Wireshark.Started{ interface: string }
Wireshark.Stopped{}

Other Events

EventPayload
Python3.ExecFile{ file: string }
BCC.News.Opened{}

Using Events in Quests

Inside a Quest class, use this.Events.on() for automatic cleanup. Register listeners in OnObjectivesStart() (runs on claim and on every game start), not OnStart() (runs once at claim) — listeners are lost on reload and only OnObjectivesStart() re-attaches them:

typescript
@RegisterQuest
class HackTheServer extends Quest {
    // Runs on claim and on every game start, so listeners survive reloads.
    OnObjectivesStart() {
        this.Events.on("Terminal.NmapScan", (data) => {
            if (data.ip === "192.168.1.50") {
                this.completeObjective("scan");
            }
        });

        this.Events.on("Terminal.SSH.Connected", (ip) => {
            if (ip === "192.168.1.50") {
                this.completeObjective("connect");
            }
        });
    }
}

Custom Events for Cross-Mod Communication

typescript
// Register (optional, for discoverability)
Events.register("MyMod.DataReady");

// Emit
Events.emit("MyMod.DataReady", { items: ["sword", "shield"] });

// Listen (from any mod)
Events.on("MyMod.DataReady", (data) => {
    console.log(data.items);
});

Custom events are delivered through both the game event bus and the custom event bus, allowing both game-engine systems and other mods to react.

HotBunny Interactive Entertainment Inc.