extends Node3D

@onready var cleaning_tool = $cleaning_tool_attached
@onready var push_tool = $PushToolMesh
@onready var pull_tool = $pull_tool_attached
@onready var grinding_tool = $grinding_tool_attached

var active_tool
var active_tool_mesh

enum PLAYERTOOLS {NONE, CLEANING_TOOL, PUSH_TOOL, PULL_TOOL, GRINDING_TOOL}

func set_active_tool(playertool: PLAYERTOOLS):
	active_tool = playertool
	#has_cleaning_tool = false
	cleaning_tool.visible = false
	push_tool.visible = false
	pull_tool.visible = false
	grinding_tool.visible = false

	if active_tool == PLAYERTOOLS.CLEANING_TOOL:
		cleaning_tool.visible = true
		active_tool_mesh = cleaning_tool
		#has_cleaning_tool = true
	elif active_tool == PLAYERTOOLS.PUSH_TOOL:
		active_tool_mesh = push_tool
		push_tool.visible = true
	elif active_tool == PLAYERTOOLS.PULL_TOOL:
		active_tool_mesh = pull_tool
		pull_tool.visible = true
	elif active_tool == PLAYERTOOLS.GRINDING_TOOL:
		active_tool_mesh = grinding_tool
		grinding_tool.visible = true
	#print ("active tool set to: " + str(playertool))
	
func play_start_animation():
	if active_tool_mesh.has_method("play_start_animation"):
		active_tool_mesh.play_start_animation()

	
func play_end_animation():
	if active_tool_mesh.has_method("play_end_animation"):
		active_tool_mesh.play_end_animation()

	
func play_animation():
	if active_tool_mesh.has_method("play_animation"):
		active_tool_mesh.play_animation()

