diff --git a/levels/portal/portal.gd b/levels/portal/portal.gd index 5897d2c..862f3e6 100644 --- a/levels/portal/portal.gd +++ b/levels/portal/portal.gd @@ -1,19 +1,16 @@ extends Node3D -signal portal_entered(url: String) - @export var url: String func _on_portal_entered(body): - if not body is CharacterBody3D: return + if not body is Player: return + if body.get_multiplayer_authority() != multiplayer.get_unique_id(): return + + print("Portal_entered: " + url) await get_tree().create_timer(0.2).timeout - print("portal_entered: " + url) - portal_entered.emit(url) - - -func shut_down(_body) -> void: - $Portal/MeshInstance3D.visible = false - $Portal/MeshInstance3D2.visible = false - $Portal/OmniLight3D.visible = false - $Portal/CollisionShape3D.set_deferred("disabled", true) + + if get_tree().has_method("open_gate"): + get_tree().open_gate(url) + else: + push_warning("Tree doesn't have method open_gate. Do nothing")