Files
TankIC/build_bundle.py
T
TermiNexus 4005213226 feat(tools): 新版本工具链移植 + 本地镜像单包加载,中继改为原样直发与异步有序落盘
- hornet 工具链:无 ght 启动;透视冻结节点拖拽跟随、金箱标记、性能优化;雷达死亡红叉;鼠标稳定器;窗口布局持久化

- 本地镜像:切割与单包加载(pack_unpacked.js)+ SW 单包缓存 + F5 兜底刷新;入口更新为 main.9f4e7a89.js

- 中继 wss_server.js:转发改 socket 反压的原样直发(零等待零缓存);落盘改单条有序异步队列(默认开启);新增反压看门狗(默认 60s)
2026-10-11 19:35:54 +08:00

71 lines
2.8 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""3DTank 工具链 bundle 构建脚本
将各分开编写的 JS 文件按依赖顺序 concat 成一个 3dtank_bundle.js
输出到项目根目录,粘贴到浏览器控制台即可一键加载全部功能
"""
import os
import sys
BASE = os.path.dirname(os.path.abspath(__file__))
TOOLS = os.path.join(BASE, "tools")
OUTPUT = os.path.join(BASE, "3dtank_bundle.js")
# 同时复制到 unpacked 目录供 main.b7114b43.js 自动加载
UNPACKED_DIR = os.path.join(BASE, "3dtank.com", "play", "static", "js", "unpacked")
UNPACKED_OUTPUT = os.path.join(UNPACKED_DIR, "hornet_bundle.js")
# 按依赖顺序加载
FILES = [
"hook_gamemode.js", # 1. Hook 捕获 GameMode(异步)
"hornet_lib.js", # 2. 公共库(软警告,不阻塞加载)
"hornet_radar.js", # 3. 雷达模块 -> __hornetTools__.Radar
"hornet_3d_wireframe.js",# 4. 3D透视模块 -> __hornetTools__.Wireframe
"hornet_rearview.js", # 5. 后视镜模块 -> __hornetTools__.Rearview
"hornet_aim_warning.js", # 6. 瞄准警告模块 -> __hornetTools__.AimWarning
"hornet_freelook.js", # 7. 自由视角模块 -> __hornetTools__.FreeLook
"hornet_warsandbox.js", # 8. 战争沙盘模块 -> __hornetTools__.WarSandbox
"hornet_mouse.js", # 9. 鼠标输入稳定器 -> __hornetTools__.Mouse
"hornet_panel.js", # 10. 控制面板(Alt+T + HUD)
]
HEADER = """// ============================================================
// 3DTank 工具链 Bundle (自动生成,请勿手动编辑)
// 构建: python build_bundle.py
// 用法: 全选粘贴到 3DTank 游戏页面控制台
// 操作: Alt+T 打开控制面板 | 左上角 HUD 显示状态
// ============================================================
"""
def main():
parts = []
total = 0
for fn in FILES:
fp = os.path.join(TOOLS, fn)
if not os.path.exists(fp):
print("[ERROR] 文件不存在: " + fp)
sys.exit(1)
with open(fp, 'r', encoding='utf-8') as f:
content = f.read()
size = len(content.encode('utf-8'))
parts.append("// ===== " + fn + " =====\n" + content)
print("[OK] " + fn + " (" + str(size) + " bytes)")
total += size
bundle = HEADER + "\n\n".join(parts) + "\n"
with open(OUTPUT, 'w', encoding='utf-8') as f:
f.write(bundle)
print("\n[DONE] 输出: " + OUTPUT)
print(" 大小: " + str(len(bundle.encode('utf-8'))) + " bytes")
print(" 模块: " + str(len(FILES)) + " 个文件")
# 复制到 unpacked 目录供 main.b7114b43.js 自动加载
try:
with open(UNPACKED_OUTPUT, 'w', encoding='utf-8') as f:
f.write(bundle)
print(" 已复制到: " + UNPACKED_OUTPUT)
except Exception as e:
print(" [WARN] 复制到 unpacked 失败: " + str(e))
if __name__ == '__main__':
main()