refactor: move resource authority into simulation
This commit is contained in:
+8
-2
@@ -74,11 +74,17 @@ func try_interact() -> void:
|
||||
print("Player ate food from the village supply.")
|
||||
|
||||
func try_harvest_resource_node() -> bool:
|
||||
var node := ResourceNode.find_nearest_for_player(global_position, interaction_range)
|
||||
if not simulation_manager.has_method("find_resource_node_for_player"):
|
||||
push_error("Player: SimulationManager cannot find ResourceNodes")
|
||||
return false
|
||||
var node: ResourceNode = simulation_manager.find_resource_node_for_player(
|
||||
global_position,
|
||||
interaction_range
|
||||
)
|
||||
if node == null:
|
||||
return false
|
||||
|
||||
if not node.enabled:
|
||||
if not node.is_enabled():
|
||||
print("%s is unavailable." % node.node_id)
|
||||
return true
|
||||
|
||||
|
||||
Reference in New Issue
Block a user