mirror of
https://github.com/thegatesbrowser/godot-multiplayer.git
synced 2025-07-05 06:10:36 -04:00
fix portal script
This commit is contained in:
parent
b8cc9a768f
commit
bcb2108891
1 changed files with 9 additions and 12 deletions
|
@ -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")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue