feat: introduce identity-backed goat
This commit is contained in:
@@ -478,6 +478,11 @@ func _create_task_glyph_mesh(action_id: StringName) -> PrimitiveMesh:
|
||||
food.radius = 0.18
|
||||
food.height = 0.26
|
||||
return food
|
||||
SimulationIds.ACTION_FEED_ANIMAL:
|
||||
var feed := SphereMesh.new()
|
||||
feed.radius = 0.18
|
||||
feed.height = 0.26
|
||||
return feed
|
||||
SimulationIds.ACTION_GATHER_WOOD, SimulationIds.ACTION_DEPOSIT_WOOD:
|
||||
var wood := BoxMesh.new()
|
||||
wood.size = Vector3(0.18, 0.42, 0.18)
|
||||
@@ -521,6 +526,8 @@ func _get_task_glyph_color(action_id: StringName) -> Color:
|
||||
match action_id:
|
||||
SimulationIds.ACTION_GATHER_FOOD, SimulationIds.ACTION_EAT, SimulationIds.ACTION_WITHDRAW_FOOD:
|
||||
return Color(0.95, 0.42, 0.25, 1.0)
|
||||
SimulationIds.ACTION_FEED_ANIMAL:
|
||||
return Color(0.95, 0.64, 0.25, 1.0)
|
||||
SimulationIds.ACTION_GATHER_WOOD, SimulationIds.ACTION_DEPOSIT_WOOD:
|
||||
return Color(0.58, 0.34, 0.16, 1.0)
|
||||
SimulationIds.ACTION_DEPOSIT_FOOD:
|
||||
|
||||
@@ -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