Add laser ship vessel and its skill shot (#58)

A manually aimed instant beam, modelled on the gas bomber's press-drag-
release aiming (GasBombController/VesselGasBomberComponent) but firing
the moment the touch releases - no projectile travel time. Damage,
beam_range and cooldown are resolved per ship from base_stats/upgrades
(VesselLaserComponent.apply_stats(), the same pattern
VesselWeaponComponent uses) rather than hardcoded in the controller, so
the new damage/range/cooldown ship-lab upgrades actually reach them.
Cooldown lives on the component (per ship), not the controller (per
fleet) - two laser ships give two shots, the exact bug already fixed
for bombers in eb79efd.

LaserController.gd is reused unmodified by both Main.tscn and
PlanetSurface.tscn (relative ../Fleet, ../Camera2D, ../UI/LaserButton
paths, matching GasBombController), so it works identically in space
and on a landed surface. Wired into GameController's touch/drag
first-refusal chain alongside the bomb controller.

The crafter, hangar and ship-lab menus were already generic over
VesselDefinitions.fleet()/.all() - only the per-vessel Main.tscn nodes
are hand-placed, not the logic - so this repacks those rows to
5/5/6 columns and extends BuildController's onready arrays. No new
signal handlers were needed. Also fixes test_vessel_composition.gd's
hardcoded fleet-catalog size again (4 -> 5) now that laser is a fifth
fleet-eligible vessel.

Note for later tickets: a brand-new class_name script (LaserController)
resolves fine as a static type when its own file is the godot -s entry
point, but the identical type hint fails to parse ("Could not find
type") when the script holding it is only reached indirectly - e.g.
Main.tscn loaded from inside a _screenshot_tool.gd preview. Untyped
Node + duck-typed calls sidesteps it; GameController.gd's
laser_controller field documents this in place.
This commit is contained in:
Loïc Wisniewski 2026-08-16 17:29:53 +02:00
commit ed46cd77e6
18 changed files with 858 additions and 64 deletions

232
Main.tscn
View file

@ -1,4 +1,4 @@
[gd_scene load_steps=27 format=3]
[gd_scene load_steps=28 format=3]
[ext_resource type="Script" path="res://Starfield.gd" id="1"]
[ext_resource type="Script" path="res://Fleet.gd" id="2"]
@ -25,6 +25,7 @@
[ext_resource type="Script" path="res://VesselDeliveryField.gd" id="26"]
[ext_resource type="Script" path="res://ResourceTransferList.gd" id="27"]
[ext_resource type="Script" path="res://GasBombController.gd" id="29"]
[ext_resource type="Script" path="res://LaserController.gd" id="30"]
[sub_resource type="ShaderMaterial" id="1"]
shader = ExtResource("5")
@ -56,6 +57,9 @@ script = ExtResource("2")
[node name="GasBombController" type="Node2D" parent="."]
script = ExtResource("29")
[node name="LaserController" type="Node2D" parent="."]
script = ExtResource("30")
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(0, 0)
zoom = Vector2(1, 1)
@ -217,6 +221,21 @@ offset_top = -424
offset_bottom = -24
script = ExtResource("13")
[node name="LaserButton" type="Control" parent="UI"]
visible = false
mouse_filter = 2
anchor_left = 1.0
anchor_right = 1.0
anchor_top = 1.0
anchor_bottom = 1.0
offset_left = -344
offset_right = -196
offset_top = -344
offset_bottom = -196
script = ExtResource("10")
icon = 36
glow_color = Color(0.3, 0.9, 1, 1)
[node name="PivotCCWButton" type="Control" parent="UI"]
mouse_filter = 2
anchor_left = 1.0
@ -820,7 +839,7 @@ horizontal_alignment = 1
anchor_left = 0.5
anchor_right = 0.5
offset_left = -290
offset_right = -178
offset_right = -198
offset_top = 255
offset_bottom = 375
script = ExtResource("10")
@ -831,7 +850,7 @@ mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -330
offset_right = -138
offset_right = -158
offset_top = 380
offset_bottom = 460
theme_override_font_sizes/font_size = 22
@ -840,8 +859,8 @@ horizontal_alignment = 1
[node name="AvailableShield" type="Control" parent="UI/HangarMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = -134
offset_right = -22
offset_left = -168
offset_right = -76
offset_top = 255
offset_bottom = 375
script = ExtResource("10")
@ -852,8 +871,8 @@ glow_color = Color(0.45, 0.8, 1, 1)
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -174
offset_right = 18
offset_left = -208
offset_right = -36
offset_top = 380
offset_bottom = 460
theme_override_font_sizes/font_size = 22
@ -862,8 +881,8 @@ horizontal_alignment = 1
[node name="AvailableGasBomber" type="Control" parent="UI/HangarMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = 22
offset_right = 134
offset_left = -46
offset_right = 46
offset_top = 255
offset_bottom = 375
script = ExtResource("10")
@ -874,8 +893,8 @@ glow_color = Color(0.96, 0.32, 0.78, 1)
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -18
offset_right = 174
offset_left = -86
offset_right = 86
offset_top = 380
offset_bottom = 460
theme_override_font_sizes/font_size = 22
@ -884,8 +903,8 @@ horizontal_alignment = 1
[node name="AvailableCarrier" type="Control" parent="UI/HangarMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = 178
offset_right = 290
offset_left = 76
offset_right = 168
offset_top = 255
offset_bottom = 375
script = ExtResource("10")
@ -896,7 +915,29 @@ glow_color = Color(1, 0.78, 0.3, 1)
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = 138
offset_left = 36
offset_right = 208
offset_top = 380
offset_bottom = 460
theme_override_font_sizes/font_size = 22
horizontal_alignment = 1
[node name="AvailableLaser" type="Control" parent="UI/HangarMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = 198
offset_right = 290
offset_top = 255
offset_bottom = 375
script = ExtResource("10")
icon = 35
glow_color = Color(0.3, 0.9, 1, 1)
[node name="AvailableLaserLabel" type="Label" parent="UI/HangarMenu"]
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = 158
offset_right = 330
offset_top = 380
offset_bottom = 460
@ -916,7 +957,7 @@ horizontal_alignment = 1
anchor_left = 0.5
anchor_right = 0.5
offset_left = -290
offset_right = -178
offset_right = -198
offset_top = 565
offset_bottom = 685
script = ExtResource("10")
@ -927,7 +968,7 @@ mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -330
offset_right = -138
offset_right = -158
offset_top = 690
offset_bottom = 770
theme_override_font_sizes/font_size = 22
@ -936,8 +977,8 @@ horizontal_alignment = 1
[node name="FleetShield" type="Control" parent="UI/HangarMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = -134
offset_right = -22
offset_left = -168
offset_right = -76
offset_top = 565
offset_bottom = 685
script = ExtResource("10")
@ -948,8 +989,8 @@ glow_color = Color(0.45, 0.8, 1, 1)
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -174
offset_right = 18
offset_left = -208
offset_right = -36
offset_top = 690
offset_bottom = 770
theme_override_font_sizes/font_size = 22
@ -958,8 +999,8 @@ horizontal_alignment = 1
[node name="FleetGasBomber" type="Control" parent="UI/HangarMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = 22
offset_right = 134
offset_left = -46
offset_right = 46
offset_top = 565
offset_bottom = 685
script = ExtResource("10")
@ -970,8 +1011,8 @@ glow_color = Color(0.96, 0.32, 0.78, 1)
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -18
offset_right = 174
offset_left = -86
offset_right = 86
offset_top = 690
offset_bottom = 770
theme_override_font_sizes/font_size = 22
@ -980,8 +1021,8 @@ horizontal_alignment = 1
[node name="FleetCarrier" type="Control" parent="UI/HangarMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = 178
offset_right = 290
offset_left = 76
offset_right = 168
offset_top = 565
offset_bottom = 685
script = ExtResource("10")
@ -992,7 +1033,29 @@ glow_color = Color(1, 0.78, 0.3, 1)
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = 138
offset_left = 36
offset_right = 208
offset_top = 690
offset_bottom = 770
theme_override_font_sizes/font_size = 22
horizontal_alignment = 1
[node name="FleetLaser" type="Control" parent="UI/HangarMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = 198
offset_right = 290
offset_top = 565
offset_bottom = 685
script = ExtResource("10")
icon = 35
glow_color = Color(0.3, 0.9, 1, 1)
[node name="FleetLaserLabel" type="Label" parent="UI/HangarMenu"]
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = 158
offset_right = 330
offset_top = 690
offset_bottom = 770
@ -1044,7 +1107,7 @@ script = ExtResource("24")
anchor_left = 0.5
anchor_right = 0.5
offset_left = -300
offset_right = -212
offset_right = -230
offset_top = 274
offset_bottom = 394
script = ExtResource("10")
@ -1054,8 +1117,8 @@ glow_color = Color(0.25, 0.85, 1, 1)
[node name="VesselB" type="Control" parent="UI/LabMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = -172
offset_right = -84
offset_left = -194
offset_right = -124
offset_top = 274
offset_bottom = 394
script = ExtResource("10")
@ -1065,8 +1128,8 @@ glow_color = Color(0.45, 0.8, 1, 1)
[node name="VesselC" type="Control" parent="UI/LabMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = -44
offset_right = 44
offset_left = -88
offset_right = -18
offset_top = 274
offset_bottom = 394
script = ExtResource("10")
@ -1076,8 +1139,8 @@ glow_color = Color(0.96, 0.32, 0.78, 1)
[node name="VesselD" type="Control" parent="UI/LabMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = 84
offset_right = 172
offset_left = 18
offset_right = 88
offset_top = 274
offset_bottom = 394
script = ExtResource("10")
@ -1087,14 +1150,25 @@ glow_color = Color(0.95, 0.55, 0.85, 1)
[node name="VesselE" type="Control" parent="UI/LabMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = 212
offset_right = 300
offset_left = 124
offset_right = 194
offset_top = 274
offset_bottom = 394
script = ExtResource("10")
icon = 34
glow_color = Color(1, 0.78, 0.3, 1)
[node name="VesselF" type="Control" parent="UI/LabMenu"]
anchor_left = 0.5
anchor_right = 0.5
offset_left = 230
offset_right = 300
offset_top = 274
offset_bottom = 394
script = ExtResource("10")
icon = 35
glow_color = Color(0.3, 0.9, 1, 1)
[node name="VesselLabel" type="Label" parent="UI/LabMenu"]
visible = false
mouse_filter = 2
@ -1112,7 +1186,7 @@ mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -330
offset_right = -182
offset_right = -200
offset_top = 400
offset_bottom = 460
theme_override_font_sizes/font_size = 22
@ -1123,8 +1197,8 @@ text = "Interceptor"
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -202
offset_right = -54
offset_left = -224
offset_right = -94
offset_top = 400
offset_bottom = 460
theme_override_font_sizes/font_size = 22
@ -1135,8 +1209,8 @@ text = "Shield"
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = -74
offset_right = 74
offset_left = -118
offset_right = 12
offset_top = 400
offset_bottom = 460
theme_override_font_sizes/font_size = 22
@ -1147,8 +1221,8 @@ text = "Gas Bomber"
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = 54
offset_right = 202
offset_left = 12
offset_right = 118
offset_top = 400
offset_bottom = 460
theme_override_font_sizes/font_size = 22
@ -1159,14 +1233,26 @@ text = "Transporter"
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = 182
offset_right = 330
offset_left = 94
offset_right = 224
offset_top = 400
offset_bottom = 460
theme_override_font_sizes/font_size = 22
horizontal_alignment = 1
text = "Carrier"
[node name="VesselFLabel" type="Label" parent="UI/LabMenu"]
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
offset_left = 200
offset_right = 330
offset_top = 400
offset_bottom = 460
theme_override_font_sizes/font_size = 22
horizontal_alignment = 1
text = "Laser Ship"
[node name="VesselUpgradeSeparator" type="ColorRect" parent="UI/LabMenu"]
mouse_filter = 2
anchor_right = 1.0
@ -1412,7 +1498,7 @@ anchor_right = 0.5
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = -310
offset_right = -208
offset_right = -232
offset_top = -100
offset_bottom = 48
script = ExtResource("10")
@ -1425,7 +1511,7 @@ anchor_right = 0.5
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = -330
offset_right = -188
offset_right = -212
offset_top = 56
offset_bottom = 136
theme_override_font_sizes/font_size = 24
@ -1437,8 +1523,8 @@ anchor_left = 0.5
anchor_right = 0.5
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = -174
offset_right = -72
offset_left = -202
offset_right = -124
offset_top = -100
offset_bottom = 48
script = ExtResource("10")
@ -1451,8 +1537,8 @@ anchor_left = 0.5
anchor_right = 0.5
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = -194
offset_right = -52
offset_left = -222
offset_right = -104
offset_top = 56
offset_bottom = 136
theme_override_font_sizes/font_size = 24
@ -1465,8 +1551,8 @@ anchor_left = 0.5
anchor_right = 0.5
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = -38
offset_right = 64
offset_left = -94
offset_right = -16
offset_top = -100
offset_bottom = 28
script = ExtResource("10")
@ -1479,8 +1565,8 @@ anchor_left = 0.5
anchor_right = 0.5
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = -58
offset_right = 84
offset_left = -114
offset_right = 4
offset_top = 56
offset_bottom = 150
theme_override_font_sizes/font_size = 24
@ -1493,8 +1579,8 @@ anchor_left = 0.5
anchor_right = 0.5
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 98
offset_right = 200
offset_left = 14
offset_right = 92
offset_top = -100
offset_bottom = 48
script = ExtResource("10")
@ -1507,8 +1593,8 @@ anchor_left = 0.5
anchor_right = 0.5
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 78
offset_right = 220
offset_left = -6
offset_right = 112
offset_top = 56
offset_bottom = 136
theme_override_font_sizes/font_size = 24
@ -1516,6 +1602,34 @@ autowrap_mode = 2
text = "Carrier"
horizontal_alignment = 1
[node name="LaserButton" type="Control" parent="UI/CraftMenu"]
anchor_left = 0.5
anchor_right = 0.5
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 122
offset_right = 200
offset_top = -100
offset_bottom = 48
script = ExtResource("10")
icon = 35
glow_color = Color(0.3, 0.9, 1, 1)
[node name="LaserLabel" type="Label" parent="UI/CraftMenu"]
mouse_filter = 2
anchor_left = 0.5
anchor_right = 0.5
anchor_top = 0.5
anchor_bottom = 0.5
offset_left = 102
offset_right = 220
offset_top = 56
offset_bottom = 136
theme_override_font_sizes/font_size = 24
autowrap_mode = 2
text = "Laser Ship"
horizontal_alignment = 1
[node name="QueueLabel" type="Label" parent="UI/CraftMenu"]
mouse_filter = 2
anchor_left = 1.0