B8: Thrown powder kegs with line-of-sight blasts

Fire with a powder keg held now throws one (Explosives.throw): lobbed along
the look direction, it drops down anything it strikes, rests where it lands,
falls again if its support goes, and blows when its fuse runs out (3 s).

The blast (Explosives.blast) reaches blast_radius, measured to the nearest
point of each body, piece or prop:
- terrain, pieces, props and fixed solids shield what is behind them;
  players are hit if their body middle or head is in sight;
- damage falls off linearly to BLAST_EDGE_FACTOR at the edge, times tier;
- players take damage armor first, credited to the thrower, who takes
  BLAST_SELF_FACTOR of their own;
- pieces and props take structure_damage, so kegs can breach breakwaters.
Everything reached is worked out before any damage is applied.

Line of sight uses a per-blast Sight: the nearby solids once, a cheap box
pre-check per ray, and a coarse terrain check skipped above the highest
ground in reach. Four kegs blowing on one tick inside a 5x5x3 stone fort
take about 5 ms, under the 12 ms tick budget (tested).

Kegs in flight and lying lit are drawn with the item models (EntityView);
capture scenario items_kegs. A blast emits "explosion" for A7's effects and
an impact the sound director already plays as keg_blast.

The launcher and bots that throw are follow-up #83.

Closes #22

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-14 09:04:54 -05:00
co-authored by Claude Opus 5.5
parent 36d474695a
commit 238e8e4463
17 changed files with 690 additions and 7 deletions
+13 -1
View File
@@ -451,13 +451,25 @@ const WEAPONS: Dictionary = {
"spread": 0.6, "bloom": 0.0, "ammo": "harpoons", "headshot": 1.5,
"projectile_speed": 120.0, "projectile_gravity": 6.0, "structure_factor": 2.5,
},
# Thrown (B8): lobbed at projectile_speed, it comes to rest where it lands and blows
# `fuse` seconds after the throw. `damage` to players and `structure_damage` to
# pieces and props at the middle of the blast, down to BLAST_EDGE_FACTOR of them at
# `blast_radius`. See Explosives.
"powder_keg": {
"damage": 80, "structure_damage": 400, "blast_radius": 6.0, "fuse": 3.0,
"fire_rate": 0.8, "magazine": 1, "reload": 0.0, "stack": 3,
"range_full": 0.0, "range_max": 30.0, "falloff_min": 1.0, "rarity": 2,
"spread": 0.0, "bloom": 0.0,
"spread": 0.0, "bloom": 0.0, "projectile_speed": 17.0, "projectile_gravity": 12.0,
},
}
## A blast does this share of its damage at the edge of its radius, rising linearly to
## all of it at the middle.
const BLAST_EDGE_FACTOR: float = 0.3
## The share of a blast's damage its own thrower takes.
const BLAST_SELF_FACTOR: float = 0.5
## A throw leaves this much above the look direction (added to its y, then normalised),
## so a level throw lobs.
const THROW_LIFT: float = 0.25
## A network client sees other players late. The server judges a hitscan shot against
## where they were when the shooter saw them, going back at most this many ticks (half
## a second). Past that the shooter has to lead the target.