feat: unify authored activity commands
This commit is contained in:
@@ -28,6 +28,7 @@ const PROFESSION_PATHS := [
|
||||
static var _action_list: Array[ActionDefinition] = []
|
||||
static var _profession_list: Array[ProfessionDefinition] = []
|
||||
static var _action_map: Dictionary = {}
|
||||
static var _action_event_type_ids: Dictionary = {}
|
||||
static var _profession_map: Dictionary = {}
|
||||
static var _profession_id_list: Array[StringName] = []
|
||||
static var _catalog_errors: Array[String] = []
|
||||
@@ -40,6 +41,7 @@ static func _ensure_cache() -> void:
|
||||
_action_list = []
|
||||
_profession_list = []
|
||||
_action_map = {}
|
||||
_action_event_type_ids = {}
|
||||
_profession_map = {}
|
||||
_profession_id_list = []
|
||||
_catalog_errors = []
|
||||
@@ -52,6 +54,8 @@ static func _ensure_cache() -> void:
|
||||
_profession_list = catalog.get_professions()
|
||||
for definition in _action_list:
|
||||
_action_map[definition.action_id] = definition
|
||||
if not definition.event_type_id.is_empty():
|
||||
_action_event_type_ids[definition.event_type_id] = true
|
||||
for definition in _profession_list:
|
||||
_profession_map[definition.profession_id] = definition
|
||||
_profession_id_list.append(definition.profession_id)
|
||||
@@ -78,6 +82,11 @@ static func get_action(action_id: StringName) -> ActionDefinition:
|
||||
return _action_map.get(action_id)
|
||||
|
||||
|
||||
static func has_action_event_type(event_type_id: StringName) -> bool:
|
||||
_ensure_cache()
|
||||
return _action_event_type_ids.has(event_type_id)
|
||||
|
||||
|
||||
static func get_profession(profession_id: StringName) -> ProfessionDefinition:
|
||||
_ensure_cache()
|
||||
return _profession_map.get(profession_id)
|
||||
|
||||
Reference in New Issue
Block a user