mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-22 02:42:16 -04:00
Add ability to remove policies with ModOptions (#13548)
* Add ability to remove policies with ModOptions * Remove policies from the branches too * Clean docs
This commit is contained in:
parent
834239774a
commit
11b53f6cdc
@ -14,6 +14,7 @@ class ModOptions : IHasUniques {
|
||||
var unitsToRemove = HashSet<String>()
|
||||
var nationsToRemove = HashSet<String>()
|
||||
var policyBranchesToRemove = HashSet<String>()
|
||||
var policiesToRemove = HashSet<String>()
|
||||
val constants = ModConstants()
|
||||
var unitset: String? = null
|
||||
var tileset: String? = null
|
||||
|
@ -211,6 +211,22 @@ class Ruleset {
|
||||
}
|
||||
policyBranches.putAll(ruleset.policyBranches)
|
||||
policies.putAll(ruleset.policies)
|
||||
|
||||
// Remove the policies
|
||||
ruleset.modOptions.policiesToRemove
|
||||
.flatMap { policyToRemove ->
|
||||
policies.filter { it.value.matchesFilter(policyToRemove) }.keys
|
||||
}.toSet().forEach {
|
||||
policies.remove(it)
|
||||
}
|
||||
|
||||
// Remove the policies if they exist in the policy branches too
|
||||
for (policyToRemove in ruleset.modOptions.policiesToRemove) {
|
||||
for (branch in policyBranches.values) {
|
||||
branch.policies.removeAll { it.matchesFilter(policyToRemove) }
|
||||
}
|
||||
}
|
||||
|
||||
quests.putAll(ruleset.quests)
|
||||
religions.addAll(ruleset.religions)
|
||||
ruinRewards.putAll(ruleset.ruinRewards)
|
||||
|
@ -174,6 +174,7 @@ The file can have the following attributes, not including the values Unciv sets
|
||||
| unitsToRemove | List | empty | List of [Units](4-Unit-related-JSON-files.md#unitsjson) or [unitFilter](../../Unique-parameters#baseunitfilter) to remove (isBaseRuleset=false only) |
|
||||
| nationsToRemove | List | empty | List of [Nations](2-Civilization-related-JSON-files.md#nationsjson) or [nationFilter](../../Unique-parameters#nationfilter) to remove (isBaseRuleset=false only) |
|
||||
| policyBranchesToRemove | List | empty | List of [Policy Branches](2-Civilization-related-JSON-files.md#policyjson) to remove (isBaseRuleset=false only) |
|
||||
| policiesToRemove | List | empty | List of [Policies](2-Civilization-related-JSON-files.md#policiesjson) to remove (isBaseRuleset=false only) |
|
||||
| constants | Object | empty | See [ModConstants](#modconstants) |
|
||||
| tileset | String | empty | Only applicable for base rulesets |
|
||||
| unitset | String | empty | Only applicable for base rulesets |
|
||||
|
Loading…
x
Reference in New Issue
Block a user