Skip to content

Commit ce07c46

Browse files
committed
Script doesn't delete itself upon startup
1 parent a097290 commit ce07c46

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

modules/multi_godot/multi_godot.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ void MultiGodot::_ready() {
9999
ClassDB::register_class<MultiGodot>();
100100
} else {
101101
print_error("Steam module not found! MultiGodot will not be registered.");
102+
print_error("Shutting down MultiGodot.");
103+
queue_free();
102104
return;
103105
}
104106

@@ -128,7 +130,7 @@ void MultiGodot::_ready() {
128130

129131
SceneTreeDock *scene_tree_dock = SceneTreeDock::get_singleton();
130132

131-
Error err = ProjectSettings::get_singleton()->connect("setting_changed_values", Callable(this, "_on_settings_changed"));
133+
ProjectSettings::get_singleton()->connect("setting_changed_values", Callable(this, "_on_settings_changed"));
132134
scene_tree_dock->connect("nodes_reparented", Callable(this, "_on_nodes_reparented"));
133135
scene_tree_dock->connect("node_created_type", Callable(this, "_on_node_created"));
134136
scene_tree_dock->connect("scenes_instantiated", Callable(this, "_on_scenes_instantiated"));
@@ -152,7 +154,7 @@ void MultiGodot::_ready() {
152154
"current_scene_path",
153155
};
154156

155-
const Vector<Variant> initial_values = {0, 0, "", "", ""};
157+
const Vector<Variant> initial_values = {0, 0, "<null>", "<null>", "<null>"};
156158

157159
for (int i = 0; i < initial_keys.size(); i++) {
158160
_set_user_data(steam_id, initial_keys[i], initial_values[i]);
@@ -546,10 +548,10 @@ void MultiGodot::_sync_live_edits() {
546548
}
547549

548550
HashMap<String, Variant> this_data = user_data[steam_id];
549-
if ((int)this_data["editor_tab_index"] != SCRIPT_EDITOR) {
551+
if ((int)this_data["editor_tab_index"] != SCRIPT_EDITOR || (String)this_data["current_script_path"] == "<null>") {
550552
return;
551553
}
552-
if ((String)this_data["current_script_path"] == "") {
554+
if ((String)this_data["current_script_path"] == "" && (String)this_data["current_spectating_script"] != "") {
553555
int last_caret_line = editor->get_caret_line();
554556
int last_caret_column = editor->get_caret_column();
555557
editor->set_text(live_last_code);

0 commit comments

Comments
 (0)