mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-01-31 11:46:58 +08:00
work on ba_meta
This commit is contained in:
parent
7fe0b3a1dc
commit
7366738622
@ -175,7 +175,7 @@ class DirectoryScan:
|
||||
flines = infile.readlines()
|
||||
meta_lines = {
|
||||
lnum: l[1:].split()
|
||||
for lnum, l in enumerate(flines) if 'ba_meta' in l
|
||||
for lnum, l in enumerate(flines) if '# ba_meta ' in l
|
||||
}
|
||||
toplevel = len(subpath.parts) <= 1
|
||||
required_api = self.get_api_requirement(subpath, meta_lines, toplevel)
|
||||
@ -218,6 +218,7 @@ class DirectoryScan:
|
||||
# meta_lines is just anything containing 'ba_meta'; make sure
|
||||
# the ba_meta is in the right place.
|
||||
if mline[0] != 'ba_meta':
|
||||
print(f'GOT "{mline[0]}"')
|
||||
self.results['warnings'] += (
|
||||
'Warning: ' + str(subpath) +
|
||||
': malformed ba_meta statement on line ' +
|
||||
@ -309,13 +310,14 @@ class DirectoryScan:
|
||||
return None
|
||||
|
||||
|
||||
def getscanresults() -> Dict[str, Any]:
|
||||
def get_scan_results() -> Dict[str, Any]:
|
||||
"""Return meta scan results; blocking if the scan is not yet complete."""
|
||||
import time
|
||||
app = _ba.app
|
||||
if app.metascan is None:
|
||||
print('WARNING: ba.meta.getscanresults() called before scan completed.'
|
||||
' This can cause hitches.')
|
||||
print(
|
||||
'WARNING: ba.meta.get_scan_results() called before scan completed.'
|
||||
' This can cause hitches.')
|
||||
|
||||
# Now wait a bit for the scan to complete.
|
||||
# Eventually error though if it doesn't.
|
||||
@ -324,6 +326,7 @@ def getscanresults() -> Dict[str, Any]:
|
||||
time.sleep(0.05)
|
||||
if time.time() - starttime > 10.0:
|
||||
raise Exception('timeout waiting for meta scan to complete.')
|
||||
print('RETURNING SCAN RESULTS')
|
||||
return app.metascan
|
||||
|
||||
|
||||
@ -331,7 +334,7 @@ def get_game_types() -> List[Type[ba.GameActivity]]:
|
||||
"""Return available game types."""
|
||||
from ba import _general
|
||||
from ba import _gameactivity
|
||||
gameclassnames = getscanresults().get('games', [])
|
||||
gameclassnames = get_scan_results().get('games', [])
|
||||
gameclasses = []
|
||||
for gameclassname in gameclassnames:
|
||||
try:
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<!-- THIS FILE IS AUTO GENERATED; DO NOT EDIT BY HAND -->
|
||||
<!--DOCSHASH=c798f5512eafca1a6a4e19f5fe5ae860-->
|
||||
<h4><em>last updated on 2020-03-20 for Ballistica version 1.5.0 build 20001</em></h4>
|
||||
<!--DOCSHASH=980152c92470347b729403636dcd2a7f-->
|
||||
<h4><em>last updated on 2020-03-22 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