Files
TankIC/build_bundle.py
T
TermiNexus 5b60c94b87 feat(noclip): 新增穿坦克工具并接入面板开关
清掉本地坦克碰撞形状 mask 的坦克位(bit0),可穿过其他玩家坦克;地形静态几何(category bit4)碰撞保持不变。引擎状态切换会重写 mask,运行期每帧补一次,停止时按原始快照精确还原。
2026-10-20 20:06:24 +08:00

73 lines
3.0 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_noclip.js", # 10. 穿坦克(忽略玩家碰撞)-> __hornetTools__.NoClip
"hornet_panel.js", # 11. 控制面板(Alt+T + HUD)
"hornet_prefetch.js", # 12. 车库资源预热(战局空闲时后台加载车库所需资源)
]
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()