fml-avs/components/group_trigger_component.gd

22 lines
463 B
GDScript3
Raw Permalink Normal View History

extends Area3D
@export var group: String
var activated_lockout = false
signal state_changed(pressed: bool)
signal activated_once()
func _on_body_entered(body: Node3D) -> void:
if body.is_in_group(group):
state_changed.emit(true)
if not activated_lockout:
activated_lockout = true
activated_once.emit()
func _on_body_exited(body: Node3D) -> void:
if body.is_in_group(group):
state_changed.emit(false)