1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

[MP] Make replication mode an enum + optimizations

REPLICATION_MODE_ALWAYS (sync) and REPLICATION_MODE_ON_CHANGE (watch)
are now mutually exclusive.

Prevent invalid NodePath from being added to the config.

Optimize the replication config loading by composing the lists on
demand.
This commit is contained in:
Fabio Alessandrelli
2023-08-27 11:35:56 +02:00
parent bc88dca176
commit 711e96edc4
3 changed files with 149 additions and 81 deletions

View File

@@ -37,6 +37,13 @@
Finds the index of the given [param path].
</description>
</method>
<method name="property_get_replication_mode">
<return type="int" enum="SceneReplicationConfig.ReplicationMode" />
<param index="0" name="path" type="NodePath" />
<description>
Returns the replication mode for the property identified by the given [param path]. See [enum ReplicationMode].
</description>
</method>
<method name="property_get_spawn">
<return type="bool" />
<param index="0" name="path" type="NodePath" />
@@ -44,18 +51,28 @@
Returns whether the property identified by the given [param path] is configured to be synchronized on spawn.
</description>
</method>
<method name="property_get_sync">
<method name="property_get_sync" is_deprecated="true">
<return type="bool" />
<param index="0" name="path" type="NodePath" />
<description>
Returns whether the property identified by the given [param path] is configured to be synchronized on process.
[i]Deprecated.[/i] Use [method property_get_replication_mode] instead.
</description>
</method>
<method name="property_get_watch">
<method name="property_get_watch" is_deprecated="true">
<return type="bool" />
<param index="0" name="path" type="NodePath" />
<description>
Returns whether the property identified by the given [param path] is configured to be reliably synchronized when changes are detected on process.
[i]Deprecated.[/i] Use [method property_get_replication_mode] instead.
</description>
</method>
<method name="property_set_replication_mode">
<return type="void" />
<param index="0" name="path" type="NodePath" />
<param index="1" name="mode" type="int" enum="SceneReplicationConfig.ReplicationMode" />
<description>
Sets the synchronization mode for the property identified by the given [param path]. See [enum ReplicationMode].
</description>
</method>
<method name="property_set_spawn">
@@ -66,20 +83,22 @@
Sets whether the property identified by the given [param path] is configured to be synchronized on spawn.
</description>
</method>
<method name="property_set_sync">
<method name="property_set_sync" is_deprecated="true">
<return type="void" />
<param index="0" name="path" type="NodePath" />
<param index="1" name="enabled" type="bool" />
<description>
Sets whether the property identified by the given [param path] is configured to be synchronized on process.
[i]Deprecated.[/i] Use [method property_set_replication_mode] with [constant REPLICATION_MODE_ALWAYS] instead.
</description>
</method>
<method name="property_set_watch">
<method name="property_set_watch" is_deprecated="true">
<return type="void" />
<param index="0" name="path" type="NodePath" />
<param index="1" name="enabled" type="bool" />
<description>
Sets whether the property identified by the given [param path] is configured to be reliably synchronized when changes are detected on process.
[i]Deprecated.[/i] Use [method property_set_replication_mode] with [constant REPLICATION_MODE_ON_CHANGE] instead.
</description>
</method>
<method name="remove_property">
@@ -90,4 +109,15 @@
</description>
</method>
</methods>
<constants>
<constant name="REPLICATION_MODE_NEVER" value="0" enum="ReplicationMode">
Do not keep the given property synchronized.
</constant>
<constant name="REPLICATION_MODE_ALWAYS" value="1" enum="ReplicationMode">
Replicate the given property on process by constantly sending updates using unreliable transfer mode.
</constant>
<constant name="REPLICATION_MODE_ON_CHANGE" value="2" enum="ReplicationMode">
Replicate the given property on process by sending updates using reliable transfer mode when its value changes.
</constant>
</constants>
</class>