This commit is contained in:
2025-11-26 18:57:37 -06:00
parent 1e83200bba
commit d532a9ab21
25 changed files with 525 additions and 534 deletions

View File

@@ -9,77 +9,77 @@ var playerDestinationNodeName:String
var newMapLoaded:bool = false
func isMapChanging() -> bool:
return newMapPath != ""
return newMapPath != ""
func _enter_tree() -> void:
pass
pass
func _exit_tree() -> void:
TRANSITION.fadeOutEnd.disconnect(onFadeOutEnd)
TRANSITION.fadeInEnd.disconnect(onFadeInEnd)
TRANSITION.fadeOutEnd.disconnect(onFadeOutEnd)
TRANSITION.fadeInEnd.disconnect(onFadeInEnd)
func _process(_delta:float) -> void:
if(!isMapChanging()):
return
if(!isMapChanging()):
return
var status = ResourceLoader.load_threaded_get_status(newMapPath)
if status == ResourceLoader.THREAD_LOAD_FAILED:
push_error("Failed to load map: " + newMapPath)
newMapPath = ""
elif status == ResourceLoader.THREAD_LOAD_INVALID_RESOURCE:
push_error("Failed to load map: " + newMapPath)
newMapPath = ""
var status = ResourceLoader.load_threaded_get_status(newMapPath)
if status == ResourceLoader.THREAD_LOAD_FAILED:
push_error("Failed to load map: " + newMapPath)
newMapPath = ""
elif status == ResourceLoader.THREAD_LOAD_INVALID_RESOURCE:
push_error("Failed to load map: " + newMapPath)
newMapPath = ""
elif status == ResourceLoader.THREAD_LOAD_IN_PROGRESS:
print("Map loading in progress for: " + newMapPath)
elif status == ResourceLoader.THREAD_LOAD_IN_PROGRESS:
print("Map loading in progress for: " + newMapPath)
elif status == ResourceLoader.THREAD_LOAD_LOADED:
newMapLoaded = true
newMapReady()
elif status == ResourceLoader.THREAD_LOAD_LOADED:
newMapLoaded = true
newMapReady()
func mapChange(map:String, playerDestinationNodeName:String) -> void:
# Begin Loading new map
newMapPath = map
playerDestinationNodeName = playerDestinationNodeName
ResourceLoader.load_threaded_request(newMapPath)
# Begin Loading new map
newMapPath = map
playerDestinationNodeName = playerDestinationNodeName
ResourceLoader.load_threaded_request(newMapPath)
# Begin fadeout
hasFadedOut = false
TRANSITION.fade(TransitionSingleton.FadeType.FADE_OUT)
TRANSITION.fadeOutEnd.connect(onFadeOutEnd)
# Begin fadeout
hasFadedOut = false
TRANSITION.fade(TransitionSingleton.FadeType.FADE_OUT)
TRANSITION.fadeOutEnd.connect(onFadeOutEnd)
func onFadeOutEnd() -> void:
# Fade out has occurred, are we still waiting for the map to load?
TRANSITION.fadeOutEnd.disconnect(onFadeOutEnd)
hasFadedOut = true
# Fade out has occurred, are we still waiting for the map to load?
TRANSITION.fadeOutEnd.disconnect(onFadeOutEnd)
hasFadedOut = true
# Make sure we aren't still waiting for the map to load.
if !newMapLoaded:
return
newMapReady()
# Make sure we aren't still waiting for the map to load.
if !newMapLoaded:
return
newMapReady()
func newMapReady():
if !hasFadedOut:
return
if !hasFadedOut:
return
# Instantiate the new map
var mapResource = ResourceLoader.load_threaded_get(newMapPath)
if mapResource == null:
push_error("Failed to load map resource: " + newMapPath)
return
# Stop tracking new map name
newMapPath = ""
# Instantiate the new map
var mapResource = ResourceLoader.load_threaded_get(newMapPath)
if mapResource == null:
push_error("Failed to load map resource: " + newMapPath)
return
# Stop tracking new map name
newMapPath = ""
# Emit event
mapChanged.emit(mapResource, playerDestinationNodeName)
# Emit event
mapChanged.emit(mapResource, playerDestinationNodeName)
# Begin Fade In
TRANSITION.fade(TransitionSingleton.FadeType.FADE_IN)
TRANSITION.fadeInEnd.connect(onFadeInEnd)
# Begin Fade In
TRANSITION.fade(TransitionSingleton.FadeType.FADE_IN)
TRANSITION.fadeInEnd.connect(onFadeInEnd)
func onFadeInEnd() -> void:
TRANSITION.fadeInEnd.disconnect(onFadeInEnd)
TRANSITION.fadeInEnd.disconnect(onFadeInEnd)

View File

@@ -3,28 +3,28 @@ class_name PauseSingleton extends Node
var cutscenePaused:bool = false
func cutscenePause() -> void:
cutscenePaused = true
cutscenePaused = true
func cutsceneResume() -> void:
cutscenePaused = false
cutscenePaused = false
func isMovementPaused() -> bool:
if cutscenePaused:
return true
if cutscenePaused:
return true
if !UI.TEXTBOX.isClosed:
return true
if !UI.TEXTBOX.isClosed:
return true
if UI.PAUSE.isOpen():
return true
if UI.PAUSE.isOpen():
return true
if OVERWORLD.isMapChanging():
return true
return false
if OVERWORLD.isMapChanging():
return true
return false
func menuPause() -> void:
if UI.PAUSE.isOpen():
UI.PAUSE.close()
else:
UI.PAUSE.open()
if UI.PAUSE.isOpen():
UI.PAUSE.close()
else:
UI.PAUSE.open()