mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-06 23:59:18 +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
|
build/prefab/windows/release/BallisticaCore.exe: .efrocachemap
|
||||||
@tools/snippets efrocache_get $@
|
@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.
|
# Tell make which of these targets don't represent files.
|
||||||
.PHONY: prefab-debug prefab-debug-build prefab-release prefab-release-build \
|
.PHONY: prefab-debug prefab-debug-build prefab-release prefab-release-build \
|
||||||
prefab-mac-debug prefab-mac-debug-build prefab-mac-release \
|
prefab-server-debug prefab-server-debug-build prefab-server-release \
|
||||||
prefab-mac-release-build prefab-linux-debug prefab-linux-debug-build \
|
prefab-server-release-build prefab-mac-debug prefab-mac-debug-build \
|
||||||
prefab-linux-release prefab-linux-release-build prefab-windows-debug \
|
prefab-mac-release prefab-mac-release-build prefab-mac-server-debug \
|
||||||
prefab-windows-debug-build prefab-windows-release prefab-windows-release-build
|
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)
|
# (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.
|
# I'm sorry Pylint. I know this file saddens you. Be strong.
|
||||||
# pylint: disable=useless-suppression
|
# pylint: disable=useless-suppression
|
||||||
|
|||||||
@ -313,6 +313,8 @@ class App:
|
|||||||
assert isinstance(self.toolbar_test, bool)
|
assert isinstance(self.toolbar_test, bool)
|
||||||
self.kiosk_mode: bool = env['kiosk_mode']
|
self.kiosk_mode: bool = env['kiosk_mode']
|
||||||
assert isinstance(self.kiosk_mode, bool)
|
assert isinstance(self.kiosk_mode, bool)
|
||||||
|
self.headless_build: bool = env['headless_build']
|
||||||
|
assert isinstance(self.headless_build, bool)
|
||||||
|
|
||||||
# Misc.
|
# Misc.
|
||||||
self.default_language = self._get_default_language()
|
self.default_language = self._get_default_language()
|
||||||
@ -350,6 +352,7 @@ class App:
|
|||||||
self.server_config_dirty = False
|
self.server_config_dirty = False
|
||||||
self.run_server_wait_timer: Optional[ba.Timer] = None
|
self.run_server_wait_timer: Optional[ba.Timer] = None
|
||||||
self.server_playlist_fetch: Optional[Dict[str, Any]] = None
|
self.server_playlist_fetch: Optional[Dict[str, Any]] = None
|
||||||
|
self.next_server_account_warn_time: Optional[float] = None
|
||||||
self.launched_server = False
|
self.launched_server = False
|
||||||
self.run_server_first_run = True
|
self.run_server_first_run = True
|
||||||
|
|
||||||
@ -606,7 +609,7 @@ class App:
|
|||||||
self.special_offer = config['pendingSpecialOffer']['o']
|
self.special_offer = config['pendingSpecialOffer']['o']
|
||||||
specialoffer.show_offer()
|
specialoffer.show_offer()
|
||||||
|
|
||||||
if self.subplatform != 'headless':
|
if not self.headless_build:
|
||||||
_ba.timer(3.0, check_special_offer, timetype=TimeType.REAL)
|
_ba.timer(3.0, check_special_offer, timetype=TimeType.REAL)
|
||||||
|
|
||||||
# Start scanning for things exposed via ba_meta.
|
# 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.
|
# Auto-sign-in to a local account in a moment if we're set to.
|
||||||
def do_auto_sign_in() -> None:
|
def do_auto_sign_in() -> None:
|
||||||
if self.subplatform == 'headless':
|
if self.headless_build:
|
||||||
_ba.sign_in('Local')
|
_ba.sign_in('Local')
|
||||||
elif cfg.get('Auto Account State') == 'Local':
|
elif cfg.get('Auto Account State') == 'Local':
|
||||||
_ba.sign_in('Local')
|
_ba.sign_in('Local')
|
||||||
|
|||||||
@ -126,7 +126,7 @@ def get_unowned_maps() -> List[str]:
|
|||||||
"""
|
"""
|
||||||
from ba import _store
|
from ba import _store
|
||||||
unowned_maps: Set[str] = set()
|
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 map_section in _store.get_store_layout()['maps']:
|
||||||
for mapitem in map_section['items']:
|
for mapitem in map_section['items']:
|
||||||
if not _ba.get_purchased(mapitem):
|
if not _ba.get_purchased(mapitem):
|
||||||
|
|||||||
@ -351,7 +351,7 @@ def get_unowned_game_types() -> Set[Type[ba.GameActivity]]:
|
|||||||
try:
|
try:
|
||||||
from ba import _store
|
from ba import _store
|
||||||
unowned_games: Set[Type[ba.GameActivity]] = set()
|
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 section in _store.get_store_layout()['minigames']:
|
||||||
for mname in section['items']:
|
for mname in section['items']:
|
||||||
if not _ba.get_purchased(mname):
|
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;
|
# Launch the server only the first time through;
|
||||||
# after that it will be self-sustaining.
|
# after that it will be self-sustaining.
|
||||||
if not app.launched_server:
|
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.
|
# Now sit around until we're signed in and then kick off the server.
|
||||||
with _ba.Context('ui'):
|
with _ba.Context('ui'):
|
||||||
|
|
||||||
def do_it() -> None:
|
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
|
can_launch = False
|
||||||
|
|
||||||
# If we're trying to fetch a playlist, we do that first.
|
# 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:
|
if app.run_server_first_run:
|
||||||
print((('BallisticaCore headless '
|
print((('BallisticaCore headless '
|
||||||
if app.subplatform == 'headless' else 'BallisticaCore ') +
|
if app.headless_build else 'BallisticaCore ') +
|
||||||
str(app.version) + ' (' + str(app.build_number) +
|
str(app.version) + ' (' + str(app.build_number) +
|
||||||
') entering server-mode ' + time.strftime('%c')))
|
') entering server-mode ' + time.strftime('%c')))
|
||||||
|
|
||||||
|
|||||||
@ -1,2 +1,2 @@
|
|||||||
:: All this does is run the ballisticacore_server script with the included python interpreter
|
:: 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
|
# 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
|
# (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.
|
# present in the config file at launch, so let's write that out first.
|
||||||
if not os.path.exists('bacfg'):
|
if not os.path.exists('ba_root'):
|
||||||
os.mkdir('bacfg')
|
os.mkdir('ba_root')
|
||||||
if os.path.exists('bacfg/config.json'):
|
if os.path.exists('ba_root/config.json'):
|
||||||
with open('bacfg/config.json') as infile:
|
with open('ba_root/config.json') as infile:
|
||||||
bacfg = json.loads(infile.read())
|
ba_root = json.loads(infile.read())
|
||||||
else:
|
else:
|
||||||
bacfg = {}
|
ba_root = {}
|
||||||
bacfg['Port'] = config['port']
|
ba_root['Port'] = config['port']
|
||||||
bacfg['Enable Telnet'] = config['enable_telnet']
|
ba_root['Enable Telnet'] = config['enable_telnet']
|
||||||
bacfg['Telnet Port'] = config['telnet_port']
|
ba_root['Telnet Port'] = config['telnet_port']
|
||||||
bacfg['Telnet Password'] = config['telnet_password']
|
ba_root['Telnet Password'] = config['telnet_password']
|
||||||
with open('bacfg/config.json', 'w') as outfile:
|
with open('ba_root/config.json', 'w') as outfile:
|
||||||
outfile.write(json.dumps(bacfg))
|
outfile.write(json.dumps(ba_root))
|
||||||
|
|
||||||
# Launch our binary and grab its stdin; we'll use this to feed
|
# Launch our binary and grab its stdin; we'll use this to feed
|
||||||
# it commands.
|
# it commands.
|
||||||
process = subprocess.Popen([binary_path, '-cfgdir', 'bacfg'],
|
process = subprocess.Popen([binary_path, '-cfgdir', 'ba_root'],
|
||||||
stdin=subprocess.PIPE)
|
stdin=subprocess.PIPE)
|
||||||
|
|
||||||
# Set quit to True any time after launching the server to gracefully
|
# 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 -->
|
<!-- 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,
|
<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>
|
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>
|
<hr>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user