grunk/src/player/interact_ray.gd

21 lines
520 B
GDScript

extends RayCast3D
## Component for interacting with Interactive things.
@onready var parent := owner as Player
func _process(_delta: float) -> void:
var collider := self.get_collider()
if not collider:
return
if collider.has_user_signal(Interactive.SELECT_SIGNAL):
collider.emit_signal(Interactive.SELECT_SIGNAL)
if (
parent.activity_enabled
and Input.is_action_just_pressed("interact")
and collider.has_user_signal(Interactive.ACTIVATE_SIGNAL)
):
collider.emit_signal(Interactive.ACTIVATE_SIGNAL)