2024-04-27 18:12:03 +00:00
|
|
|
extends Node2D
|
2024-04-28 15:42:54 +00:00
|
|
|
class_name SummoningCircle
|
2024-04-27 18:12:03 +00:00
|
|
|
|
|
|
|
|
2024-04-28 15:42:35 +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.
|
2024-04-28 15:42:35 +00:00
|
|
|
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)
|
|
|
|
)
|
2024-04-28 15:42:35 +00:00
|
|
|
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-28 15:42:35 +00:00
|
|
|
)
|
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.")
|