-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.py
More file actions
executable file
·90 lines (74 loc) · 2.64 KB
/
main.py
File metadata and controls
executable file
·90 lines (74 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/usr/bin/env python3
import sys
import traceback
from types import TracebackType
def except_hook(t, e: BaseException, tr: TracebackType):
if isinstance(e, Exception):
traceback.print_exception(t, e, tr)
input("Press Enter to Exit")
sys.excepthook = except_hook
import os
import fa_paths
import multiplayer
from fa_menu import *
import modify_config
import launch_and_monitor
import save_management
from fa_arg_parse import args
from map_gen_setting_menu import map_menu
from translations import check_lang
from fa_scenarios import get_scenarios, pre_launch_scenario
from fa_mod_menu import mod_menu, check_for_main_mod
from version import version
from credentials_menu import sign_in_menu
from github_mods import update_all
from launcher_update import check_and_update
def main():
menu = {
"Launch last played": launch_and_monitor.just_launch,
("gui-menu.single-player-menu",): {
("gui-menu.new-game",): {
("gui-new-game.main-game",): map_menu,
("gui-new-game.mod-scenarios",): pre_launch_scenario,
},
("gui-menu.load-game",): {
save_management.get_menu_saved_games: launch_and_monitor.launch,
},
},
("gui-menu.multi-player-menu",): {
multiplayer.get_username_menu: sign_in_menu,
"Host Settings": multiplayer.host_settings_menu(),
("gui-menu.host-saved-game",): {
save_management.get_menu_saved_games: multiplayer.multiplayer_host,
},
("gui-menu.browse-public-games",): {
"Friend List": multiplayer.friend_list,
"List Games With Friends": {
multiplayer.games_with_friends_menu: multiplayer.multiplayer_join
},
},
("gui-menu.connect-to-address",): launch_and_monitor.connect_to_address_menu,
},
("gui-menu.mods",): mod_menu,
("gui-menu.about",): {
"Factorio": {
"_desc": fa_paths.FACTORIO_VERSION,
},
"Launcher": {
"_desc": f"Factorio Access Launcher Version {version.tag}\nCommit:{version.commit}"
},
},
("gui.exit",): launch_and_monitor.time_to_exit,
}
update_all()
check_lang()
check_for_main_mod()
modify_config.do_config_check()
if args.launch:
launch_and_monitor.launch_with_params([], save_rename=False)
else:
main_menu = new_menu(("gui-menu.main-menu",), menu)
main_menu()
# Check for launcher updates first - if applied, skip main and exit cleanly
if not check_and_update():
main()