grunk/src/equipment/tool.gd
Rob Kelly 8766e0c2bb
Some checks failed
linting & formatting / build (push) Failing after 4s
Funky sprayer HUD elements!
2025-03-12 19:29:31 -06:00

41 lines
726 B
GDScript

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