Various bug fixes and cleanup

This commit is contained in:
Eric Froemling 2020-05-05 16:32:41 -07:00
parent e59fe3aa0a
commit 5a77f0bc52
9 changed files with 50 additions and 33 deletions

View File

@ -4132,16 +4132,16 @@
"assets/build/windows/x64/python.exe": "https://files.ballistica.net/cache/ba1/25/a7/dc87c1be41605eb6fefd0145144c", "assets/build/windows/x64/python.exe": "https://files.ballistica.net/cache/ba1/25/a7/dc87c1be41605eb6fefd0145144c",
"assets/build/windows/x64/python37.dll": "https://files.ballistica.net/cache/ba1/b9/e4/d912f56e42e9991bcbb4c804cfcb", "assets/build/windows/x64/python37.dll": "https://files.ballistica.net/cache/ba1/b9/e4/d912f56e42e9991bcbb4c804cfcb",
"assets/build/windows/x64/pythonw.exe": "https://files.ballistica.net/cache/ba1/6c/bb/b6f52c306aa4e88061510e96cefe", "assets/build/windows/x64/pythonw.exe": "https://files.ballistica.net/cache/ba1/6c/bb/b6f52c306aa4e88061510e96cefe",
"build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/a2/5b/8598da1884bbe060f495d0273d7d", "build/prefab/linux-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b8/70/d087e1b445f7d19c02e9ff22d6ba",
"build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/83/95/5e30fd47e6befa8f9a370a52be21", "build/prefab/linux-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/9c/5b/258ebaafc23ffafdee40992f4422",
"build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/60/3a/1edfbfc7adcbda3f6734f9282756", "build/prefab/linux/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/d6/e4/0c24f8930d7952fdf667b3046dac",
"build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/34/a1/f7d0bf6b709a757418825a1cc24f", "build/prefab/linux/release/ballisticacore": "https://files.ballistica.net/cache/ba1/7a/a4/648b4505563f6f870c80df784dd2",
"build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/59/e9/8a29cf17f4434f783fab73afc349", "build/prefab/mac-server/debug/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/b2/60/a67366b88128c1743f0e4bdc7844",
"build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/71/9d/02c9e2ba7c91941991552228c66c", "build/prefab/mac-server/release/dist/ballisticacore_headless": "https://files.ballistica.net/cache/ba1/db/89/4ea43a8120df7d3d60aab0902a7a",
"build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/9b/35/42e8f879ac5b07ba2d8caee897dc", "build/prefab/mac/debug/ballisticacore": "https://files.ballistica.net/cache/ba1/60/1a/1463ba7cddddd3796c27a8250875",
"build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/3f/3e/20eb6ac1043ac0417c2b7728f7bd", "build/prefab/mac/release/ballisticacore": "https://files.ballistica.net/cache/ba1/0c/ae/b4500e7fc1dd9f2e515dfc6d7b2f",
"build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/b9/75/6b1523ec9b0d510870b4695a6613", "build/prefab/windows-server/debug/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/26/36/dd35f9f8ba7708ecaa3176e38dd8",
"build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/7d/04/b882bbfd0197248bca49016356c1", "build/prefab/windows-server/release/dist/ballisticacore_headless.exe": "https://files.ballistica.net/cache/ba1/37/cc/4fb23e54b6058cb3a9fbf8862387",
"build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/13/50/1fb612a251431229703317bd81e5", "build/prefab/windows/debug/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/06/5a/40efd122998130779a70bcc7aa68",
"build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/ec/3c/ce84db1040251fb5a11b0c7dfd7b" "build/prefab/windows/release/BallisticaCore.exe": "https://files.ballistica.net/cache/ba1/3f/15/f046cab19964f6e60159ee7eaba2"
} }

View File

@ -307,6 +307,7 @@
<w>clrend</w> <w>clrend</w>
<w>clrgrn</w> <w>clrgrn</w>
<w>clrhdr</w> <w>clrhdr</w>
<w>clrnames</w>
<w>clrred</w> <w>clrred</w>
<w>cmathmodule</w> <w>cmathmodule</w>
<w>cmds</w> <w>cmds</w>
@ -1614,6 +1615,7 @@
<w>sharedobjs</w> <w>sharedobjs</w>
<w>shiftdelay</w> <w>shiftdelay</w>
<w>shiftposition</w> <w>shiftposition</w>
<w>shortname</w>
<w>shouldn</w> <w>shouldn</w>
<w>showpoints</w> <w>showpoints</w>
<w>showstats</w> <w>showstats</w>

View File

@ -215,14 +215,14 @@ class ServerController:
else: else:
addr = data['address'] addr = data['address']
port = data['port'] port = data['port']
show_addr = os.environ.get('BA_VERBOSE_ACCESS_CHECK', '0') == '1' show_addr = os.environ.get('BA_ACCESS_CHECK_VERBOSE', '0') == '1'
if show_addr: if show_addr:
addrstr = f' {addr}' addrstr = f' {addr}'
poststr = '' poststr = ''
else: else:
addrstr = '' addrstr = ''
poststr = ( poststr = (
'\nSet environment variable BA_VERBOSE_ACCESS_CHECK=1' '\nSet environment variable BA_ACCESS_CHECK_VERBOSE=1'
' for more info.') ' for more info.')
if data['accessible']: if data['accessible']:
print(f'{Clr.SBLU}Master server access check of{addrstr}' print(f'{Clr.SBLU}Master server access check of{addrstr}'
@ -314,7 +314,7 @@ class ServerController:
if self._first_run: if self._first_run:
curtimestr = time.strftime('%c') curtimestr = time.strftime('%c')
print(f'{Clr.SBLU}BallisticaCore {app.version}' print(f'{Clr.BLD}{Clr.BLU}BallisticaCore {app.version}'
f' ({app.build_number})' f' ({app.build_number})'
f' entering server-mode {curtimestr}{Clr.RST}') f' entering server-mode {curtimestr}{Clr.RST}')

View File

@ -238,7 +238,7 @@ class Target(ba.Actor):
}) })
loc2 = ba.newnode('locator', loc2 = ba.newnode('locator',
attrs={ attrs={
'shape': 'circle_outline', 'shape': 'circleOutline',
'position': position, 'position': position,
'color': (0, 1, 0), 'color': (0, 1, 0),
'opacity': 0.3, 'opacity': 0.3,
@ -247,7 +247,7 @@ class Target(ba.Actor):
}) })
loc3 = ba.newnode('locator', loc3 = ba.newnode('locator',
attrs={ attrs={
'shape': 'circle_outline', 'shape': 'circleOutline',
'position': position, 'position': position,
'color': (0, 1, 0), 'color': (0, 1, 0),
'opacity': 0.1, 'opacity': 0.1,

View File

@ -669,10 +669,10 @@ class EditProfileWindow(ba.Window):
'name': new_name, 'name': new_name,
'profile': { 'profile': {
'character': self._spazzes[self._icon_index], 'character': self._spazzes[self._icon_index],
'color': self._color, 'color': list(self._color),
'global': self._global, 'global': self._global,
'icon': self._icon, 'icon': self._icon,
'highlight': self._highlight 'highlight': list(self._highlight)
} }
}) })

View File

@ -293,8 +293,8 @@ def instantiate_store_item_display(item_name: str,
total_worth_price: Optional[str] total_worth_price: Optional[str]
if total_worth_item is not None: if total_worth_item is not None:
price = _ba.get_price(total_worth_item) price = _ba.get_price(total_worth_item)
assert price is not None total_worth_price = (get_clean_price(price)
total_worth_price = get_clean_price(price) if price is not None else '??')
else: else:
total_worth_price = None total_worth_price = None
@ -339,7 +339,8 @@ def instantiate_store_item_display(item_name: str,
draw_controller=btn, draw_controller=btn,
color=backing_color, color=backing_color,
texture=b_square_texture)) texture=b_square_texture))
# hack - gotta draw two transparent versions to avoid z issues
# Hack - gotta draw two transparent versions to avoid z issues.
for mod in model_opaque, model_transparent: for mod in model_opaque, model_transparent:
extra_images.append( extra_images.append(
ba.imagewidget(parent=parent_widget, ba.imagewidget(parent=parent_widget,

View File

@ -105,9 +105,11 @@ class ServerManagerApp:
# Print basic usage info in interactive mode. # Print basic usage info in interactive mode.
if sys.stdin.isatty(): if sys.stdin.isatty():
print(f'{Clr.SMAG}BallisticaCore server manager {VERSION_STR}' print(f'{Clr.CYN}{Clr.BLD}BallisticaCore server'
f' starting up...\n' f' manager {VERSION_STR}'
f'Use the "mgr" object to make live server adjustments.\n' f' starting up...{Clr.RST}\n'
f'{Clr.CYN}Use the "mgr" object to make'
f' live server adjustments.\n'
f'Type "help(mgr)" for more information.{Clr.RST}') f'Type "help(mgr)" for more information.{Clr.RST}')
# Python will handle SIGINT for us (as KeyboardInterrupt) but we # Python will handle SIGINT for us (as KeyboardInterrupt) but we
@ -267,7 +269,7 @@ class ServerManagerApp:
# slight behavior tweaks. Hmm; should this be an argument instead? # slight behavior tweaks. Hmm; should this be an argument instead?
os.environ['BA_SERVER_WRAPPER_MANAGED'] = '1' os.environ['BA_SERVER_WRAPPER_MANAGED'] = '1'
print(f'{Clr.SMAG}Launching server child-process...{Clr.RST}') print(f'{Clr.CYN}Launching server child-process...{Clr.RST}')
binary_name = ('ballisticacore_headless.exe' binary_name = ('ballisticacore_headless.exe'
if os.name == 'nt' else './ballisticacore_headless') if os.name == 'nt' else './ballisticacore_headless')
self._process = subprocess.Popen([binary_name, '-cfgdir', 'ba_root'], self._process = subprocess.Popen([binary_name, '-cfgdir', 'ba_root'],
@ -355,7 +357,7 @@ class ServerManagerApp:
if (self._restart_minutes is not None and sincelaunch > if (self._restart_minutes is not None and sincelaunch >
(self._restart_minutes * 60.0) (self._restart_minutes * 60.0)
and not self._process_sent_auto_restart): and not self._process_sent_auto_restart):
print(f'{Clr.SMAG}restart_minutes ({self._restart_minutes})' print(f'{Clr.CYN}restart_minutes ({self._restart_minutes})'
f' elapsed; requesting child-process' f' elapsed; requesting child-process'
f' soft restart...{Clr.RST}') f' soft restart...{Clr.RST}')
self.restart() self.restart()
@ -364,7 +366,7 @@ class ServerManagerApp:
# Watch for the process exiting. # Watch for the process exiting.
code: Optional[int] = self._process.poll() code: Optional[int] = self._process.poll()
if code is not None: if code is not None:
print(f'{Clr.SMAG}Server process exited' print(f'{Clr.CYN}Server process exited'
f' with code {code}.{Clr.RST}') f' with code {code}.{Clr.RST}')
time.sleep(1.0) # Keep things from moving too fast. time.sleep(1.0) # Keep things from moving too fast.
self._reset_process_vars() self._reset_process_vars()
@ -383,7 +385,7 @@ class ServerManagerApp:
if self._process is None: if self._process is None:
return return
print(f'{Clr.SMAG}Stopping server process...{Clr.RST}') print(f'{Clr.CYN}Stopping server process...{Clr.RST}')
# First, ask it nicely to die and give it a moment. # First, ask it nicely to die and give it a moment.
# If that doesn't work, bring down the hammer. # If that doesn't work, bring down the hammer.
@ -393,7 +395,7 @@ class ServerManagerApp:
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired:
self._process.kill() self._process.kill()
self._reset_process_vars() self._reset_process_vars()
print(f'{Clr.SMAG}Server process stopped.{Clr.RST}') print(f'{Clr.CYN}Server process stopped.{Clr.RST}')
def main() -> None: def main() -> None:

View File

@ -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-05-03 for Ballistica version 1.5.0 build 20001</em></h4> <h4><em>last updated on 2020-05-05 for Ballistica version 1.5.0 build 20002</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>

View File

@ -526,11 +526,23 @@ def filter_server_config() -> None:
def printcolors() -> None: def printcolors() -> None:
"""Print all colors available in efro.terminals.TerminalColor.""" """Print all colors available in efro.terminals.TerminalColor."""
from efro.terminal import TerminalColor from efro.error import CleanError
from efro.terminal import TerminalColor, Clr
if Clr.RED == '':
raise CleanError('Efro color terminal output is disabled.')
clrnames = {getattr(Clr, s): s for s in dir(Clr) if s.isupper()}
# Print everything in Clr (since that's what users should be using
# but do it in the order of TerminalColor (since Clr is just a class
# so is unordered)
for value in TerminalColor: for value in TerminalColor:
if value is TerminalColor.RESET: if value is TerminalColor.RESET:
continue continue
print(f'{value.name}: {value.value}' shortname = f'Clr.{clrnames[value.value]}'
longname = f'({value.name})'
print(f'{shortname:<12} {longname:<20} {value.value}'
f'The quick brown fox jumps over the lazy dog.' f'The quick brown fox jumps over the lazy dog.'
f'{TerminalColor.RESET.value}') f'{TerminalColor.RESET.value}')