You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +00:00
[MP] Add a "synchronized" signal to MultiplayerSynchronized.
Emitted upon receiving a valid sync packet after setting the variables state.
This commit is contained in:
@@ -69,6 +69,11 @@
|
|||||||
</member>
|
</member>
|
||||||
</members>
|
</members>
|
||||||
<signals>
|
<signals>
|
||||||
|
<signal name="synchronized">
|
||||||
|
<description>
|
||||||
|
Emitted when a new synchronization state is received by this synchronizer after the variables have been updated.
|
||||||
|
</description>
|
||||||
|
</signal>
|
||||||
<signal name="visibility_changed">
|
<signal name="visibility_changed">
|
||||||
<param index="0" name="for_peer" type="int" />
|
<param index="0" name="for_peer" type="int" />
|
||||||
<description>
|
<description>
|
||||||
|
|||||||
@@ -268,6 +268,7 @@ void MultiplayerSynchronizer::_bind_methods() {
|
|||||||
BIND_ENUM_CONSTANT(VISIBILITY_PROCESS_PHYSICS);
|
BIND_ENUM_CONSTANT(VISIBILITY_PROCESS_PHYSICS);
|
||||||
BIND_ENUM_CONSTANT(VISIBILITY_PROCESS_NONE);
|
BIND_ENUM_CONSTANT(VISIBILITY_PROCESS_NONE);
|
||||||
|
|
||||||
|
ADD_SIGNAL(MethodInfo("synchronized"));
|
||||||
ADD_SIGNAL(MethodInfo("visibility_changed", PropertyInfo(Variant::INT, "for_peer")));
|
ADD_SIGNAL(MethodInfo("visibility_changed", PropertyInfo(Variant::INT, "for_peer")));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -775,6 +775,7 @@ Error SceneReplicationInterface::on_sync_receive(int p_from, const uint8_t *p_bu
|
|||||||
err = MultiplayerSynchronizer::set_state(props, node, vars);
|
err = MultiplayerSynchronizer::set_state(props, node, vars);
|
||||||
ERR_FAIL_COND_V(err, err);
|
ERR_FAIL_COND_V(err, err);
|
||||||
ofs += size;
|
ofs += size;
|
||||||
|
sync->emit_signal(SNAME("synchronized"));
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
_profile_node_data("sync_in", sync->get_instance_id(), size);
|
_profile_node_data("sync_in", sync->get_instance_id(), size);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user