Fix despawning items not blinking
This commit is contained in:
+1
-1
@@ -45,7 +45,7 @@ func _ready() -> void:
|
|||||||
# Configure Multiplayer Synchronizer
|
# Configure Multiplayer Synchronizer
|
||||||
# This overwrites any changes made in the inspector.
|
# This overwrites any changes made in the inspector.
|
||||||
replication_config = SceneReplicationConfig.new()
|
replication_config = SceneReplicationConfig.new()
|
||||||
var properties: Array[NodePath] = [".:position", ".:quaternion", ".:enabled"]
|
var properties: Array[NodePath] = [".:position", ".:quaternion", ".:enabled", ".:visible"]
|
||||||
for property_path in properties:
|
for property_path in properties:
|
||||||
replication_config.add_property(property_path)
|
replication_config.add_property(property_path)
|
||||||
replication_config.property_set_replication_mode(property_path, SceneReplicationConfig.REPLICATION_MODE_ALWAYS)
|
replication_config.property_set_replication_mode(property_path, SceneReplicationConfig.REPLICATION_MODE_ALWAYS)
|
||||||
|
|||||||
@@ -58,11 +58,7 @@ func _process(delta: float) -> void:
|
|||||||
_set_visible(int(_time_left * 5.0) % 2 == 0)
|
_set_visible(int(_time_left * 5.0) % 2 == 0)
|
||||||
|
|
||||||
|
|
||||||
# `visible` is not a replicated property, so a blink driven only here would make
|
|
||||||
# the item flicker on the host and stay solid on clients. Until it is synced,
|
|
||||||
# only warn when there is nobody else to disagree with.
|
|
||||||
func _set_visible(value: bool) -> void:
|
func _set_visible(value: bool) -> void:
|
||||||
if NetworkManager.is_online():
|
if not NetworkManager.owns_world():
|
||||||
get_parent().visible = true
|
|
||||||
return
|
return
|
||||||
get_parent().visible = value
|
get_parent().visible = value
|
||||||
|
|||||||
Reference in New Issue
Block a user