summaryrefslogtreecommitdiffstats
path: root/modules/multiplayer
diff options
context:
space:
mode:
authorFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-03-03 11:13:00 +0100
committerFabio Alessandrelli <fabio.alessandrelli@gmail.com>2024-03-03 11:13:00 +0100
commit45e8fa10c1168a5a9b17f8aeb2134b8121abc6d0 (patch)
tree54223af60d3793de8c0172b62cba2ff4c0ae072f /modules/multiplayer
parentf2045ba822bff7d34964901393581a3117c394a9 (diff)
downloadredot-engine-45e8fa10c1168a5a9b17f8aeb2134b8121abc6d0.tar.gz
[MP] Fix replication config reload error
Override the `reset_state` method to properly handle reloading the resource from disk.
Diffstat (limited to 'modules/multiplayer')
-rw-r--r--modules/multiplayer/scene_replication_config.cpp8
-rw-r--r--modules/multiplayer/scene_replication_config.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/modules/multiplayer/scene_replication_config.cpp b/modules/multiplayer/scene_replication_config.cpp
index 836fa1014d..733540a0e4 100644
--- a/modules/multiplayer/scene_replication_config.cpp
+++ b/modules/multiplayer/scene_replication_config.cpp
@@ -103,6 +103,14 @@ void SceneReplicationConfig::_get_property_list(List<PropertyInfo> *p_list) cons
}
}
+void SceneReplicationConfig::reset_state() {
+ dirty = false;
+ properties.clear();
+ sync_props.clear();
+ spawn_props.clear();
+ watch_props.clear();
+}
+
TypedArray<NodePath> SceneReplicationConfig::get_properties() const {
TypedArray<NodePath> paths;
for (const ReplicationProperty &prop : properties) {
diff --git a/modules/multiplayer/scene_replication_config.h b/modules/multiplayer/scene_replication_config.h
index 3f870ba2d8..969a23d788 100644
--- a/modules/multiplayer/scene_replication_config.h
+++ b/modules/multiplayer/scene_replication_config.h
@@ -79,6 +79,8 @@ protected:
void _get_property_list(List<PropertyInfo> *p_list) const;
public:
+ virtual void reset_state() override; // Required since we use variable amount of properties.
+
TypedArray<NodePath> get_properties() const;
void add_property(const NodePath &p_path, int p_index = -1);