2026-08-23 12:38:19 -05:00
|
|
|
class_name Shell extends Node
|
2026-08-29 18:31:14 -05:00
|
|
|
static var instance: Shell
|
2026-08-23 12:38:19 -05:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@onready var game_server: GameServer = $game_server
|
|
|
|
|
@onready var game_client: GameClient = $game_client
|
|
|
|
|
|
|
|
|
|
|
2026-08-29 18:31:14 -05:00
|
|
|
|
|
|
|
|
func _init() -> void:
|
|
|
|
|
instance = self
|
|
|
|
|
|
|
|
|
|
|
2026-08-23 12:38:19 -05:00
|
|
|
func _ready() -> void:
|
2026-08-29 18:31:14 -05:00
|
|
|
instance.run()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func run() -> void:
|
2026-08-23 12:38:19 -05:00
|
|
|
_load_resources()
|
2026-08-29 18:31:14 -05:00
|
|
|
#_load_scene()
|
|
|
|
|
|
|
|
|
|
var game_core = load("res://game_core.gd").new()
|
|
|
|
|
game_core.instance.run()
|
2026-08-23 12:38:19 -05:00
|
|
|
|
|
|
|
|
|
2026-08-29 18:31:14 -05:00
|
|
|
func _load_resources() -> void:
|
2026-08-23 12:38:19 -05:00
|
|
|
_load_asset_pck()
|
|
|
|
|
_load_game_pck()
|
|
|
|
|
_load_lobby_pck()
|
|
|
|
|
_load_store_pck()
|
2026-08-29 18:31:14 -05:00
|
|
|
_load_mods_manager_pck()
|
2026-08-23 12:38:19 -05:00
|
|
|
|
|
|
|
|
|
2026-08-29 18:31:14 -05:00
|
|
|
func _load_asset_pck() -> void:
|
2026-08-23 12:38:19 -05:00
|
|
|
_load_resource_pck("assets.pck")
|
|
|
|
|
|
2026-08-29 18:31:14 -05:00
|
|
|
func _load_game_pck() -> void:
|
2026-08-23 12:38:19 -05:00
|
|
|
_load_resource_pck("game.pck")
|
|
|
|
|
|
|
|
|
|
$data_bridge.free()
|
|
|
|
|
var data_bridge = Globals.cache_invalidate_load_resource(
|
|
|
|
|
"res://scripts/data/data_bridge.tscn"
|
|
|
|
|
).instantiate()
|
|
|
|
|
|
|
|
|
|
add_child(data_bridge)
|
|
|
|
|
move_child(data_bridge, 0)
|
|
|
|
|
|
2026-08-29 18:31:14 -05:00
|
|
|
func _load_lobby_pck() -> void:
|
2026-08-23 12:38:19 -05:00
|
|
|
_load_resource_pck("lobby-client.pck")
|
|
|
|
|
|
2026-08-29 18:31:14 -05:00
|
|
|
func _load_store_pck() -> void:
|
2026-08-23 12:38:19 -05:00
|
|
|
_load_resource_pck("store.pck")
|
|
|
|
|
|
2026-08-29 18:31:14 -05:00
|
|
|
func _load_mods_manager_pck() -> void:
|
|
|
|
|
_load_resource_pck("mods-manager.pck")
|
|
|
|
|
|
|
|
|
|
func _load_resource_pck(target: String) -> void:
|
2026-08-23 12:38:19 -05:00
|
|
|
#var TARGET_PCK := OS.get_executable_path().get_base_dir() + "/modules/" + target
|
|
|
|
|
var TARGET_PCK = "/home/abaddon/Coding/Projects/Active/Godot_Projects/builds/desktop/shell-test/modules/" + target
|
|
|
|
|
push_warning("PCK Path: ", TARGET_PCK)
|
|
|
|
|
|
|
|
|
|
if not FileAccess.file_exists(TARGET_PCK):
|
|
|
|
|
push_warning(target + " PCK is missing.")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
var target_pck_loaded := ProjectSettings.load_resource_pack(TARGET_PCK, true)
|
|
|
|
|
if not target_pck_loaded:
|
|
|
|
|
push_error("Failed to load " + target + " PCK.")
|
|
|
|
|
return
|
|
|
|
|
|
|
|
|
|
|
2026-08-29 18:31:14 -05:00
|
|
|
func _load_scene() -> void:
|
2026-08-23 12:38:19 -05:00
|
|
|
add_child(Globals.multiplayer_data.multiplayer_synchronizer)
|
|
|
|
|
move_child(Globals.multiplayer_data.multiplayer_synchronizer, 0)
|