class_name Tool extends Node3D ## Abstract base class for spraygun types const HUD_ACCEL := 36.0 var firing := false @onready var hud_tool: Node3D = %HUDTool 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 _physics_process(delta: float) -> void: if hud_tool: var weight := clampf(HUD_ACCEL * delta, 0.0, 1.0) hud_tool.global_basis = global_basis hud_tool.global_position = hud_tool.global_position.lerp(global_position, weight)