#89: the default gun bends onto a target near the aimed heading

Aiming with a thumb on a stick is never exact, and at 950 units a couple of
degrees is a long miss. A shot fired roughly toward an enemy now goes at it.

28 degrees of cone, chosen so that pointing at something hits it while the
shot still visibly goes where the player pointed. Past about 45 the gun starts
picking its own targets, which is the behaviour #80 deliberately removed.

Enemies only, never asteroids. Snapping onto a rock while the player is trying
to hit the thing shooting at them would be the assist working against them,
and rocks are large and stationary enough to hit on purpose.

The aim guide is drawn through the SAME helper the gun fires through, so the
dotted line bends with the shot. A guide showing the raw stick heading while
the bolt took an assisted one would be the same class of mismatch #86 removed
between the guide's length and a bolt's actual reach - and this one would have
been harder to notice, because the line would look right most of the time.

Range 620 -> 950, the other half of the ticket.

Also swept the project root again: Godot keeps resurrecting pre-#84 copies of
moved files there from its own cache. None this time.

Suite 120/120.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Loïc Wisniewski 2026-08-22 03:19:52 +02:00
commit 5f3615026d
5 changed files with 204 additions and 6 deletions

View file

@ -21,6 +21,10 @@ const GUIDE_GAP: float = 16.0
const GUIDE_WIDTH: float = 2.0
const GUIDE_COLOR: Color = Color(1.0, 0.55, 0.38, 0.28)
# By path rather than by class name, for the load-order reason documented in
# PlanetSetups and elsewhere.
const WEAPON_COMPONENT = preload("res://vessels/VesselWeaponComponent.gd")
@onready var fleet: Node2D = get_node("../Fleet")
# Optional so a scene without a fire stick (a preview, a test harness) still
# runs - the guns simply stay quiet, which is the correct resting state.
@ -82,7 +86,10 @@ func _draw() -> void:
if reach <= 0.0:
return
var origin: Vector2 = fleet.get_centroid()
var heading: Vector2 = aim_direction.normalized()
# Drawn along the heading a shot will ACTUALLY take, assist included, so
# the line keeps telling the truth about where fire is going (#89).
var heading: Vector2 = WEAPON_COMPONENT.assisted_heading(get_tree(), origin,
aim_direction, reach)
var travelled: float = GUIDE_GAP
while travelled < reach:
var dash_end: float = minf(travelled + GUIDE_DASH, reach)