Add selectable camp conversations
This commit is contained in:
@@ -243,10 +243,42 @@ func _normalized_briefing(source) -> Dictionary:
|
||||
for line in block.get("lines", []):
|
||||
lines.append(str(line))
|
||||
result["lines"] = lines
|
||||
result["camp_dialogue"] = _normalized_dialogue_lines(result.get("camp_dialogue", []))
|
||||
result["camp_conversations"] = _normalized_camp_conversations(result.get("camp_conversations", []))
|
||||
result.erase("conditional_lines")
|
||||
return result
|
||||
|
||||
|
||||
func _normalized_camp_conversations(source) -> Array:
|
||||
var result := []
|
||||
if typeof(source) != TYPE_ARRAY:
|
||||
return result
|
||||
var seen := {}
|
||||
for entry in source:
|
||||
if typeof(entry) != TYPE_DICTIONARY:
|
||||
continue
|
||||
var conversation_id := str(entry.get("id", "")).strip_edges()
|
||||
if conversation_id.is_empty() or seen.has(conversation_id):
|
||||
continue
|
||||
var lines := _normalized_dialogue_lines(entry.get("lines", []))
|
||||
if lines.is_empty():
|
||||
continue
|
||||
seen[conversation_id] = true
|
||||
var label := str(entry.get("label", conversation_id.capitalize())).strip_edges()
|
||||
if label.is_empty():
|
||||
label = conversation_id.capitalize()
|
||||
result.append({
|
||||
"id": conversation_id,
|
||||
"group": str(entry.get("group", "topic")).strip_edges(),
|
||||
"officer_id": str(entry.get("officer_id", "")).strip_edges(),
|
||||
"label": label,
|
||||
"speaker": str(entry.get("speaker", "")).strip_edges(),
|
||||
"summary": str(entry.get("summary", "")).strip_edges(),
|
||||
"lines": lines
|
||||
})
|
||||
return result
|
||||
|
||||
|
||||
func _is_condition_shape_valid(condition) -> bool:
|
||||
return typeof(condition) == TYPE_DICTIONARY or typeof(condition) == TYPE_ARRAY
|
||||
|
||||
|
||||
Reference in New Issue
Block a user