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
|
extends Node3D
|
||||||
|
|
||||||
signal portal_entered(url: String)
|
|
||||||
|
|
||||||
@export var url: String
|
@export var url: String
|
||||||
|
|
||||||
|
|
||||||
func _on_portal_entered(body):
|
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
|
await get_tree().create_timer(0.2).timeout
|
||||||
print("portal_entered: " + url)
|
|
||||||
portal_entered.emit(url)
|
|
||||||
|
|
||||||
|
if get_tree().has_method("open_gate"):
|
||||||
func shut_down(_body) -> void:
|
get_tree().open_gate(url)
|
||||||
$Portal/MeshInstance3D.visible = false
|
else:
|
||||||
$Portal/MeshInstance3D2.visible = false
|
push_warning("Tree doesn't have method open_gate. Do nothing")
|
||||||
$Portal/OmniLight3D.visible = false
|
|
||||||
$Portal/CollisionShape3D.set_deferred("disabled", true)
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue