Renamed globals to autoloads for clarity
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
# game-shell
|
||||
|
||||
> **Note:** Meant to be both a shell and also starting base for games. In shell mode it loads PCK files such as assets, game, lobby-client, and store. In game mode you extend the scripts and scenes such as data_bridge and the shell replaces the defaults with the new. You export as game.pck
|
||||
> **Note 1:** Meant to be both a shell and also starting base for games. In shell mode it loads PCK files such as assets, game, lobby-client, and store. In game mode you extend the scripts and scenes such as data_bridge and the shell replaces the defaults with the new. You export as game.pck.
|
||||
> **Note 2:** When converting to use as 'game' project, shell.gd and shell.tscn need to be renamed to game_core.<xyz>.
|
||||
> **Note 3:** Input mapping need to be duplicated between the shell and game projet.godot files. It's cleaner than trying to duplicate Godot internals of input mapping.
|
||||
|
||||
@@ -23,8 +23,8 @@ boot_splash/minimum_display_time=2500
|
||||
|
||||
[autoload]
|
||||
|
||||
Globals="*res://globals/globals.gd"
|
||||
MessageBus="*res://globals/message_bus.gd"
|
||||
Globals="*res://autoloads/globals.gd"
|
||||
MessageBus="*res://autoloads/message_bus.gd"
|
||||
|
||||
[editor]
|
||||
|
||||
@@ -46,6 +46,30 @@ aim_decline={
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194322,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
aim_pulse={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
aim_release={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":32,"key_label":0,"unicode":32,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":2,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
aim_rotate_left={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":65,"key_label":0,"unicode":97,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194319,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
aim_rotate_right={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":68,"key_label":0,"unicode":100,"location":0,"echo":false,"script":null)
|
||||
, Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194321,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
||||
[physics]
|
||||
|
||||
|
||||
38
shell.gd
38
shell.gd
@@ -1,27 +1,40 @@
|
||||
class_name Shell extends Node
|
||||
static var instance: Shell
|
||||
|
||||
|
||||
@onready var game_server: GameServer = $game_server
|
||||
@onready var game_client: GameClient = $game_client
|
||||
|
||||
|
||||
|
||||
func _init() -> void:
|
||||
instance = self
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
instance.run()
|
||||
|
||||
|
||||
func run() -> void:
|
||||
_load_resources()
|
||||
_load_scene()
|
||||
#_parse_args()
|
||||
#_load_scene()
|
||||
|
||||
var game_core = load("res://game_core.gd").new()
|
||||
game_core.instance.run()
|
||||
|
||||
|
||||
func _load_resources():
|
||||
func _load_resources() -> void:
|
||||
_load_asset_pck()
|
||||
_load_game_pck()
|
||||
_load_lobby_pck()
|
||||
_load_store_pck()
|
||||
_load_mods_manager_pck()
|
||||
|
||||
|
||||
func _load_asset_pck():
|
||||
func _load_asset_pck() -> void:
|
||||
_load_resource_pck("assets.pck")
|
||||
|
||||
func _load_game_pck():
|
||||
func _load_game_pck() -> void:
|
||||
_load_resource_pck("game.pck")
|
||||
|
||||
$data_bridge.free()
|
||||
@@ -32,13 +45,16 @@ func _load_game_pck():
|
||||
add_child(data_bridge)
|
||||
move_child(data_bridge, 0)
|
||||
|
||||
func _load_lobby_pck():
|
||||
func _load_lobby_pck() -> void:
|
||||
_load_resource_pck("lobby-client.pck")
|
||||
|
||||
func _load_store_pck():
|
||||
func _load_store_pck() -> void:
|
||||
_load_resource_pck("store.pck")
|
||||
|
||||
func _load_resource_pck(target: String):
|
||||
func _load_mods_manager_pck() -> void:
|
||||
_load_resource_pck("mods-manager.pck")
|
||||
|
||||
func _load_resource_pck(target: String) -> void:
|
||||
#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)
|
||||
@@ -53,10 +69,6 @@ func _load_resource_pck(target: String):
|
||||
return
|
||||
|
||||
|
||||
func _load_scene():
|
||||
func _load_scene() -> void:
|
||||
add_child(Globals.multiplayer_data.multiplayer_synchronizer)
|
||||
move_child(Globals.multiplayer_data.multiplayer_synchronizer, 0)
|
||||
|
||||
Globals.game_state.set_game_scene(
|
||||
"res://scenes/screens/start_screen/start.tscn"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user