Task #18: Alien Ray fires a beam

The Alien Ray is now a held beam instead of a copy of the potato shot.
While fire is held it ticks every alien_ray_tick_interval (0.15 s). Each
tick traces a path from the scarecrow's center through the muzzle and on
alien_ray_range (20 m) past it, cut short at the first wall
(AlienBeam.trace on the world layer). It damages every enemy within
alien_ray_width / 2 (0.25 m) plus its hit radius of that path, flyers
included as with shots, nearest first, up to alien_ray_pierce (4), for
alien_ray_damage (1). That is about 6.7 damage a second per enemy on the
beam. Hits stay inside combat.step, so enemies.attacker credits kills.

- EnemySystem.path_hits: every enemy along a polyline, ordered along it,
  with flat ends (nothing behind the scarecrow or past the wall).
  sweep_hit is unchanged.
- AlienBeam: a WeaponModels held effect (hold 1.5 ticks, no fade). It is
  an unshaded HDR green core and glow, a muzzle light, and a flare where a
  wall stops it. Each frame it lays itself out from the muzzle along the
  model's -Z, with the same trace, so the partner's machine recomputes the
  wall clip locally. No protocol change.
- Counters: a beam_ticks counter joins attacks(), and ray ticks no
  longer count as shots_fired.
- Config: alien_ray_speed, alien_ray_lifetime and alien_ray_cooldown are
  removed. alien_ray_range, _width, _tick_interval and _pierce are added.
  The shop text says what it does now. Cost and hidden/reveal are
  unchanged.
- Sound: a zapped signal and a "zap" cue (synth alien_beam.wav, its own
  seed). The other synth files regenerate byte-identical.

Tests (test_weapons) replace the projectile-travel ray check and keep
buy/equip:
- a far target is hit on the same step;
- nothing beside, behind or past the end is hit;
- two in line and a crow are all hit;
- a line is capped at pierce;
- a wall stops it, including a barrel poking through one;
- held ticks repeat and stop on release;
- the beam is lit only while held, ends at the wall clip, follows the
  model's yaw, and the replica and attack-event paths work.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Forrest 2026-10-06 13:39:00 -04:00
parent 287b6ac6cc
commit a0aee34e3c
13 changed files with 554 additions and 44 deletions

View file

@ -155,7 +155,7 @@ extends Resource
"potato_cannon": {"name": "Potato cannon", "text": "A slow heavy potato shot that hits hard from afar", "track": "Weapon", "shop": "shed"},
"shurikens": {"name": "Shurikens", "text": "Fast, cheap throws for a quick hit", "track": "Weapon", "shop": "shed"},
"propane_torch": {"name": "Propane torch", "text": "A jet of flame that burns everything in a band ahead of you while held", "track": "Weapon", "shop": "shed"},
"alien_ray": {"name": "Alien ray", "text": "A salvaged alien weapon: a fast, powerful beam", "track": "Weapon", "shop": "shed", "hidden": true},
"alien_ray": {"name": "Alien ray", "text": "A salvaged alien weapon: a long beam that pierces everything in its line while held", "track": "Weapon", "shop": "shed", "hidden": true},
"radar": {"name": "Radar", "text": "A minimap showing nearby enemy positions", "track": "Item", "shop": "shed", "hidden": true},
"wide_fear": {"name": "Wide fear", "text": "Fear reaches 30% farther", "track": "Fear", "stat": "fear_radius", "mult": 1.3},
"quick_fear": {"name": "Quick fear", "text": "Fear recharges 20% faster", "track": "Fear", "stat": "fear_cooldown", "mult": 0.8},
@ -298,13 +298,18 @@ extends Resource
@export_range(1, 20) var torch_damage: int = 1
@export_range(1, 20) var torch_targets: int = 5
@export var torch_tick_interval: float = 0.2
## Alien Ray (the Alien ray upgrade, hidden until hidden_reveal_goop Alien Goop is collected): one
## heavy shot every alien_ray_cooldown s, alien_ray_damage each, flying fast (alien_ray_speed m/s)
## through FarmProjectiles.
@export var alien_ray_cooldown: float = 0.9
@export_range(1, 80) var alien_ray_damage: int = 9
@export var alien_ray_speed: float = 50.0
@export var alien_ray_lifetime: float = 2.0
## Alien Ray (the Alien ray upgrade, hidden until hidden_reveal_goop Alien Goop is collected): a
## beam while held (#18), a tick every alien_ray_tick_interval s, alien_ray_damage each to every
## enemy within alien_ray_width / 2 (plus its hit radius) of the beam, flyers too (the nearest
## alien_ray_pierce), from the scarecrow through the muzzle and on alien_ray_range m past it, cut
## short at the first wall (ScarecrowCombat.beam_path, EnemySystem.path_hits). It hits at once
## (no projectile). 1 every 0.15 s is about 6.7 damage a second to each enemy on the beam: the
## shed's guns do 4 to 6 to one, the torch 5 to each in its short band.
@export var alien_ray_range: float = 20.0
@export var alien_ray_width: float = 0.5
@export var alien_ray_tick_interval: float = 0.15
@export_range(1, 80) var alien_ray_damage: int = 1
@export_range(1, 20) var alien_ray_pierce: int = 4
@export_group("Radar")
## Radar (the Radar item, bought at the supply shed, hidden until hidden_reveal_goop Alien Goop is