Files
mtgodot-poc/project/fly_data_msf_test.gd
T
shenandshen c93894313a fix: 装备属性面板避让逻辑 + 多项功能更新
- item_tooltip_view.gd: 新增 avoid_rect 属性,tooltip 与装备窗口重叠时自动推到左侧
- inventory_ui.gd: 悬停装备时传入窗口矩形作为避让区域
- 包含其他累积的功能开发和测试文件
2026-09-21 16:38:59 -07:00

64 lines
2.7 KiB
GDScript

# fly_data_msf_test —— CFlyingData::LoadScriptFile parity.
extends SceneTree
const AssetRoot = preload("res://asset_root.gd")
const FlyObject = preload("res://fly_object.gd")
var failures := 0
func check(ok: bool, label: String) -> void:
if not ok:
failures += 1
printerr("FAIL: " + label)
func _init() -> void:
call_deferred("run")
func run() -> void:
var root := AssetRoot.path()
var geom = FlyObject.FlyData.load_msf(
root.path_join("PC/ymir work/pc/warrior/effect/geompung.msf"), root)
check(geom != null, "geompung.msf loads")
if geom != null:
check(is_equal_approx(geom.init_vel, 20.0), "InitialVelocity converts cm/s to m/s")
check(is_equal_approx(geom.flat_range, 1000.0), "Range converts cm to m")
check(is_equal_approx(geom.bomb_range, 0.1), "BombRange converts cm to m")
check(geom.is_homing and is_equal_approx(geom.homing_max_angle, 3.0),
"HomingFlag/HomingMaxAngle match reference")
check(geom.accel.is_equal_approx(Vector3(0.0, -30.0, 0.0)),
"Acceleration converts cm/s² to m/s²")
check(geom.bomb_effect.get_file().get_basename() == "geompung_blow",
"BombEffect resolves relative to the .msf directory")
check(geom.attach_data.size() == 1, "AttachData group is retained")
if geom.attach_data.size() == 1:
var attach: Dictionary = geom.attach_data[0]
check(int(attach.get("type", -1)) == 1 and int(attach.get("fly_type", -1)) == 1,
"AttachData type/fly type match reference")
check(bool(attach.get("has_tail", false)) and
is_equal_approx(float(attach.get("tail_length", 0.0)), 0.15)
and is_equal_approx(float(attach.get("tail_size", 0.0)), 0.07),
"AttachData tail time stays seconds and size converts cm to metres")
var exp = FlyObject.FlyData.load_msf(
root.path_join("Effect/ymir work/effect/etc/gathering/ga_piece_yellow_small2.msf"), root)
check(exp != null, "indexed EXP resource loads")
if exp != null:
check(exp.spreading and is_equal_approx(exp.init_vel, -1.0) and
is_equal_approx(exp.cone_angle, 90.0),
"EXP resource keeps spreading, velocity and cone")
check(exp.angular_velocity.is_equal_approx(Vector3(0.0, 450.0, 0.0)),
"AngularVelocity remains degrees per second")
var arrow = FlyObject.FlyData.load_msf(
root.path_join("PC/ymir work/pc/assassin/effect/arrow_01.msf"), root)
check(arrow != null and is_equal_approx(arrow.init_vel, 40.0) and
is_equal_approx(arrow.flat_range, 25.0) and is_equal_approx(arrow.bomb_range, 0.2),
"arrow resource keeps authoritative speed/range/hit radius")
check(FlyObject.FLY_NONE == 0 and FlyObject.FLY_EXP == 1 and
FlyObject.FLY_HP_SMALL == 15 and FlyObject.FLY_SKILL_MUYEONG == 16,
"indexed fly enum matches PythonEffectModule")
if failures == 0:
print("PASS: fly_data_msf_test")
quit(1 if failures else 0)