spaceship/vessels/VesselDistorderComponent.gd

35 lines
1.2 KiB
GDScript3
Raw Normal View History

class_name VesselDistorderComponent
2026-09-02 13:43:56 +02:00
extends "res://vessels/VesselCooldownFillComponent.gd"
2026-09-02 13:43:56 +02:00
# The presence marker used by the speed fader, plus the Energy Propulser's
# independently recharging dash (#179). Keeping both on one component means
# a vessel is the source of both propulsion capabilities and carries its own
# cooldown just like gas bombers and laser vessels do.
var capability_id := "distorder"
2026-09-02 13:43:56 +02:00
# The value a Propulser carries before apply_stats() reads the definition,
# and what the definition itself declares. #205 made it upgradeable, so the
# recharge in force is cooldown_duration, never this.
2026-09-02 13:43:56 +02:00
const DASH_COOLDOWN: float = 5.0
const READY_COLOR := Color(0.85, 0.95, 0.15)
const COOLING_COLOR := Color(0.28, 0.31, 0.08)
func _init() -> void:
cooldown_duration = DASH_COOLDOWN
func apply_stats() -> void:
var ship: Node = get_parent()
var state: Node = ship.get_tree().root.get_node("GameState")
cooldown_duration = state.vessel_stat(ship.vessel_type, "dash_cooldown")
queue_redraw()
2026-09-02 13:43:56 +02:00
func consume_dash() -> bool:
return _begin_cooldown(cooldown_duration)
2026-09-02 13:43:56 +02:00
func _ready_color() -> Color: return READY_COLOR
func _cooling_color() -> Color: return COOLING_COLOR