mirror of
https://github.com/Rundll86/Dog-Lynx-And-HCN.git
synced 2026-05-28 06:51:54 +08:00
21 lines
424 B
GDScript
21 lines
424 B
GDScript
|
|
@tool
|
||
|
|
extends Control
|
||
|
|
|
||
|
|
@export var clickToRebuild: bool = false
|
||
|
|
|
||
|
|
var watcher = Watcher.new(false)
|
||
|
|
|
||
|
|
func _ready():
|
||
|
|
watcher.changed.connect(rebuild)
|
||
|
|
rebuild()
|
||
|
|
func _process(_delta):
|
||
|
|
watcher.setState(clickToRebuild)
|
||
|
|
|
||
|
|
func rebuild():
|
||
|
|
for i in get_children():
|
||
|
|
i.queue_free()
|
||
|
|
var files = DirTool.listdir("res://components/Weapons/")
|
||
|
|
for file in files:
|
||
|
|
var weapon = load(file).instantiate() as Weapon
|
||
|
|
add_child(weapon)
|