diff --git a/BuildController.gd b/BuildController.gd index 605994a..b98c40d 100644 --- a/BuildController.gd +++ b/BuildController.gd @@ -865,7 +865,7 @@ func _refresh_lab() -> void: var level_note: String = "" if bool(option.unlock) else " %d/%d" % [ GameState.upgrade_level(option.id), int(GameState.upgrade_def(option.id).max_level)] lab_upgrade_labels[i].text = "%s%s\n%s" % [option.name, level_note, price_text] - lab_upgrade_buttons[i].icon = IconButton.Icon.SHIP_LAB + lab_upgrade_buttons[i].icon = _upgrade_icon(option) lab_upgrade_buttons[i].glow_color = Color(1.0, 0.85, 0.4) if i == lab_choice else _vessel_colour(lab_vessel) lab_upgrade_buttons[i].enabled = true lab_upgrade_buttons[i].queue_redraw() @@ -885,6 +885,21 @@ func _refresh_lab() -> void: lab_buy_button.queue_redraw() +func _upgrade_icon(option: Dictionary) -> IconButton.Icon: + if bool(option.unlock): + return IconButton.Icon.UPGRADE_UNLOCK_SHIELD + match String(option.id): + "int_damage": return IconButton.Icon.UPGRADE_DAMAGE + "int_rate": return IconButton.Icon.UPGRADE_RATE + "int_range": return IconButton.Icon.UPGRADE_RANGE + "int_speed", "shd_speed": return IconButton.Icon.UPGRADE_THRUSTERS + "shd_hits": return IconButton.Icon.UPGRADE_SHIELD_HITS + "shd_recharge": return IconButton.Icon.UPGRADE_SHIELD_RECHARGE + "trn_capacity": return IconButton.Icon.UPGRADE_CARGO + "trn_speed": return IconButton.Icon.UPGRADE_ENGINES + _: return IconButton.Icon.SHIP_LAB + + func _on_craft_shield() -> void: if craft_building_id == 0: _say("No crafter selected - reopen this panel from the building") diff --git a/IconButton.gd b/IconButton.gd index efaa1ed..e2f09fc 100644 --- a/IconButton.gd +++ b/IconButton.gd @@ -20,6 +20,11 @@ enum Icon { # each other: the single up/down arrows already mean "load" and "store" # one way each, and this button is the place where both live. TRANSFER, + # Ship-lab upgrade glyphs. These deliberately describe the effect rather + # than the building hosting it, so cards remain scannable at a glance. + UPGRADE_DAMAGE, UPGRADE_RATE, UPGRADE_RANGE, UPGRADE_THRUSTERS, + UPGRADE_SHIELD_HITS, UPGRADE_SHIELD_RECHARGE, UPGRADE_CARGO, + UPGRADE_ENGINES, UPGRADE_UNLOCK_SHIELD, } # Size the glyphs were originally drawn against. Every glyph dimension is @@ -153,6 +158,24 @@ func _draw() -> void: _draw_ship_lab_icon(center, pulse, s) Icon.TRANSFER: _draw_transfer_icon(center, pulse, s) + Icon.UPGRADE_DAMAGE: + _draw_upgrade_damage(center, pulse, s) + Icon.UPGRADE_RATE: + _draw_upgrade_rate(center, pulse, s) + Icon.UPGRADE_RANGE: + _draw_upgrade_range(center, pulse, s) + Icon.UPGRADE_THRUSTERS: + _draw_upgrade_thrusters(center, pulse, s) + Icon.UPGRADE_SHIELD_HITS: + _draw_upgrade_shield_hits(center, pulse, s) + Icon.UPGRADE_SHIELD_RECHARGE: + _draw_upgrade_shield_recharge(center, pulse, s) + Icon.UPGRADE_CARGO: + _draw_upgrade_cargo(center, pulse, s) + Icon.UPGRADE_ENGINES: + _draw_upgrade_engines(center, pulse, s) + Icon.UPGRADE_UNLOCK_SHIELD: + _draw_upgrade_unlock_shield(center, pulse, s) func _draw_close(center: Vector2, pulse: float, s: float) -> void: @@ -199,6 +222,84 @@ func _draw_transfer_icon(center: Vector2, pulse: float, s: float) -> void: _active_color(), pulse, 0.42 * s, core_color) +# --- ship-lab upgrade glyphs --------------------------------------------- + +func _draw_upgrade_damage(center: Vector2, pulse: float, s: float) -> void: + # A heavy projectile striking a target. + NeonDraw.draw_glowing_line(self, center + Vector2(-13, 0) * s, center + Vector2(5, 0) * s, _active_color(), pulse, 0.7 * s, core_color) + for a in [0.0, PI * 0.5, PI, PI * 1.5]: + var dir := Vector2(cos(a), sin(a)) + NeonDraw.draw_glowing_line(self, center + Vector2(8, 0) * s, center + Vector2(8, 0) * s + dir * 7.0 * s, _active_color(), pulse, 0.4 * s, core_color) + + +func _draw_upgrade_rate(center: Vector2, pulse: float, s: float) -> void: + # Three successive shots: more fire per second. + for x in [-9.0, 0.0, 9.0]: + NeonDraw.draw_glowing_line(self, center + Vector2(x - 3, 7) * s, center + Vector2(x + 3, -7) * s, _active_color(), pulse, 0.55 * s, core_color) + + +func _draw_upgrade_range(center: Vector2, pulse: float, s: float) -> void: + # Reticle with a long sight line. + var r := 10.0 * s + for i in range(12): + var a := TAU * float(i) / 12.0 + var b := TAU * float(i + 1) / 12.0 + NeonDraw.draw_glowing_line(self, center + Vector2(cos(a), sin(a)) * r, center + Vector2(cos(b), sin(b)) * r, _active_color(), pulse, 0.32 * s, core_color) + NeonDraw.draw_glowing_line(self, center + Vector2(-15, 0) * s, center + Vector2(15, 0) * s, _active_color(), pulse, 0.38 * s, core_color) + NeonDraw.draw_glowing_line(self, center + Vector2(0, -15) * s, center + Vector2(0, 15) * s, _active_color(), pulse, 0.38 * s, core_color) + + +func _draw_upgrade_thrusters(center: Vector2, pulse: float, s: float) -> void: + # Ship nozzle with two exhaust flames. + NeonDraw.draw_glowing_polygon(self, PackedVector2Array([center + Vector2(-10, -7) * s, center + Vector2(5, -7) * s, center + Vector2(11, 0) * s, center + Vector2(5, 7) * s, center + Vector2(-10, 7) * s]), _active_color(), pulse, core_color) + for y in [-4.0, 4.0]: + NeonDraw.draw_glowing_line(self, center + Vector2(-10, y) * s, center + Vector2(-17, y * 1.5) * s, _active_color(), pulse, 0.45 * s, core_color) + + +func _draw_upgrade_shield_hits(center: Vector2, pulse: float, s: float) -> void: + # Layered hexagonal shield walls. + for r in [8.0, 13.0]: + var hex := PackedVector2Array() + for i in range(6): + var a := TAU * float(i) / 6.0 + PI / 6.0 + hex.append(center + Vector2(cos(a), sin(a)) * r * s) + NeonDraw.draw_glowing_polygon(self, hex, _active_color(), pulse, core_color) + + +func _draw_upgrade_shield_recharge(center: Vector2, pulse: float, s: float) -> void: + # A shield with a circular recovery arrow. + var arc := PackedVector2Array() + for i in range(10): + var a := lerpf(-PI * 0.2, PI * 1.35, float(i) / 9.0) + arc.append(center + Vector2(cos(a), sin(a)) * 11.0 * s) + NeonDraw.draw_glowing_path(self, arc, _active_color(), pulse, 0.45 * s, core_color) + var tip: Vector2 = arc[arc.size() - 1] + NeonDraw.draw_glowing_line(self, tip, tip + Vector2(6, -1) * s, _active_color(), pulse, 0.45 * s, core_color) + NeonDraw.draw_glowing_line(self, tip, tip + Vector2(1, 6) * s, _active_color(), pulse, 0.45 * s, core_color) + + +func _draw_upgrade_cargo(center: Vector2, pulse: float, s: float) -> void: + # Freight crate, with outward arrows suggesting expanded volume. + var box := 8.0 * s + NeonDraw.draw_glowing_polygon(self, PackedVector2Array([center + Vector2(-box, -box) , center + Vector2(box, -box), center + Vector2(box, box), center + Vector2(-box, box)]), _active_color(), pulse, core_color) + for side in [-1.0, 1.0]: + NeonDraw.draw_glowing_line(self, center + Vector2(side * 10, 0) * s, center + Vector2(side * 16, 0) * s, _active_color(), pulse, 0.38 * s, core_color) + + +func _draw_upgrade_engines(center: Vector2, pulse: float, s: float) -> void: + # Engine core with speed streaks. + NeonDraw.draw_glowing_polygon(self, PackedVector2Array([center + Vector2(-4, -8) * s, center + Vector2(7, -5) * s, center + Vector2(10, 0) * s, center + Vector2(7, 5) * s, center + Vector2(-4, 8) * s, center + Vector2(-8, 0) * s]), _active_color(), pulse, core_color) + for y in [-7.0, 0.0, 7.0]: + NeonDraw.draw_glowing_line(self, center + Vector2(-18, y) * s, center + Vector2(-9, y) * s, _active_color(), pulse, 0.4 * s, core_color) + + +func _draw_upgrade_unlock_shield(center: Vector2, pulse: float, s: float) -> void: + # A shield silhouette with a plus: unlock the whole vessel, not a stat. + NeonDraw.draw_glowing_polygon(self, PackedVector2Array([center + Vector2(0, -13) * s, center + Vector2(11, -7) * s, center + Vector2(8, 7) * s, center + Vector2(0, 13) * s, center + Vector2(-8, 7) * s, center + Vector2(-11, -7) * s]), _active_color(), pulse, core_color) + NeonDraw.draw_glowing_line(self, center + Vector2(-4, 0) * s, center + Vector2(4, 0) * s, _active_color(), pulse, 0.45 * s, core_color) + NeonDraw.draw_glowing_line(self, center + Vector2(0, -4) * s, center + Vector2(0, 4) * s, _active_color(), pulse, 0.45 * s, core_color) + + func _draw_build(center: Vector2, pulse: float, s: float) -> void: # A plus inside a frame - "add a structure". var r: float = 11.0 * s diff --git a/Main.tscn b/Main.tscn index 154467e..450d77f 100644 --- a/Main.tscn +++ b/Main.tscn @@ -1000,6 +1000,15 @@ theme_override_font_sizes/font_size = 22 horizontal_alignment = 1 text = "Transporter" +[node name="VesselUpgradeSeparator" type="ColorRect" parent="UI/LabMenu"] +mouse_filter = 2 +anchor_right = 1.0 +offset_left = 48 +offset_top = 462 +offset_right = -48 +offset_bottom = 466 +color = Color(0.25, 0.85, 1, 0.6) + [node name="UpgradeList" type="Label" parent="UI/LabMenu"] visible = false mouse_filter = 2