Detonate rifle grenades on impact with original Half-Life fireball

This commit is contained in:
enne2
2026-10-15 14:20:07 +02:00
parent ae32ad9615
commit 5761e160c1
12 changed files with 581 additions and 81 deletions
+34
View File
@@ -0,0 +1,34 @@
extends SceneTree
## Capture the real impact effect in the Compatibility renderer, no remote score calls.
func _initialize() -> void:
call_deferred("run_test")
func run_test() -> void:
root.size = Vector2i(1280, 720)
var world = load("res://scenes/main.tscn").instantiate()
root.add_child(world)
world.spawning = true
world.start_screen.hide()
world.player.set_physics_process(false)
world.player.position = Vector3(0, 0.1, 4)
world.player.camera.look_at(Vector3(0, 1, -1))
Input.mouse_mode = Input.MOUSE_MODE_VISIBLE
await create_timer(0.3).timeout
var grenade = load("res://scripts/grenade.gd").new()
grenade.position = Vector3(0, 0.6, -1)
world.add_child(grenade)
grenade.linear_velocity = Vector3(0, -4, 0)
await grenade.detonated
await process_frame
var effect = world.get_node("GrenadeExplosion")
effect.set_process(false)
for index in [0, 3, 7, 11, 14]:
effect.fireball.show()
effect._set_frame(index)
await process_frame
await RenderingServer.frame_post_draw
root.get_texture().get_image().save_png("/tmp/zombie-grenade-frame-%02d.png" % index)
print("SHOT: original sprite frames 0/3/7/11/14 at real floor impact")
world.queue_free()
await process_frame
quit()