39 lines
1.2 KiB
GDScript3
39 lines
1.2 KiB
GDScript3
|
|
extends Node2D
|
||
|
|
|
||
|
|
# Purely visual: an automated ore hauler running an extractor's route. It
|
||
|
|
# carries no state of its own - GameState owns the simulation and this node
|
||
|
|
# is created, positioned and freed to match it. See HaulerField.
|
||
|
|
|
||
|
|
const HULL_COLOR: Color = Color(0.55, 0.85, 0.4)
|
||
|
|
|
||
|
|
var laden: bool = false
|
||
|
|
|
||
|
|
|
||
|
|
func _ready() -> void:
|
||
|
|
add_to_group("haulers")
|
||
|
|
z_index = -1
|
||
|
|
queue_redraw()
|
||
|
|
|
||
|
|
|
||
|
|
func set_laden(value: bool) -> void:
|
||
|
|
if laden == value:
|
||
|
|
return
|
||
|
|
laden = value
|
||
|
|
queue_redraw()
|
||
|
|
|
||
|
|
|
||
|
|
func _draw() -> void:
|
||
|
|
# Blunt freighter silhouette - deliberately unlike the player's sharp
|
||
|
|
# triangles, so it is obvious at a glance this is not a fleet vessel.
|
||
|
|
var hull: PackedVector2Array = PackedVector2Array([
|
||
|
|
Vector2(0, -20), Vector2(11, -6), Vector2(11, 16), Vector2(-11, 16), Vector2(-11, -6),
|
||
|
|
])
|
||
|
|
NeonDraw.draw_glowing_polygon(self, hull, HULL_COLOR, 1.0)
|
||
|
|
if laden:
|
||
|
|
# Ore in the hold on the outbound leg, so a glance tells you which
|
||
|
|
# way it is going.
|
||
|
|
var cargo: PackedVector2Array = PackedVector2Array()
|
||
|
|
for i in range(6):
|
||
|
|
var a: float = (float(i) / 6.0) * TAU - PI / 2.0
|
||
|
|
cargo.append(Vector2(cos(a), sin(a)) * 6.0 + Vector2(0, 4))
|
||
|
|
NeonDraw.draw_glowing_polygon(self, cargo, Color(0.0, 0.62, 0.7), 1.0)
|