feat: define authoritative action effects

This commit is contained in:
Rijad Zuzo
2026-08-12 20:21:14 +02:00
parent e27fc1a5c8
commit dd0fc7542c
8 changed files with 165 additions and 9 deletions
+17 -1
View File
@@ -92,7 +92,9 @@ func rebuild(
)
)
_validate_action_references(actions, actions_by_id, professions_by_id, items_by_id, errors)
_validate_action_references(
actions, actions_by_id, professions_by_id, items_by_id, supported_handlers, errors
)
_validate_enemy_references(enemies, items_by_id, errors)
errors.sort()
_errors = errors
@@ -249,9 +251,23 @@ static func _validate_action_references(
actions_by_id: Dictionary,
professions_by_id: Dictionary,
items_by_id: Dictionary,
supported_handlers: Dictionary,
errors: Array[String]
) -> void:
for definition in actions:
for handler_field in [
["selection policy", definition.selection_policy_id],
["target policy", definition.target_policy_id],
["completion handler", definition.completion_handler_id],
]:
var handler_id: StringName = handler_field[1]
if not handler_id.is_empty() and not supported_handlers.has(handler_id):
errors.append(
(
"Action '%s' references unknown %s '%s'"
% [definition.action_id, handler_field[0], handler_id]
)
)
if (
not definition.preferred_profession_id.is_empty()
and not professions_by_id.has(definition.preferred_profession_id)