Skip to content

Commit

Permalink
Allow mod options to apply to only certain submods
Browse files Browse the repository at this point in the history
  • Loading branch information
drojf committed Jun 26, 2019
1 parent 30e40c1 commit 8a09239
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions JSONValidator/Sources/JSONValidator/JSONValidator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ public struct ModOptionGroup: Codable {
public var name: String
/// The type (currently only one option)
public var type: ModOptionType
/// A list of submods which this ModOptionGroup is applicable to. If it doesn't exist, is applicable to all submods.
public var submods: [String]?
/// Data for if this is a radio button. Mutually exclusive with checkBox
public var radio: [ModOptionEntry]?
/// Data for if this is a checkBox. Mutually exclusive with radio
Expand Down
6 changes: 4 additions & 2 deletions gameScanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,10 @@ def jsonAddModOptionsFromList(jsonModOptionList, isRadio):
data=jsonModOption.get('data', None)))

for jsonModOptionGroup in mod.get('modOptionGroups', []):
jsonAddModOptionsFromList(jsonModOptionGroup.get('radio', []), isRadio=True)
jsonAddModOptionsFromList(jsonModOptionGroup.get('checkBox', []), isRadio=False)
applicableSubMods = jsonModOptionGroup.get('submods')
if applicableSubMods is None or self.subModName in applicableSubMods:
jsonAddModOptionsFromList(jsonModOptionGroup.get('radio', []), isRadio=True)
jsonAddModOptionsFromList(jsonModOptionGroup.get('checkBox', []), isRadio=False)

def __repr__(self):
return "Type: [{}] Game Name: [{}]".format(self.modName, self.subModName)
Expand Down
2 changes: 2 additions & 0 deletions installData.json
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@
},
{
"name" : "Sprite Options", "type": "downloadAndExtract",
"submods" : ["full"],
"radio": [
{"name": "PS3 sprites (default)", "description": "Use sprites from the PS3 game. No additional download required."},
{
Expand Down Expand Up @@ -510,6 +511,7 @@
},
{
"name" : "Sprite Options", "type": "downloadAndExtract",
"submods" : ["novel-mode", "adv-mode"],
"radio": [
{"name": "PS3 sprites (default)", "description": "Use sprites from the PS3 game. No additional download required."},
{
Expand Down

0 comments on commit 8a09239

Please sign in to comment.