class_name Tool extends Node3D
## Abstract base class for spraygun types

var firing := false

@onready var hud_tool: Node3D = %HUDTool

@onready var _lagged_transform := global_transform


func _fire() -> void:
	pass


func _idle() -> void:
	pass


## Toggles between this tool's normal & alternate modes
func switch_mode() -> void:
	# TODO: bonk if no mode switch is defined
	pass


## Called each frame that this tool is being fired.
func fire() -> void:
	firing = true
	_fire()


## Called each frame that this tool is not being fired.
func idle() -> void:
	firing = false
	_idle()


func _process(_delta: float) -> void:
	if hud_tool:
		hud_tool.global_transform = _lagged_transform
	_lagged_transform = global_transform
