Compare commits
No commits in common. "75575991fadec3d64fe631c190454f9c4b0c9628" and "4914567fce2fe516c39ade803aad89b3045712ac" have entirely different histories.
75575991fa
...
4914567fce
6 changed files with 1 additions and 67 deletions
|
@ -1,38 +0,0 @@
|
||||||
extends Object
|
|
||||||
class_name AssetLoader
|
|
||||||
|
|
||||||
const DEFAULT_ASSETS_PATH = "res://mods"
|
|
||||||
|
|
||||||
## Path to the mods folder : [param res://mods] by default
|
|
||||||
## [br]
|
|
||||||
## (is not a const but should be treated as such, so the uppercase)
|
|
||||||
var ASSETS_PATH
|
|
||||||
|
|
||||||
var critical_error := false
|
|
||||||
|
|
||||||
|
|
||||||
func _init() -> void:
|
|
||||||
ASSETS_PATH = ProjectSettings.get_setting("game/mods/mod_path", DEFAULT_ASSETS_PATH)
|
|
||||||
var dir := DirAccess.open(ASSETS_PATH)
|
|
||||||
if not dir:
|
|
||||||
push_error("AssetLoader: Mods folder not found at '%s'" % ASSETS_PATH)
|
|
||||||
_show_error_popup("Mods folder not found at '%s'" % ASSETS_PATH)
|
|
||||||
critical_error = true
|
|
||||||
return
|
|
||||||
var mod_folders := dir.get_directories()
|
|
||||||
|
|
||||||
if mod_folders.is_empty():
|
|
||||||
push_error("AssetLoader: Mods folder '%s' is empty — no mods to load." % ASSETS_PATH)
|
|
||||||
_show_error_popup("Mods folder '%s' is empty — no mods to load." % ASSETS_PATH)
|
|
||||||
critical_error = true
|
|
||||||
return
|
|
||||||
|
|
||||||
|
|
||||||
## This will show a native MessageBox on Windows,
|
|
||||||
## a native dialog on macOS, and GTK/QT dialog on Linux.
|
|
||||||
func _show_error_popup(message: String) -> void:
|
|
||||||
OS.alert("AssetLoader:"+message, "AssetLoader:Error")
|
|
||||||
|
|
||||||
|
|
||||||
func load_all():
|
|
||||||
pass
|
|
|
@ -1 +0,0 @@
|
||||||
uid://qkh5uvr4st7i
|
|
|
@ -1,25 +0,0 @@
|
||||||
extends Node
|
|
||||||
## Should always be at the top of autoloads
|
|
||||||
|
|
||||||
|
|
||||||
func _ready() -> void:
|
|
||||||
var loader := AssetLoader.new()
|
|
||||||
# If there was a critical error, quit immediately
|
|
||||||
if loader.critical_error:
|
|
||||||
Engine.get_main_loop().quit(1)
|
|
||||||
return
|
|
||||||
loader.load_all() # TODO: Making it async
|
|
||||||
|
|
||||||
# Otherwise, continue startup
|
|
||||||
_start_game()
|
|
||||||
|
|
||||||
|
|
||||||
## This will show a native MessageBox on Windows,
|
|
||||||
## a native dialog on macOS, and GTK/QT dialog on Linux.
|
|
||||||
func _show_error_popup(context:String, message: String) -> void:
|
|
||||||
OS.alert(context+":"+message, context+":Error")
|
|
||||||
|
|
||||||
|
|
||||||
func _start_game() -> void:
|
|
||||||
print("Game starting...")
|
|
||||||
#TODO: Load main menu or world scene
|
|
|
@ -1 +0,0 @@
|
||||||
uid://bbmtxflx0ivgp
|
|
File diff suppressed because one or more lines are too long
|
@ -21,7 +21,6 @@ config/windows_native_icon="res://4589AD_icon.ico"
|
||||||
|
|
||||||
[autoload]
|
[autoload]
|
||||||
|
|
||||||
Bootstrap="*res://autoloads/bootstrap.gd"
|
|
||||||
DebugTools="*res://dev/debug_tools.tscn"
|
DebugTools="*res://dev/debug_tools.tscn"
|
||||||
|
|
||||||
[debug]
|
[debug]
|
||||||
|
|
Loading…
Reference in a new issue