Skip to content

Commit

Permalink
Allow single string/code rules
Browse files Browse the repository at this point in the history
`"code"` behaves like `[["code"]]`
  • Loading branch information
black-sliver committed Jan 2, 2024
1 parent 8a13393 commit 0930a28
Show file tree
Hide file tree
Showing 4 changed files with 226 additions and 72 deletions.
2 changes: 2 additions & 0 deletions doc/PACKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,8 @@ Rule-goups inside `{` `}` are a different set of rules to mark the section as "c

Individual rules can be specified as json array instead of string, which allows to use `,` inside names or arguments. Only available in PopTracker, since 0.19.1.

Rules can be specified as a single string, which is equivalent to `[[string]]`. Only available in PopTracker, since 0.25.6.

**Parent:**
With `"parent"`, the location's parent can be overwritten. Since PopTracker v0.19.2.
This is useful to put a location from `dungeons.json` into a location from `overworld.json`,
Expand Down
108 changes: 78 additions & 30 deletions schema/packs/locations.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,23 @@
"rule3,rule4",
"{checkrule1, checkrule2}"
],
"type": "array",
"anyOf": [
{
"description": "Access rules for the section. Section will be marked reachable (green) if all rules are matched. Rules inside [] are optional (i.e. glitches work around this rule; marked as yellow). If rules in {} are matched, the section will be marked as checkable (blue). Children will always inherit rules from parents. Each entry will be OR-ed together, comma sperated rules will be AND-ed.",
"$ref": "#/$defs/rules_string"
"type": "array",
"anyOf": [
{
"description": "Access rules for the section. Section will be marked reachable (green) if all rules are matched. Rules inside [] are optional (i.e. glitches work around this rule; marked as yellow). If rules in {} are matched, the section will be marked as checkable (blue). Children will always inherit rules from parents. Each entry will be OR-ed together, comma sperated rules will be AND-ed.",
"$ref": "#/$defs/rules_string"
},
{
"description": "Access rules for the section. Section will be marked reachable (green) if all rules are matched. Rules inside [] are optional (i.e. glitches work around this rule; marked as yellow). If rules in {} are matched, the section will be marked as checkable (blue). Children will always inherit rules from parents. 2-Dimensional array of rules, first dimenstion will be OR-ed together, second will be AND-ed.",
"$ref": "#/$defs/rules_array"
}
]
},
{
"description": "Access rules for the section. Section will be marked reachable (green) if all rules are matched. Rules inside [] are optional (i.e. glitches work around this rule; marked as yellow). If rules in {} are matched, the section will be marked as checkable (blue). Children will always inherit rules from parents. 2-Dimensional array of rules, first dimenstion will be OR-ed together, second will be AND-ed.",
"$ref": "#/$defs/rules_array"
"type": "string",
"description": "Single code/access rule for the section. \"code\" behaves the same as [[\"code\"]]. See array of string and array of array of string for complex rules in json."
}
]
},
Expand All @@ -60,15 +68,23 @@
"rule1,rule2",
"rule3,rule4"
],
"type": "array",
"anyOf": [
{
"description": "Visibility rules for the section. Section will only be visible if rules are matched. Children will always inherit rules from parents. Each entry will be OR-ed together, comma sperated rules will be AND-ed.",
"$ref": "#/$defs/rules_string"
"type": "array",
"anyOf": [
{
"description": "Visibility rules for the section. Section will only be visible if rules are matched. Children will always inherit rules from parents. Each entry will be OR-ed together, comma sperated rules will be AND-ed.",
"$ref": "#/$defs/rules_string"
},
{
"description": "Visibility rules for the section. Section will only be visible if rules are matched. Children will always inherit rules from parents. 2-Dimensional array of rules, first dimenstion will be OR-ed together, second will be AND-ed.",
"$ref": "#/$defs/rules_array"
}
]
},
{
"description": "Visibility rules for the section. Section will only be visible if rules are matched. Children will always inherit rules from parents. 2-Dimensional array of rules, first dimenstion will be OR-ed together, second will be AND-ed.",
"$ref": "#/$defs/rules_array"
"type": "string",
"description": "Single code/visibility rule for the section. \"code\" behaves the same as [[\"code\"]]. See array of string and array of array of string for complex rules in json."
}
]
},
Expand Down Expand Up @@ -152,15 +168,23 @@
"rule3,rule4",
"{checkrule1, checkrule2}"
],
"type": "array",
"anyOf": [
{
"description": "Access rules for the location. Location will be marked reachable (green) if all rules are matched. Rules inside [] are optional (i.e. glitches work around this rule; marked as yellow). If rules in {} are matched, the location will be marked as checkable (blue). Children/sections will always inherit rules from parents. Each entry will be OR-ed together, comma sperated rules will be AND-ed.",
"$ref": "#/$defs/rules_string"
"type": "array",
"anyOf": [
{
"description": "Access rules for the location. Location will be marked reachable (green) if all rules are matched. Rules inside [] are optional (i.e. glitches work around this rule; marked as yellow). If rules in {} are matched, the location will be marked as checkable (blue). Children/sections will always inherit rules from parents. Each entry will be OR-ed together, comma sperated rules will be AND-ed.",
"$ref": "#/$defs/rules_string"
},
{
"description": "Access rules for the location. Location will be marked reachable (green) if all rules are matched. Rules inside [] are optional (i.e. glitches work around this rule; marked as yellow). If rules in {} are matched, the location will be marked as checkable (blue). Children/sections will always inherit rules from parents. 2-Dimensional array of rules, first dimenstion will be OR-ed together, second will be AND-ed.",
"$ref": "#/$defs/rules_array"
}
]
},
{
"description": "Access rules for the location. Location will be marked reachable (green) if all rules are matched. Rules inside [] are optional (i.e. glitches work around this rule; marked as yellow). If rules in {} are matched, the location will be marked as checkable (blue). Children/sections will always inherit rules from parents. 2-Dimensional array of rules, first dimenstion will be OR-ed together, second will be AND-ed.",
"$ref": "#/$defs/rules_array"
"type": "string",
"description": "Single code/access rule for the location. \"code\" behaves the same as [[\"code\"]]. See array of string and array of array of string for complex rules in json."
}
]
},
Expand All @@ -169,15 +193,23 @@
"rule1,rule2",
"rule3,rule4"
],
"type": "array",
"anyOf": [
{
"description": "Visibility rules for the location. Location will only be visible if rules are matched. Children/sections will always inherit rules from parents. Each entry will be OR-ed together, comma sperated rules will be AND-ed.",
"$ref": "#/$defs/rules_string"
"type": "array",
"anyOf": [
{
"description": "Visibility rules for the location. Location will only be visible if rules are matched. Children/sections will always inherit rules from parents. Each entry will be OR-ed together, comma sperated rules will be AND-ed.",
"$ref": "#/$defs/rules_string"
},
{
"description": "Visibility rules for the location. Location will only be visible if rules are matched. Children/sections will always inherit rules from parents. 2-Dimensional array of rules, first dimenstion will be OR-ed together, second will be AND-ed.",
"$ref": "#/$defs/rules_array"
}
]
},
{
"description": "Visibility rules for the location. Location will only be visible if rules are matched. Children/sections will always inherit rules from parents. 2-Dimensional array of rules, first dimenstion will be OR-ed together, second will be AND-ed.",
"$ref": "#/$defs/rules_array"
"type": "string",
"description": "Single code/visibility rule for the location. \"code\" behaves the same as [[\"code\"]]. See array of string and array of array of string for complex rules in json."
}
]
},
Expand Down Expand Up @@ -255,15 +287,23 @@
"rule1,rule2",
"rule3,rule4"
],
"type": "array",
"anyOf": [
{
"description": "Additional visibility rules for individual map location.",
"$ref": "#/$defs/rules_string"
"type": "array",
"anyOf": [
{
"description": "Additional visibility rules for individual map location.",
"$ref": "#/$defs/rules_string"
},
{
"description": "Additional visibility rules for individual map location.",
"$ref": "#/$defs/rules_array"
}
]
},
{
"description": "Additional visibility rules for individual map location.",
"$ref": "#/$defs/rules_array"
"type": "string",
"description": "Single additional visibility code/rule for individual map location."
}
]
},
Expand All @@ -272,15 +312,23 @@
"rule1,rule2",
"rule3,rule4"
],
"type": "array",
"anyOf": [
{
"description": "Additional rules that force-hide the map location if true.",
"$ref": "#/$defs/rules_string"
"type": "array",
"anyOf": [
{
"description": "Additional rules that force-hide the map location if true.",
"$ref": "#/$defs/rules_string"
},
{
"description": "Additional rules that force-hide the map location if true.",
"$ref": "#/$defs/rules_array"
}
]
},
{
"description": "Additional rules that force-hide the map location if true.",
"$ref": "#/$defs/rules_array"
"type": "string",
"description": "Single additional code/rule that force-hides the map location if true."
}
]
}
Expand Down
Loading

0 comments on commit 0930a28

Please sign in to comment.