Files
TankIC/build_bundle.py
TermiNexus bea22bb5f9 feat(noknockback): 新增拒绝击退开关,中弹不再被推开
在本地坦克实体的 kz7 事件派发处丢弃外力事件(ODt:作用点/方向/强度),坦克物理收不到就不产生位移与旋转;悬挂与行驶仍走 m9k 直调,不受影响。面板新增「拒绝击退」开关。字段名走 hornet_schema。
2026-10-20 20:35:19 +08:00

75 lines
3.3 KiB
Python
Raw Permalink 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_schema.js", # 2. 字段抽象层(匿名引擎字段 → 语义名,换版本只改这里)
"hornet_lib.js", # 3. 公共库(软警告,不阻塞加载)
"hornet_radar.js", # 4. 雷达模块 -> __hornetTools__.Radar
"hornet_3d_wireframe.js",# 5. 3D透视模块 -> __hornetTools__.Wireframe
"hornet_rearview.js", # 6. 后视镜模块 -> __hornetTools__.Rearview
"hornet_aim_warning.js", # 7. 瞄准警告模块 -> __hornetTools__.AimWarning
"hornet_freelook.js", # 8. 自由视角模块 -> __hornetTools__.FreeLook
"hornet_warsandbox.js", # 9. 战争沙盘模块 -> __hornetTools__.WarSandbox
"hornet_mouse.js", # 10. 鼠标输入稳定器 -> __hornetTools__.Mouse
"hornet_noclip.js", # 11. 穿坦克(忽略玩家碰撞)-> __hornetTools__.NoClip
"hornet_noknockback.js", # 12. 拒绝击退(中弹不再被推开)-> __hornetTools__.NoKnockback
"hornet_panel.js", # 13. 控制面板(Alt+T + HUD)
"hornet_prefetch.js", # 14. 车库资源预热(战局空闲时后台加载车库所需资源)
]
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()