fix: add code to handle scenes run directly from the Godot editor and allow for the current room to be set in the object manager, allowing proper setup
This commit is contained in:
committed by
Julian Murgia
parent
2508786cde
commit
c87e853ba6
@@ -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."
|
||||
]
|
||||
)
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user