feat: deliver emergent Jajce commitments
This commit is contained in:
@@ -17,12 +17,13 @@ func add_situation(
|
||||
or definition == null
|
||||
or not situation.is_active()
|
||||
or situation.get_definition_id() != definition.situation_definition_id
|
||||
or definition.get_alternative(alternative_id) == null
|
||||
or (not alternative_id.is_empty() and definition.get_alternative(alternative_id) == null)
|
||||
or current_tick < situation.get_created_tick()
|
||||
or _entry_id_by_situation.has(situation.get_situation_id())
|
||||
or not situation.select_alternative(alternative_id)
|
||||
):
|
||||
return null
|
||||
if not alternative_id.is_empty() and not situation.select_alternative(alternative_id):
|
||||
return null
|
||||
var entry := QuestJournalEntryStateRecord.create(
|
||||
_next_entry_id,
|
||||
situation.get_situation_id(),
|
||||
@@ -36,6 +37,23 @@ func add_situation(
|
||||
return entry
|
||||
|
||||
|
||||
func select_alternative(
|
||||
situation: SituationStateRecord, definition: SituationDefinition, alternative_id: StringName
|
||||
) -> bool:
|
||||
if (
|
||||
situation == null
|
||||
or definition == null
|
||||
or alternative_id.is_empty()
|
||||
or situation.get_definition_id() != definition.situation_definition_id
|
||||
or definition.get_alternative(alternative_id) == null
|
||||
):
|
||||
return false
|
||||
var entry := get_for_situation(situation.get_situation_id())
|
||||
if entry == null or not entry.is_active():
|
||||
return false
|
||||
return situation.select_alternative(alternative_id) and entry.select_alternative(alternative_id)
|
||||
|
||||
|
||||
func synchronize(
|
||||
situation: SituationStateRecord, current_tick: int
|
||||
) -> QuestJournalEntryStateRecord:
|
||||
@@ -115,3 +133,7 @@ func get_active_sorted() -> Array[QuestJournalEntryStateRecord]:
|
||||
if record.is_active():
|
||||
records.append(record)
|
||||
return records
|
||||
|
||||
|
||||
func get_next_entry_id() -> int:
|
||||
return _next_entry_id
|
||||
|
||||
Reference in New Issue
Block a user