From bf78f29ca03d97b12c214c387dcfbd09912ca744 Mon Sep 17 00:00:00 2001 From: Sergey Lapin Date: Tue, 28 May 2024 13:22:08 +0300 Subject: [PATCH] The town should work now --- src/modules/stream/stream.cpp | 14 +++++++++++--- src/modules/stream/stream.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/modules/stream/stream.cpp b/src/modules/stream/stream.cpp index e76e152..3589197 100644 --- a/src/modules/stream/stream.cpp +++ b/src/modules/stream/stream.cpp @@ -275,6 +275,10 @@ void StreamWorld::update_items() } } +void StreamWorld::run_command(const String &command, const Array &args) +{ +} + void StreamWorld::_notification(int which) { switch (which) { @@ -285,10 +289,12 @@ void StreamWorld::_notification(int which) case NOTIFICATION_ENTER_TREE: if (initialized) { if (Engine::get_singleton()->is_editor_hint()) - current_scene = Object::cast_to( - get_tree()->get_root()); - else + current_scene = Object::cast_to(this); + else { current_scene = get_tree()->get_current_scene(); + if (current_scene) + current_scene = get_tree()->get_root(); + } ERR_FAIL_COND_MSG(!current_scene, "No current scene"); RoadProcessing::road_setup(this); set_process(true); @@ -329,6 +335,8 @@ void StreamWorld::_bind_methods() &StreamWorld::terrain_dead); ClassDB::bind_method(D_METHOD("viewer_dead"), &StreamWorld::viewer_dead); + ClassDB::bind_method(D_METHOD("run_command", "command", "args"), + &StreamWorld::run_command); } StreamWorld::StreamWorld() diff --git a/src/modules/stream/stream.h b/src/modules/stream/stream.h index 8e859fd..c0a99eb 100644 --- a/src/modules/stream/stream.h +++ b/src/modules/stream/stream.h @@ -57,6 +57,7 @@ private: void unload_building(int id); void request_item(int type, int item); void update_items(); + void run_command(const String &command, const Array &args); static void _bind_methods(); public: