Skip to content

Commit

Permalink
Merge pull request #27 from VocalFan/main
Browse files Browse the repository at this point in the history
Fix some Week stuff
  • Loading branch information
gusborg88 authored May 23, 2024
2 parents cfc89f8 + 0029d83 commit 41fea97
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 3 additions & 1 deletion psychtobase/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ def convert(psych_mod_folder, result_folder, options):
logging.info(f'Loading {week} into the converter...')

weekJSON = json.loads(open(week, 'r').read())
open(f'{result_folder}/{modFoldername}{baseLevels}{os.path.basename(week)}', 'w').write(json.dumps(WeekTools.convert(weekJSON, modName), indent=4))
week_filename = os.path.basename(week)
converted_week = WeekTools.convert(weekJSON, modName, week_filename)
open(f'{result_folder}/{modFoldername}{baseLevels}{week_filename}', 'w').write(json.dumps(converted_week, indent=4))

if weekCOptions['props']:
logging.info('Copying prop assets...')
Expand Down
12 changes: 8 additions & 4 deletions psychtobase/src/tools/WeekTools.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import logging
import psychtobase.src.Constants as Constants

def convert(weekJSON, modfolder):
def convert(weekJSON, modfolder, week_filename):
level = deepcopy(Constants.LEVEL)

level['name'] = weekJSON['storyName']
Expand Down Expand Up @@ -45,11 +45,15 @@ def convert(weekJSON, modfolder):

level['props'].append(propTemplate)

level['background'] = '#FFFFFF' # Change!!
if 'freeplayColor' in weekJSON:
r, g, b = weekJSON['freeplayColor']
level['background'] = f'#{r:02X}{g:02X}{b:02X}'
else:
level['background'] = '#FFFFFF'

level['titleAsset'] = Constants.FILE_LOCS.get('WEEKIMAGE_WEEKJSON')[1] + weekJSON['weekName']
level['titleAsset'] = Constants.FILE_LOCS.get('WEEKIMAGE_WEEKJSON')[1] + week_filename

return level

def defaultProp(propName):
return Constants.LEVEL_PROP_DEFAULTS.get(propName, None)
return Constants.LEVEL_PROP_DEFAULTS.get(propName, None)

0 comments on commit 41fea97

Please sign in to comment.