Rob Kelly 1dc441ed7b
Some checks failed
linting & formatting / build (push) Failing after 31s
Toothbrush is very slightly more powerful
2025-09-08 18:03:17 -06:00

42 lines
1.1 KiB
GDScript

extends SurfaceSnapTool
# the wimpy toothbrush
const PAINT_COLOR := Color(1, 0, 0, 0.3)
const BRUSH_SCALE := 0.5
@export var damage := 0.0063 # ~8 seconds to destroy standard nodule
@onready var texture_idle: TextureRect = %TextureIdle
@onready var texture_used: TextureRect = %TextureUsed
@onready var brush_animation: AnimationPlayer = %BrushAnimation
func unlocked() -> bool:
return World.instance and World.instance.manager.toothbrush_unlocked
func _fire() -> void:
if raycast.is_colliding() and not World.instance.manager.is_tank_full():
brush_animation.play("brush")
var collider := raycast.get_collider()
var gunk_component := Gunkable.get_component(collider)
if gunk_component:
gunk_component.paint_dot(
raycast.get_collision_point(),
raycast.get_collision_normal(),
BRUSH_SCALE,
PAINT_COLOR
)
if collider is Sprayable:
(collider as Sprayable).hit(damage)
else:
brush_animation.stop()
texture_idle.visible = false
texture_used.visible = true
func _idle() -> void:
texture_idle.visible = true
texture_used.visible = false