{
  "schema_version": 1,
  "diagram_type": "architecture",
  "meta": {
    "title": "Infernus 单仓架构与子包",
    "locale": "zh-CN",
    "quality_profile": "showcase"
  },
  "layout": {
    "mode": "grid",
    "origin": [
      20,
      40
    ],
    "cols": 10,
    "gapX": 8,
    "gapY": 34,
    "cellW": 120,
    "cellH": 60
  },
  "components": [
    {
      "id": "create_app",
      "type": "backend",
      "label": "create-app",
      "sublabel": "脚手架 CLI",
      "row": 0,
      "col": 0
    },
    {
      "id": "gamemode",
      "type": "frontend",
      "label": "业务 Gamemode",
      "sublabel": "业务脚本入口",
      "row": 1,
      "col": 0
    },
    {
      "id": "core_pkg",
      "type": "backend",
      "label": "@infernus/core",
      "sublabel": "核心库",
      "row": 2,
      "col": 0
    },
    {
      "id": "samp_node",
      "type": "cloud",
      "label": "samp-node 插件",
      "sublabel": "Node 运行时",
      "row": 3,
      "col": 0
    },
    {
      "id": "fs_pkg",
      "type": "backend",
      "label": "@infernus/fs",
      "sublabel": "内置脚本集合",
      "row": 0,
      "col": 1
    },
    {
      "id": "types_pkg",
      "type": "backend",
      "label": "@infernus/types",
      "sublabel": "类型声明",
      "row": 1,
      "col": 1
    },
    {
      "id": "omp_server",
      "type": "cloud",
      "label": "open.mp Server",
      "sublabel": "服务端宿主",
      "row": 2,
      "col": 1
    },
    {
      "id": "nodejs",
      "type": "cloud",
      "label": "Node.js 22",
      "sublabel": "JS 运行时",
      "row": 3,
      "col": 1
    },
    {
      "id": "shared_pkg",
      "type": "external",
      "label": "@infernus/shared",
      "sublabel": "构建期共享代码",
      "row": 3,
      "col": 2
    },
    {
      "id": "raknet",
      "type": "backend",
      "label": "raknet",
      "sublabel": "网络包与同步",
      "row": 0,
      "col": 3
    },
    {
      "id": "nex_ac",
      "type": "security",
      "label": "nex-ac",
      "sublabel": "服务端反作弊",
      "row": 0,
      "col": 4
    },
    {
      "id": "weapon_config",
      "type": "security",
      "label": "weapon-config",
      "sublabel": "武器伤害与同步",
      "row": 1,
      "col": 3
    },
    {
      "id": "query",
      "type": "backend",
      "label": "query",
      "sublabel": "服务器状态查询",
      "row": 1,
      "col": 4
    },
    {
      "id": "streamer",
      "type": "backend",
      "label": "streamer",
      "sublabel": "实体流式加载",
      "row": 0,
      "col": 6
    },
    {
      "id": "colandreas",
      "type": "backend",
      "label": "colandreas",
      "sublabel": "碰撞体查询",
      "row": 0,
      "col": 7
    },
    {
      "id": "mapandreas",
      "type": "backend",
      "label": "mapandreas",
      "sublabel": "地形高度查询",
      "row": 0,
      "col": 8
    },
    {
      "id": "map_loader",
      "type": "backend",
      "label": "map-loader",
      "sublabel": "地图文件加载",
      "row": 1,
      "col": 6
    },
    {
      "id": "mapfix",
      "type": "backend",
      "label": "mapfix",
      "sublabel": "地图漏洞修补",
      "row": 1,
      "col": 7
    },
    {
      "id": "gps",
      "type": "backend",
      "label": "gps",
      "sublabel": "导航与寻路",
      "row": 1,
      "col": 8
    },
    {
      "id": "cef",
      "type": "backend",
      "label": "cef",
      "sublabel": "浏览器界面",
      "row": 2,
      "col": 3
    },
    {
      "id": "ompp",
      "type": "backend",
      "label": "ompp",
      "sublabel": "open.mp 扩展",
      "row": 2,
      "col": 4
    },
    {
      "id": "progress",
      "type": "backend",
      "label": "progress",
      "sublabel": "进度条显示",
      "row": 2,
      "col": 5
    },
    {
      "id": "qrcode",
      "type": "backend",
      "label": "qrcode",
      "sublabel": "二维码生成",
      "row": 3,
      "col": 3
    },
    {
      "id": "s_art",
      "type": "backend",
      "label": "s-art",
      "sublabel": "图像渲染",
      "row": 3,
      "col": 4
    },
    {
      "id": "e_selection",
      "type": "backend",
      "label": "e-selection",
      "sublabel": "模型选择菜单",
      "row": 3,
      "col": 5
    },
    {
      "id": "fcnpc",
      "type": "backend",
      "label": "fcnpc",
      "sublabel": "NPC 与机器人",
      "row": 2,
      "col": 7
    },
    {
      "id": "samp_voice",
      "type": "backend",
      "label": "samp-voice",
      "sublabel": "语音聊天",
      "row": 2,
      "col": 8
    },
    {
      "id": "veh_para",
      "type": "backend",
      "label": "veh-para",
      "sublabel": "载具降落伞",
      "row": 2,
      "col": 9
    },
    {
      "id": "distance",
      "type": "backend",
      "label": "distance",
      "sublabel": "距离计算",
      "row": 3,
      "col": 7
    },
    {
      "id": "drift_detection",
      "type": "backend",
      "label": "drift-detection",
      "sublabel": "漂移检测",
      "row": 3,
      "col": 8
    },
    {
      "id": "rec",
      "type": "backend",
      "label": "rec",
      "sublabel": "录制格式转换",
      "row": 3,
      "col": 9
    }
  ],
  "boundaries": [
    {
      "kind": "region",
      "label": "网络与反作弊",
      "wraps": [
        "raknet",
        "nex_ac",
        "weapon_config",
        "query"
      ]
    },
    {
      "kind": "region",
      "label": "世界、地形与导航",
      "wraps": [
        "streamer",
        "colandreas",
        "mapandreas",
        "map_loader",
        "mapfix",
        "gps"
      ]
    },
    {
      "kind": "region",
      "label": "界面与呈现",
      "wraps": [
        "cef",
        "ompp",
        "progress",
        "qrcode",
        "s_art",
        "e_selection"
      ]
    },
    {
      "kind": "region",
      "label": "玩家与玩法",
      "wraps": [
        "fcnpc",
        "samp_voice",
        "veh_para",
        "distance",
        "drift_detection",
        "rec"
      ]
    }
  ],
  "connections": [
    {
      "id": "createapp-scaffolds-gamemode",
      "from": "create_app",
      "to": "gamemode",
      "label": "生成骨架",
      "labelAt": [
        80,
        114
      ]
    },
    {
      "id": "gamemode-imports-core",
      "from": "gamemode",
      "to": "core_pkg",
      "label": "import core",
      "variant": "emphasis",
      "labelAt": [
        80,
        208
      ]
    },
    {
      "id": "core-calls-native",
      "from": "core_pkg",
      "to": "samp_node",
      "label": "callNative",
      "variant": "emphasis",
      "labelAt": [
        80,
        302
      ]
    }
  ],
  "cards": [
    {
      "dot": "cyan",
      "title": "三种实现路数",
      "items": [
        "包装原生插件：raknet、streamer、colandreas、cef、ompp、fcnpc 把插件原生包成带类型函数",
        "增强 core 行为：nex-ac、weapon-config、veh-para、distance 替换 core 的原生调用，改写伤害与位置逻辑",
        "纯 TypeScript：mapandreas、rec、query、e-selection 完全不用原生插件"
      ]
    },
    {
      "dot": "emerald",
      "title": "core 提供的接入面",
      "items": [
        "defineEvent 建事件，监听器按注册顺序组成中间件链，用 next() 传递",
        "defineHooks(Class) 返回原始方法快照与 setHook，用于替换类方法",
        "GameMode.use() 只入队，装载发生在 onInit"
      ]
    },
    {
      "dot": "violet",
      "title": "构建与运行时边界",
      "items": [
        "scripts/build-all.ts 串行构建：streamer、core、raknet，再其余",
        "每包先 type-check 再 rolldown；产物为 bundle.mjs / bundle.js / bundle.d.ts",
        "samp-node 由 open.mp 加载并注入全局 samp；streamer 与 types 不发布"
      ]
    }
  ]
}
