diff --git a/addons/escoria-core/game/core-scripts/esc/esc_object_manager.gd b/addons/escoria-core/game/core-scripts/esc/esc_object_manager.gd index 41ab76a4..37b4aee2 100644 --- a/addons/escoria-core/game/core-scripts/esc/esc_object_manager.gd +++ b/addons/escoria-core/game/core-scripts/esc/esc_object_manager.gd @@ -317,12 +317,13 @@ func unregister_object(object: ESCObject, room_key: ESCRoomObjectsKey) -> void: "ESCObjectManager:unregister_object()", [ "Unable to unregister object.", - "Object with global ID %s room (%s, %s) not found." % + "Object with global ID %s room (%s, %s) not found. If this was" % [ "?" if object == null else object.global_id, room_key.room_global_id, room_key.room_instance_id - ] + ], + "part of a 'forced' registration, ignore this warning." ] ) diff --git a/addons/escoria-core/game/core-scripts/log/esc_logger.gd b/addons/escoria-core/game/core-scripts/log/esc_logger.gd index 52b6b26f..6acab6dd 100644 --- a/addons/escoria-core/game/core-scripts/log/esc_logger.gd +++ b/addons/escoria-core/game/core-scripts/log/esc_logger.gd @@ -205,7 +205,10 @@ func error(string: String, args = [], do_savegame: bool = true): _log(message, true) escoria.set_game_paused(true) - escoria.main.current_scene.game.show_crash_popup(files_to_send) + + if is_instance_valid(escoria.main.current_scene): + escoria.main.current_scene.game.show_crash_popup(files_to_send) + assert(false) diff --git a/addons/escoria-core/game/escoria.gd b/addons/escoria-core/game/escoria.gd index 7a574b9e..1093d285 100644 --- a/addons/escoria-core/game/escoria.gd +++ b/addons/escoria-core/game/escoria.gd @@ -137,6 +137,8 @@ func _init(): # Load settings func _ready(): + _handle_direct_scene_run() + settings = save_manager.load_settings() apply_settings(settings) room_manager.register_reserved_globals() @@ -361,3 +363,16 @@ func deregister_dialog_manager(manager_class: String): # Function called to quit the game. func quit(): get_tree().notification(MainLoop.NOTIFICATION_WM_QUIT_REQUEST) + + +# Handle anything necessary if the game started a scene directly. +func _handle_direct_scene_run() -> void: + var current_scene_root: Node = get_tree().get_current_scene() + + if current_scene_root.filename == ProjectSettings.get_setting('application/run/main_scene'): + # This is a normal, full-game run, so there's nothing to do. + return + + if current_scene_root is ESCRoom: + escoria.object_manager.set_current_room(current_scene_root) +