2025-10-15 16:00:47 +02:00
|
|
|
# Simple area that emits a signal when the player interacts while overlapping
|
2025-10-05 15:01:51 +02:00
|
|
|
extends Area2D
|
|
|
|
|
|
|
|
|
|
@export var oneshot = true
|
|
|
|
|
@export var cooldown = 10
|
|
|
|
|
var already_used = false
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
|
$Cooldown.wait_time = cooldown
|
|
|
|
|
|
|
|
|
|
signal interaction
|
|
|
|
|
|
|
|
|
|
func interact():
|
|
|
|
|
if not $Cooldown.time_left > 0 and not (oneshot and already_used):
|
|
|
|
|
already_used = true
|
|
|
|
|
$Cooldown.start()
|
|
|
|
|
interaction.emit()
|