feat: introduce identity-backed goat
This commit is contained in:
@@ -59,6 +59,9 @@ func try_interact() -> void:
|
||||
if simulation_manager == null:
|
||||
return
|
||||
|
||||
if try_feed_animal():
|
||||
return
|
||||
|
||||
if try_harvest_resource_node():
|
||||
return
|
||||
|
||||
@@ -73,6 +76,25 @@ func try_interact() -> void:
|
||||
print("Player ate food from the village supply.")
|
||||
|
||||
|
||||
func try_feed_animal() -> bool:
|
||||
if not ("animal_care" in simulation_manager) or simulation_manager.animal_care == null:
|
||||
push_error("Player: SimulationManager has no animal-care service")
|
||||
return false
|
||||
var node: AnimalNode = simulation_manager.animal_care.find_node_for_player(
|
||||
global_position, interaction_range
|
||||
)
|
||||
if node == null:
|
||||
return false
|
||||
if not simulation_manager.has_method("feed_animal"):
|
||||
push_error("Player: SimulationManager cannot feed AnimalNodes")
|
||||
return true
|
||||
if simulation_manager.feed_animal(node.animal_id, -1):
|
||||
print("Player fed %s one food from the village pantry." % node.display_name)
|
||||
else:
|
||||
print("%s is hungry, but the pantry has no food to spare." % node.display_name)
|
||||
return true
|
||||
|
||||
|
||||
func try_harvest_resource_node() -> bool:
|
||||
if not simulation_manager.has_method("find_resource_node_for_player"):
|
||||
push_error("Player: SimulationManager cannot find ResourceNodes")
|
||||
|
||||
Reference in New Issue
Block a user