feat: spawn enemies from reusable definitions
This commit is contained in:
@@ -1,9 +1,20 @@
|
||||
class_name EnemyDefinition
|
||||
extends Resource
|
||||
|
||||
const BEHAVIOR_PROFILE_RAID_ASSAULT := &"raid_assault"
|
||||
const BEHAVIOR_PROFILE_WOLF_HUNT := &"wolf_hunt"
|
||||
const VALID_BEHAVIOR_PROFILE_IDS := [
|
||||
BEHAVIOR_PROFILE_RAID_ASSAULT,
|
||||
BEHAVIOR_PROFILE_WOLF_HUNT,
|
||||
]
|
||||
|
||||
@export var enemy_id: StringName
|
||||
@export var display_name: String
|
||||
@export var kind: StringName = SimulationIds.COMBATANT_KIND_RAIDER
|
||||
@export var behavior_profile_id: StringName = BEHAVIOR_PROFILE_RAID_ASSAULT
|
||||
@export var combatant_id_prefix := "enemy"
|
||||
@export var faction_id: StringName = SimulationIds.FACTION_TRIBE
|
||||
@export var hostile := true
|
||||
@export var weapon_id: StringName = SimulationIds.ITEM_SWORD
|
||||
@export var health := 60.0
|
||||
@export var move_speed := 3.5
|
||||
@@ -18,6 +29,18 @@ func validate() -> Array[String]:
|
||||
errors.append("enemy_id is empty")
|
||||
if display_name.is_empty():
|
||||
errors.append("display_name is empty for '%s'" % enemy_id)
|
||||
if behavior_profile_id not in VALID_BEHAVIOR_PROFILE_IDS:
|
||||
errors.append(
|
||||
"behavior_profile_id '%s' is invalid for '%s'" % [behavior_profile_id, enemy_id]
|
||||
)
|
||||
if combatant_id_prefix.is_empty():
|
||||
errors.append("combatant_id_prefix is empty for '%s'" % enemy_id)
|
||||
elif not combatant_id_prefix.is_valid_identifier():
|
||||
errors.append(
|
||||
"combatant_id_prefix '%s' is invalid for '%s'" % [combatant_id_prefix, enemy_id]
|
||||
)
|
||||
if faction_id.is_empty():
|
||||
errors.append("faction_id is empty for '%s'" % enemy_id)
|
||||
if (
|
||||
kind
|
||||
not in [
|
||||
|
||||
Reference in New Issue
Block a user