Files
mmo/systems/portal_system.gd
Marek Lenczewski f21e30eb55 prototype vibe
2026-04-16 17:20:57 +02:00

20 lines
565 B
GDScript

extends Node
const GATE_SCENE: PackedScene = preload("res://scenes/portal/gate.tscn")
func _ready() -> void:
EventBus.entity_died.connect(_on_entity_died)
func _on_entity_died(entity: Node) -> void:
if not entity.is_in_group("portals"):
return
if not entity.is_inside_tree():
return
var pos: Vector3 = entity.global_position
var gate: Node3D = GATE_SCENE.instantiate()
entity.get_parent().add_child(gate)
gate.global_position = pos
gate.dungeon_variant = entity.stats.variant
EventBus.portal_defeated.emit(entity)
entity.queue_free()