Files
urm03/scripts/kinetic_projectile.gd
T
vh c340b7bc48 feat: card layer — 2-slot hand, build-generated charges, card-time freeze/dilate
Hand (CanvasLayer, PROCESS_MODE_ALWAYS): Space toggles the hand, Q/E
play slot 1/2, charges accrue from auto-fire hits (4 hits/charge, cap
5). KINETIC card: radial shockwave shove + light damage. HEAT card:
paints heat status in a radius; heat accumulates, glows, detonates at
threshold (damage only, no knockback — tag purity). Freeze/dilate is
an exposed knob: [ and ] step dilation 0.0-0.3 live.

Freeze uses SceneTree.paused, not Engine.time_scale = 0: probed on
4.7 headless — time_scale 0 still steps physics with delta 0, so
delta-independent logic (heat thresholds, contact callbacks) kept
firing while nominally frozen. Dilation > 0 uses time_scale slow-mo.
Hand._exit_tree restores pause + time_scale so hull-zero reloads can
never strand a frozen world.

Smoke gate extended: charge accrual from build hits, pause-on-open at
knob 0, HEAT x2 spend + threshold, detonation on release. 3/3 green
on nh3-dev headless 4.7.1.
2026-08-06 22:42:46 -07:00

41 lines
1.1 KiB
GDScript

extends Area2D
## KINETIC slug: damage plus knockback along its travel direction.
## Knockback is the load-bearing part — KINETIC is the one tag that
## touches the piloting layer, and the HEAT+KINETIC chemistry row
## (next slice) rides on impacts this weapon causes.
@export var speed := 420.0
@export var damage := 1.0
@export var knockback := 220.0
@export var lifetime := 0.8
var direction := Vector2.RIGHT
func _ready() -> void:
add_to_group("projectiles")
rotation = direction.angle()
body_entered.connect(_on_body_entered)
func _physics_process(delta: float) -> void:
position += direction * speed * delta
lifetime -= delta
if lifetime <= 0.0:
queue_free()
func _on_body_entered(body: Node) -> void:
if body.is_in_group("enemies"):
body.hit(damage, direction * knockback)
# The build generates charges: every landed hit feeds the hand.
var hand := get_tree().get_first_node_in_group("hand")
if hand != null:
hand.on_build_hit()
queue_free()
func _draw() -> void:
# KINETIC hue: pale steel-blue (placeholder — tag colors unassigned in canon).
draw_rect(Rect2(-5, -1.5, 10, 3), Color(0.75, 0.85, 0.95))