Make shield vessels unarmed hexagons

This commit is contained in:
Loïc Wisniewski 2026-08-14 22:46:30 +02:00
commit 18a7d44db4
3 changed files with 20 additions and 5 deletions

View file

@ -29,6 +29,7 @@ enum Icon {
GAS,
LEFT_ARROW, RIGHT_ARROW,
MINUS, PLUS,
SHIELD_VESSEL,
}
# Size the glyphs were originally drawn against. Every glyph dimension is
@ -213,6 +214,8 @@ func _draw() -> void:
_draw_minus(center, pulse, s)
Icon.PLUS:
_draw_plus(center, pulse, s)
Icon.SHIELD_VESSEL:
_draw_shield_vessel(center, pulse, s)
func _draw_close(center: Vector2, pulse: float, s: float) -> void:
@ -229,6 +232,14 @@ func _draw_ship(center: Vector2, pulse: float, s: float) -> void:
NeonDraw.draw_glowing_polygon(self, points, _active_color(), pulse, core_color)
func _draw_shield_vessel(center: Vector2, pulse: float, s: float) -> void:
var points: PackedVector2Array = PackedVector2Array()
for i in range(6):
var angle: float = -PI / 2.0 + float(i) * TAU / 6.0
points.append(center + Vector2(cos(angle), sin(angle)) * 11.0 * s)
NeonDraw.draw_glowing_polygon(self, points, _active_color(), pulse, core_color)
func _draw_arrow(center: Vector2, pulse: float, direction: float, s: float) -> void:
var r: float = 9.0 * s
var tip: Vector2 = center + Vector2(0, r * direction)

View file

@ -1,6 +1,5 @@
[gd_resource type="Resource" script_class="VesselDefinition" load_steps=7 format=3]
[gd_resource type="Resource" script_class="VesselDefinition" load_steps=6 format=3]
[ext_resource type="Script" path="res://VesselDefinition.gd" id="1"]
[ext_resource type="PackedScene" path="res://VesselWeaponComponent.tscn" id="2"]
[ext_resource type="PackedScene" path="res://VesselShieldComponent.tscn" id="3"]
[ext_resource type="Resource" path="res://ShieldHitsUpgrade.tres" id="4"]
[ext_resource type="Resource" path="res://ShieldRechargeUpgrade.tres" id="5"]
@ -12,10 +11,11 @@ display_name = "Shield Vessel"
description = "Combat vessel whose rechargeable personal shield absorbs lethal impacts."
build_cost = 14
build_time = 16.0
icon = 2
icon = 30
glow_color = Color(0.45, 0.8, 1, 1)
capabilities = PackedStringArray("weapon", "shield")
component_scenes = Array[PackedScene]([ExtResource("2"), ExtResource("3")])
capabilities = PackedStringArray("shield")
component_scenes = Array[PackedScene]([ExtResource("3")])
hull_points = PackedVector2Array(0, -24, 20.7846, -12, 20.7846, 12, 0, 24, -20.7846, 12, -20.7846, -12)
base_stats = {"damage": 1.0, "fire_cooldown": 0.5, "fire_range": 320.0, "max_speed": 460.0, "acceleration": 450.0, "shield_charges": 1.0, "shield_recharge": 6.0, "delivery_speed": 180.0}
minimum_stats = {"shield_recharge": 2.0}
upgrades = Array[Resource]([ExtResource("4"), ExtResource("5"), ExtResource("6")])

View file

@ -37,6 +37,10 @@ func _process(delta: float) -> bool:
return _fail("%s metadata did not come from its definition" % definition.definition_id)
if ships[0].has_capability("shield") or not ships[1].has_capability("shield"):
return _fail("shield behavior is not controlled by component presence")
if (ships[1].has_capability("weapon")
or definitions[1].hull_points.size() != 6
or definitions[1].icon != IconButton.Icon.SHIELD_VESSEL):
return _fail("shield vessel is not an unarmed hexagon")
if ships[2].has_capability("weapon") or not ships[2].has_capability("transport"):
return _fail("transporter capabilities were composed incorrectly")
print("TEST_VESSEL_COMPOSITION: PASS")