feat: add person history and trust reactions
This commit is contained in:
@@ -103,12 +103,30 @@ func get_known_event_ids(knower_id: int, max_count: int = 3) -> Array[int]:
|
||||
return recent_ids
|
||||
|
||||
|
||||
func get_retained_event_ids(
|
||||
knower_id: int, lasting_event_ids: Array[int], max_count: int = 4
|
||||
) -> Array[int]:
|
||||
return _get_ranked_event_ids(knower_id, lasting_event_ids, false, max_count)
|
||||
|
||||
|
||||
func get_communicable_event_ids(knower_id: int, lasting_event_ids: Array[int]) -> Array[int]:
|
||||
return _get_ranked_event_ids(knower_id, lasting_event_ids, true, 0)
|
||||
|
||||
|
||||
func _get_ranked_event_ids(
|
||||
knower_id: int, lasting_event_ids: Array[int], direct_only: bool, max_count: int
|
||||
) -> Array[int]:
|
||||
var ranked: Array[Dictionary] = []
|
||||
for record in known_events.values():
|
||||
if record.get_knower_id() != knower_id:
|
||||
continue
|
||||
if record.get_acquisition_method() not in KnownEventStateRecord.DIRECT_ACQUISITION_METHODS:
|
||||
if (
|
||||
direct_only
|
||||
and (
|
||||
record.get_acquisition_method()
|
||||
not in KnownEventStateRecord.DIRECT_ACQUISITION_METHODS
|
||||
)
|
||||
):
|
||||
continue
|
||||
(
|
||||
ranked
|
||||
@@ -120,10 +138,12 @@ func get_communicable_event_ids(knower_id: int, lasting_event_ids: Array[int]) -
|
||||
}
|
||||
)
|
||||
)
|
||||
ranked.sort_custom(_sort_communicable)
|
||||
ranked.sort_custom(_sort_by_importance)
|
||||
var event_ids: Array[int] = []
|
||||
for item in ranked:
|
||||
event_ids.append(int(item["event_id"]))
|
||||
if max_count > 0 and event_ids.size() >= max_count:
|
||||
break
|
||||
return event_ids
|
||||
|
||||
|
||||
@@ -234,7 +254,7 @@ static func _sort_by_acquisition(
|
||||
return first.get_event_id() < second.get_event_id()
|
||||
|
||||
|
||||
static func _sort_communicable(first: Dictionary, second: Dictionary) -> bool:
|
||||
static func _sort_by_importance(first: Dictionary, second: Dictionary) -> bool:
|
||||
if bool(first["lasting"]) != bool(second["lasting"]):
|
||||
return bool(first["lasting"])
|
||||
if int(first["acquired_tick"]) != int(second["acquired_tick"]):
|
||||
|
||||
Reference in New Issue
Block a user