1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-22 08:04:23 +00:00
hella-farm/entities/summoning_circle.gd

30 lines
813 B
GDScript3
Raw Normal View History

2024-04-27 18:12:03 +00:00
extends Node2D
class_name SummoningCircle
2024-04-27 18:12:03 +00:00
## The [SacrificeStone]s part of this summoning circle.
var stones: Array[SacrificeStone] = []
2024-04-27 18:12:03 +00:00
2024-04-28 17:21:22 +00:00
## Refresh the value of [field stones], and reconnect signals accordingly.
func refresh_stones() -> void:
2024-04-28 17:21:22 +00:00
stones.map(func(stone: SacrificeStone):
if stone == null:
return
if stone.sacrifice_changed.is_connected(self._on_sacrifice_changed):
stone.sacrifice_changed.disconnect(self._on_sacrifice_changed)
)
stones.assign(
2024-04-28 17:21:22 +00:00
find_children("*", "SacrificeStone", true, false)
)
stones.map(func(stone: SacrificeStone):
stone.sacrifice_changed.connect(self._on_sacrifice_changed)
)
2024-04-27 18:12:03 +00:00
2024-04-28 17:21:22 +00:00
func _ready() -> void:
refresh_stones()
2024-04-27 18:12:03 +00:00
2024-04-28 17:21:22 +00:00
func _on_sacrifice_changed(_entity: Node2D) -> void:
Log.w(self, "Sacrifice has changed, but no summoning function is implemented.")