feat: generate animal-care quests and render them in the journal
This commit is contained in:
@@ -99,6 +99,20 @@ func get_state(animal_id: StringName) -> AnimalStateRecord:
|
||||
return states.get(animal_id) as AnimalStateRecord
|
||||
|
||||
|
||||
func get_all_states() -> Array[AnimalStateRecord]:
|
||||
var all_states: Array[AnimalStateRecord] = []
|
||||
for animal_id in states.keys():
|
||||
var animal_state := states[animal_id] as AnimalStateRecord
|
||||
if animal_state != null:
|
||||
all_states.append(animal_state)
|
||||
all_states.sort_custom(_sort_states_by_id)
|
||||
return all_states
|
||||
|
||||
|
||||
static func _sort_states_by_id(first: AnimalStateRecord, second: AnimalStateRecord) -> bool:
|
||||
return String(first.get_animal_id()) < String(second.get_animal_id())
|
||||
|
||||
|
||||
func reserve(animal_id: StringName, agent_id: int) -> bool:
|
||||
var animal_state := get_state(animal_id)
|
||||
return animal_state != null and animal_state.can_npc_feed() and animal_state.reserve(agent_id)
|
||||
|
||||
Reference in New Issue
Block a user