21 lines
653 B
GDScript
21 lines
653 B
GDScript
extends Node3D
|
|
|
|
@onready var Player: Node3D = get_tree().get_first_node_in_group("player")
|
|
@onready var player_ray: Node3D = get_tree().get_first_node_in_group("player_ray")
|
|
|
|
var lock_key = {"Padlock": "rusty_key"}
|
|
|
|
func _physics_process(_delta: float) -> void:
|
|
if has_node("InteractLabel"):
|
|
if player_ray.is_colliding() and player_ray.get_collider() == self:
|
|
$InteractLabel.show()
|
|
else:
|
|
$InteractLabel.hide()
|
|
|
|
func interact():
|
|
if self.is_in_group("locked"):
|
|
for i in Player.keys.size():
|
|
if Player.keys[i] == lock_key[self.name]:
|
|
##TODO Add an animation of the key going into the lock and it falling on the ground
|
|
queue_free()
|