mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-28 01:43:22 +08:00
Windows server prefab builds and server tidying
This commit is contained in:
parent
0caaef31cb
commit
942888be01
72
Makefile
72
Makefile
@ -290,12 +290,76 @@ prefab-windows-release-build: prereqs \
|
||||
build/prefab/windows/release/BallisticaCore.exe: .efrocachemap
|
||||
@tools/snippets efrocache_get $@
|
||||
|
||||
prefab-windows-server-debug: prefab-windows-server-debug-build
|
||||
build/prefab/windows-server/debug/dist/Python.exe \
|
||||
build/prefab/windows-server/debug/ballisticacore_server.py
|
||||
|
||||
prefab-windows-server-debug-build: prereqs \
|
||||
assets-windows-${PREFAB_WINDOWS_PLATFORM} \
|
||||
build/prefab/windows-server/debug/dist/ballisticacore_headless.exe \
|
||||
build/prefab/windows-server/debug/launch_ballisticacore_server.bat \
|
||||
build/prefab/windows-server/debug/ballisticacore_server.py \
|
||||
build/prefab/windows-server/debug/config_template.yaml
|
||||
@${STAGE_ASSETS} -win-$(PREFAB_WINDOWS_PLATFORM) \
|
||||
build/prefab/windows-server/debug/dist
|
||||
|
||||
build/prefab/windows-server/debug/dist/ballisticacore_headless.exe: .efrocachemap
|
||||
@tools/snippets efrocache_get $@
|
||||
|
||||
build/prefab/windows-server/debug/ballisticacore_server.py: \
|
||||
assets/src/server/server.py
|
||||
cp $< $@
|
||||
|
||||
build/prefab/windows-server/debug/launch_ballisticacore_server.bat: \
|
||||
assets/src/server/server.bat
|
||||
cp $< $@
|
||||
|
||||
build/prefab/windows-server/debug/config_template.yaml: \
|
||||
assets/src/server/config.yaml
|
||||
cp $< $@
|
||||
|
||||
prefab-windows-server-release: prefab-windows-server-release-build
|
||||
build/prefab/windows-server/release/dist/Python.exe \
|
||||
build/prefab/windows-server/release/ballisticacore_server.py
|
||||
|
||||
prefab-windows-server-release-build: prereqs \
|
||||
assets-windows-${PREFAB_WINDOWS_PLATFORM} \
|
||||
build/prefab/windows-server/release/dist/ballisticacore_headless.exe \
|
||||
build/prefab/windows-server/release/launch_ballisticacore_server.bat \
|
||||
build/prefab/windows-server/release/ballisticacore_server.py \
|
||||
build/prefab/windows-server/release/config_template.yaml
|
||||
@${STAGE_ASSETS} -win-$(PREFAB_WINDOWS_PLATFORM) \
|
||||
build/prefab/windows-server/release/dist
|
||||
|
||||
build/prefab/windows-server/release/dist/ballisticacore_headless.exe: .efrocachemap
|
||||
@tools/snippets efrocache_get $@
|
||||
|
||||
build/prefab/windows-server/release/ballisticacore_server.py: \
|
||||
assets/src/server/server.py
|
||||
cp $< $@
|
||||
|
||||
build/prefab/windows-server/release/launch_ballisticacore_server.bat: \
|
||||
assets/src/server/server.bat
|
||||
cp $< $@
|
||||
|
||||
build/prefab/windows-server/release/config_template.yaml: \
|
||||
assets/src/server/config.yaml
|
||||
cp $< $@
|
||||
|
||||
# Tell make which of these targets don't represent files.
|
||||
.PHONY: prefab-debug prefab-debug-build prefab-release prefab-release-build \
|
||||
prefab-mac-debug prefab-mac-debug-build prefab-mac-release \
|
||||
prefab-mac-release-build prefab-linux-debug prefab-linux-debug-build \
|
||||
prefab-linux-release prefab-linux-release-build prefab-windows-debug \
|
||||
prefab-windows-debug-build prefab-windows-release prefab-windows-release-build
|
||||
prefab-server-debug prefab-server-debug-build prefab-server-release \
|
||||
prefab-server-release-build prefab-mac-debug prefab-mac-debug-build \
|
||||
prefab-mac-release prefab-mac-release-build prefab-mac-server-debug \
|
||||
prefab-mac-server-debug-build prefab-mac-server-release \
|
||||
prefab-mac-server-release-build prefab-linux-debug prefab-linux-debug-build \
|
||||
prefab-linux-release prefab-linux-release-build prefab-linux-server-debug \
|
||||
prefab-linux-server-debug-build prefab-linux-server-release \
|
||||
prefab-linux-server-release-build prefab-windows-debug \
|
||||
prefab-windows-debug-build prefab-windows-release \
|
||||
prefab-windows-release-build prefab-windows-server-debug \
|
||||
prefab-windows-server-debug-build prefab-windows-server-release \
|
||||
prefab-windows-server-release-build
|
||||
|
||||
|
||||
################################################################################
|
||||
|
||||
@ -34,7 +34,7 @@ NOTE: This file was autogenerated by gendummymodule; do not edit by hand.
|
||||
"""
|
||||
|
||||
# (hash we can use to see if this file is out of date)
|
||||
# SOURCES_HASH=244170618255470168722716236009566191217
|
||||
# SOURCES_HASH=163268159341929947935319762789060730391
|
||||
|
||||
# I'm sorry Pylint. I know this file saddens you. Be strong.
|
||||
# pylint: disable=useless-suppression
|
||||
|
||||
@ -313,6 +313,8 @@ class App:
|
||||
assert isinstance(self.toolbar_test, bool)
|
||||
self.kiosk_mode: bool = env['kiosk_mode']
|
||||
assert isinstance(self.kiosk_mode, bool)
|
||||
self.headless_build: bool = env['headless_build']
|
||||
assert isinstance(self.headless_build, bool)
|
||||
|
||||
# Misc.
|
||||
self.default_language = self._get_default_language()
|
||||
@ -350,6 +352,7 @@ class App:
|
||||
self.server_config_dirty = False
|
||||
self.run_server_wait_timer: Optional[ba.Timer] = None
|
||||
self.server_playlist_fetch: Optional[Dict[str, Any]] = None
|
||||
self.next_server_account_warn_time: Optional[float] = None
|
||||
self.launched_server = False
|
||||
self.run_server_first_run = True
|
||||
|
||||
@ -606,7 +609,7 @@ class App:
|
||||
self.special_offer = config['pendingSpecialOffer']['o']
|
||||
specialoffer.show_offer()
|
||||
|
||||
if self.subplatform != 'headless':
|
||||
if not self.headless_build:
|
||||
_ba.timer(3.0, check_special_offer, timetype=TimeType.REAL)
|
||||
|
||||
# Start scanning for things exposed via ba_meta.
|
||||
@ -614,7 +617,7 @@ class App:
|
||||
|
||||
# Auto-sign-in to a local account in a moment if we're set to.
|
||||
def do_auto_sign_in() -> None:
|
||||
if self.subplatform == 'headless':
|
||||
if self.headless_build:
|
||||
_ba.sign_in('Local')
|
||||
elif cfg.get('Auto Account State') == 'Local':
|
||||
_ba.sign_in('Local')
|
||||
|
||||
@ -126,7 +126,7 @@ def get_unowned_maps() -> List[str]:
|
||||
"""
|
||||
from ba import _store
|
||||
unowned_maps: Set[str] = set()
|
||||
if _ba.app.subplatform != 'headless':
|
||||
if not _ba.app.headless_build:
|
||||
for map_section in _store.get_store_layout()['maps']:
|
||||
for mapitem in map_section['items']:
|
||||
if not _ba.get_purchased(mapitem):
|
||||
|
||||
@ -351,7 +351,7 @@ def get_unowned_game_types() -> Set[Type[ba.GameActivity]]:
|
||||
try:
|
||||
from ba import _store
|
||||
unowned_games: Set[Type[ba.GameActivity]] = set()
|
||||
if _ba.app.subplatform != 'headless':
|
||||
if not _ba.app.headless_build:
|
||||
for section in _store.get_store_layout()['minigames']:
|
||||
for mname in section['items']:
|
||||
if not _ba.get_purchased(mname):
|
||||
|
||||
@ -67,12 +67,22 @@ def config_server(config_file: str = None) -> None:
|
||||
# Launch the server only the first time through;
|
||||
# after that it will be self-sustaining.
|
||||
if not app.launched_server:
|
||||
app.next_server_account_warn_time = time.time() + 10.0
|
||||
|
||||
# Now sit around until we're signed in and then kick off the server.
|
||||
with _ba.Context('ui'):
|
||||
|
||||
def do_it() -> None:
|
||||
if _ba.get_account_state() == 'signed_in':
|
||||
|
||||
signed_in = _ba.get_account_state() == 'signed_in'
|
||||
|
||||
if not signed_in:
|
||||
curtime = time.time()
|
||||
assert app.next_server_account_warn_time is not None
|
||||
if curtime > app.next_server_account_warn_time:
|
||||
print('Still waiting for account sign-in...')
|
||||
app.next_server_account_warn_time = curtime + 10.0
|
||||
else:
|
||||
can_launch = False
|
||||
|
||||
# If we're trying to fetch a playlist, we do that first.
|
||||
@ -165,7 +175,7 @@ def launch_server_session() -> None:
|
||||
|
||||
if app.run_server_first_run:
|
||||
print((('BallisticaCore headless '
|
||||
if app.subplatform == 'headless' else 'BallisticaCore ') +
|
||||
if app.headless_build else 'BallisticaCore ') +
|
||||
str(app.version) + ' (' + str(app.build_number) +
|
||||
') entering server-mode ' + time.strftime('%c')))
|
||||
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
:: All this does is run the ballisticacore_server script with the included python interpreter
|
||||
python.exe ballisticacore_server.py
|
||||
dist\\python.exe ballisticacore_server.py
|
||||
|
||||
@ -193,23 +193,23 @@ def _run_server_cycle(binary_path: str, config: Dict[str, Any],
|
||||
# Most of our config values we can feed to ballisticacore as it is running
|
||||
# (see below). However certain things such as network-port need to be
|
||||
# present in the config file at launch, so let's write that out first.
|
||||
if not os.path.exists('bacfg'):
|
||||
os.mkdir('bacfg')
|
||||
if os.path.exists('bacfg/config.json'):
|
||||
with open('bacfg/config.json') as infile:
|
||||
bacfg = json.loads(infile.read())
|
||||
if not os.path.exists('ba_root'):
|
||||
os.mkdir('ba_root')
|
||||
if os.path.exists('ba_root/config.json'):
|
||||
with open('ba_root/config.json') as infile:
|
||||
ba_root = json.loads(infile.read())
|
||||
else:
|
||||
bacfg = {}
|
||||
bacfg['Port'] = config['port']
|
||||
bacfg['Enable Telnet'] = config['enable_telnet']
|
||||
bacfg['Telnet Port'] = config['telnet_port']
|
||||
bacfg['Telnet Password'] = config['telnet_password']
|
||||
with open('bacfg/config.json', 'w') as outfile:
|
||||
outfile.write(json.dumps(bacfg))
|
||||
ba_root = {}
|
||||
ba_root['Port'] = config['port']
|
||||
ba_root['Enable Telnet'] = config['enable_telnet']
|
||||
ba_root['Telnet Port'] = config['telnet_port']
|
||||
ba_root['Telnet Password'] = config['telnet_password']
|
||||
with open('ba_root/config.json', 'w') as outfile:
|
||||
outfile.write(json.dumps(ba_root))
|
||||
|
||||
# Launch our binary and grab its stdin; we'll use this to feed
|
||||
# it commands.
|
||||
process = subprocess.Popen([binary_path, '-cfgdir', 'bacfg'],
|
||||
process = subprocess.Popen([binary_path, '-cfgdir', 'ba_root'],
|
||||
stdin=subprocess.PIPE)
|
||||
|
||||
# Set quit to True any time after launching the server to gracefully
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
|
||||
<h4><em>last updated on 2020-04-20 for Ballistica version 1.5.0 build 20001</em></h4>
|
||||
<h4><em>last updated on 2020-04-21 for Ballistica version 1.5.0 build 20001</em></h4>
|
||||
<p>This page documents the Python classes and functions in the 'ba' module,
|
||||
which are the ones most relevant to modding in Ballistica. If you come across something you feel should be included here or could be better explained, please <a href="mailto:support@froemling.net">let me know</a>. Happy modding!</p>
|
||||
<hr>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user