Add enemy foundation: definitions, components, ranged damage (#44)
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.
This commit is contained in:
parent
5326852807
commit
f14ee656ea
20 changed files with 393 additions and 42 deletions
19
EnemyDefinitions.gd
Normal file
19
EnemyDefinitions.gd
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
class_name EnemyDefinitions
|
||||
extends RefCounted
|
||||
|
||||
const DEFAULT_ID: String = "chaser"
|
||||
const ORDER: PackedStringArray = ["chaser"]
|
||||
const DEFINITIONS: Dictionary = {
|
||||
"chaser": preload("res://ChaserEnemyDefinition.tres"),
|
||||
}
|
||||
|
||||
|
||||
static func get_definition(enemy_id: String) -> Resource:
|
||||
return DEFINITIONS.get(enemy_id, DEFINITIONS[DEFAULT_ID])
|
||||
|
||||
|
||||
static func all() -> Array:
|
||||
var result: Array = []
|
||||
for enemy_id in ORDER:
|
||||
result.append(DEFINITIONS[enemy_id])
|
||||
return result
|
||||
Loading…
Reference in a new issue