diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-20 15:41:55 +0100 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2023-02-20 15:41:55 +0100 |
commit | dfdda9629499271c447d4935b07e583650666600 (patch) | |
tree | 4d0a2b7423c357ee2197af52cd75ecf3e8a8e62c | |
parent | 2bb3c8f2056c06005f14561ae160870541f903c9 (diff) | |
parent | 522bddf63d83e51b35172afa3400b4aaade9b112 (diff) |
Merge pull request #73626 from Faless/mp/4.x_synced_signal
[MP] Add a "synchronized" signal to MultiplayerSynchronized.
-rw-r--r-- | modules/multiplayer/doc_classes/MultiplayerSynchronizer.xml | 5 | ||||
-rw-r--r-- | modules/multiplayer/multiplayer_synchronizer.cpp | 1 | ||||
-rw-r--r-- | modules/multiplayer/scene_replication_interface.cpp | 1 |
3 files changed, 7 insertions, 0 deletions
diff --git a/modules/multiplayer/doc_classes/MultiplayerSynchronizer.xml b/modules/multiplayer/doc_classes/MultiplayerSynchronizer.xml index af7c345f15..717906bd2b 100644 --- a/modules/multiplayer/doc_classes/MultiplayerSynchronizer.xml +++ b/modules/multiplayer/doc_classes/MultiplayerSynchronizer.xml @@ -69,6 +69,11 @@ </member> </members> <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"> <param index="0" name="for_peer" type="int" /> <description> diff --git a/modules/multiplayer/multiplayer_synchronizer.cpp b/modules/multiplayer/multiplayer_synchronizer.cpp index 10714db6df..458b6a664a 100644 --- a/modules/multiplayer/multiplayer_synchronizer.cpp +++ b/modules/multiplayer/multiplayer_synchronizer.cpp @@ -268,6 +268,7 @@ void MultiplayerSynchronizer::_bind_methods() { BIND_ENUM_CONSTANT(VISIBILITY_PROCESS_PHYSICS); BIND_ENUM_CONSTANT(VISIBILITY_PROCESS_NONE); + ADD_SIGNAL(MethodInfo("synchronized")); ADD_SIGNAL(MethodInfo("visibility_changed", PropertyInfo(Variant::INT, "for_peer"))); } diff --git a/modules/multiplayer/scene_replication_interface.cpp b/modules/multiplayer/scene_replication_interface.cpp index 68b6bc4a24..c1d45636f1 100644 --- a/modules/multiplayer/scene_replication_interface.cpp +++ b/modules/multiplayer/scene_replication_interface.cpp @@ -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_FAIL_COND_V(err, err); ofs += size; + sync->emit_signal(SNAME("synchronized")); #ifdef DEBUG_ENABLED _profile_node_data("sync_in", sync->get_instance_id(), size); #endif |