29 lines
1.1 KiB
GDScript
29 lines
1.1 KiB
GDScript
extends SceneTree
|
|
const EffectPlayer = preload("res://fx/effect_player.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 fx := EffectPlayer.new()
|
|
for attached in [0, 1]:
|
|
fx.build({"particles": [{"emitter": {"CycleLength": 0.8, "CycleLoopEnable": 0,
|
|
"TimeEventLifeTime": [[0, 0.05]]}, "particle": {"AttachEnable": attached}}]})
|
|
root.add_child(fx)
|
|
fx.play(true)
|
|
for i in range(2):
|
|
check(fx._emitters[i].local_coords == bool(i), "AttachEnable determines local/world simulation")
|
|
check(not fx._emitters[i].one_shot, "effect cleanup must not impose single GPU lifetime")
|
|
await create_timer(0.3).timeout
|
|
for emitter in fx._emitters:
|
|
check(emitter.emitting, "short-lived particles still emit inside source cycle")
|
|
await create_timer(0.6).timeout
|
|
for emitter in fx._emitters:
|
|
check(not emitter.emitting, "source cycle still stops emission")
|
|
fx.free()
|
|
print("effect_emission_test: failures=%d" % failures)
|
|
quit(1 if failures else 0)
|