TinyAdventure/objects/player_right_hand_attacheme...

22 lines
483 B
GDScript

class_name HandTool
extends Node3D
var tool_hitbox:Area3D = null
var _current_tool:Node3D = null
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
func set_tool(node:Node3D) -> void:
_current_tool = node
tool_hitbox = null
for child in get_children():
child.queue_free()
remove_child(child)
if _current_tool != null:
add_child(_current_tool)
tool_hitbox = find_child("Hitbox", true, false)