Fix smgr not instantiating packedscene

This commit is contained in:
JeremyStar™ 2023-08-25 16:16:54 +02:00
parent 610f93842e
commit 7447a02b43

View file

@ -62,7 +62,7 @@ func add_debug(resource_name:String) -> int:
var err = core.error("SceneManager",core.Errors.SCENEMANAGER_ALREADY_LOADED,{"scene":resource_name,"overlay":"debug"}) var err = core.error("SceneManager",core.Errors.SCENEMANAGER_ALREADY_LOADED,{"scene":resource_name,"overlay":"debug"})
logger.error("CORE/smgr.gd",err["error"]) logger.error("CORE/smgr.gd",err["error"])
return err["code"] return err["code"]
# In theory unecessary but if something for some reason did something very wrong it would be catched here resource = resource.instantiate()
if !debug_overlay_scene.has(resource_name) and debug_overlay.get_children().has(resource): if !debug_overlay_scene.has(resource_name) and debug_overlay.get_children().has(resource):
core.exception("SceneManager","debug_overlay_scene does not contain \"" + resource_name + "\" but debug_overlay does") core.exception("SceneManager","debug_overlay_scene does not contain \"" + resource_name + "\" but debug_overlay does")
return core.Errors.CORE_EXCEPTION return core.Errors.CORE_EXCEPTION
@ -90,6 +90,7 @@ func add_menu(resource_name:String) -> int:
var err = core.error("SceneManager",core.Errors.SCENEMANAGER_ALREADY_LOADED,{"scene":resource_name,"overlay":"menu"}) var err = core.error("SceneManager",core.Errors.SCENEMANAGER_ALREADY_LOADED,{"scene":resource_name,"overlay":"menu"})
logger.error("CORE/smgr.gd",err["error"]) logger.error("CORE/smgr.gd",err["error"])
return err["code"] return err["code"]
resource = resource.instantiate()
if !menu_overlay_scene.has(resource_name) and menu_overlay.get_children().has(resource): if !menu_overlay_scene.has(resource_name) and menu_overlay.get_children().has(resource):
core.exception("SceneManager","menu_overlay_scene does not contain \"" + resource_name + "\" but menu_overlay does") core.exception("SceneManager","menu_overlay_scene does not contain \"" + resource_name + "\" but menu_overlay does")
return core.Errors.CORE_EXCEPTION return core.Errors.CORE_EXCEPTION
@ -116,6 +117,7 @@ func add_cutscene(resource_name:String) -> int:
var err = core.error("SceneManager",core.Errors.SCENEMANAGER_ALREADY_LOADED,{"scene":resource_name,"overlay":"cutscene"}) var err = core.error("SceneManager",core.Errors.SCENEMANAGER_ALREADY_LOADED,{"scene":resource_name,"overlay":"cutscene"})
logger.error("CORE/smgr.gd",err["error"]) logger.error("CORE/smgr.gd",err["error"])
return err["code"] return err["code"]
resource = resource.instantiate()
if cutscene_overlay_scene != resource_name and cutscene_overlay.get_children().has(resource): if cutscene_overlay_scene != resource_name and cutscene_overlay.get_children().has(resource):
core.exception("SceneManager","cutscene_overlay_scene does not contain \"" + resource_name + "\" but cutscene_overlay does") core.exception("SceneManager","cutscene_overlay_scene does not contain \"" + resource_name + "\" but cutscene_overlay does")
return core.Errors.CORE_EXCEPTION return core.Errors.CORE_EXCEPTION
@ -142,6 +144,7 @@ func add_action(resource_name:String) -> int:
var err = core.error("SceneManager",core.Errors.SCENEMANAGER_ALREADY_LOADED,{"scene":resource_name,"overlay":"action"}) var err = core.error("SceneManager",core.Errors.SCENEMANAGER_ALREADY_LOADED,{"scene":resource_name,"overlay":"action"})
logger.error("CORE/smgr.gd",err["error"]) logger.error("CORE/smgr.gd",err["error"])
return err["code"] return err["code"]
resource = resource.instantiate()
if action_overlay_scene != resource_name and action_overlay.get_children().has(resource): if action_overlay_scene != resource_name and action_overlay.get_children().has(resource):
core.exception("SceneManager","action_overlay_scene does not contain \"" + resource_name + "\" but action_overlay does") core.exception("SceneManager","action_overlay_scene does not contain \"" + resource_name + "\" but action_overlay does")
return core.Errors.CORE_EXCEPTION return core.Errors.CORE_EXCEPTION