Enemy.gd now resolves stats/hull/color from EnemyDefinition resources and composes behaviour from capability components (EnemyPursuitComponent holds today's chase-the-nearest-ship logic), the same shape Ship.gd already uses for vessels. Fleet lookups go through a "player_fleet" group instead of a hardcoded ../Fleet sibling path, so an enemy parented anywhere (e.g. under a planet surface's SurfaceFeatures) still finds it. Also closes a real gap: enemies previously had no way to damage the fleet at range at all (Ship only reacted to physical contact, Projectile.gd was player-only). Ship.take_damage() is now a proper entry point - contact damage routes through it unchanged - and EnemyProjectile lets an enemy component fire at player_ships. Both ranged enemy archetypes in #45/#46 build on this. Part of the #40 conquest-mechanic breakdown.
16 lines
539 B
Text
16 lines
539 B
Text
[gd_resource type="Resource" script_class="EnemyDefinition" load_steps=3 format=3]
|
|
|
|
[ext_resource type="Script" path="res://EnemyDefinition.gd" id="1"]
|
|
[ext_resource type="PackedScene" path="res://EnemyPursuitComponent.tscn" id="2"]
|
|
|
|
[resource]
|
|
script = ExtResource("1")
|
|
enemy_id = "chaser"
|
|
display_name = "Chaser"
|
|
max_hp = 3
|
|
speed = 140.0
|
|
acceleration = 260.0
|
|
rotation_speed = 6.0
|
|
hull_points = PackedVector2Array(0, -16, 12, 0, 0, 16, -12, 0)
|
|
glow_color = Color(1, 0.15, 0.2, 1)
|
|
component_scenes = Array[PackedScene]([ExtResource("2")])
|