Resolved #3035 - added nationsToRemove in modOptions
This commit is contained in:
parent
2c66b53b27
commit
d2e914473a
2 changed files with 30 additions and 21 deletions
|
@ -29,6 +29,7 @@ class ModOptions {
|
|||
var techsToRemove = HashSet<String>()
|
||||
var buildingsToRemove = HashSet<String>()
|
||||
var unitsToRemove = HashSet<String>()
|
||||
var nationsToRemove = HashSet<String>()
|
||||
var uniques = HashSet<String>()
|
||||
}
|
||||
|
||||
|
@ -65,18 +66,19 @@ class Ruleset {
|
|||
|
||||
fun add(ruleset: Ruleset) {
|
||||
buildings.putAll(ruleset.buildings)
|
||||
for(buildingToRemove in ruleset.modOptions.buildingsToRemove) buildings.remove(buildingToRemove)
|
||||
for (buildingToRemove in ruleset.modOptions.buildingsToRemove) buildings.remove(buildingToRemove)
|
||||
difficulties.putAll(ruleset.difficulties)
|
||||
nations.putAll(ruleset.nations)
|
||||
policyBranches.putAll(ruleset.policyBranches)
|
||||
technologies.putAll(ruleset.technologies)
|
||||
for(techToRemove in ruleset.modOptions.techsToRemove) technologies.remove(techToRemove)
|
||||
for (techToRemove in ruleset.modOptions.techsToRemove) technologies.remove(techToRemove)
|
||||
terrains.putAll(ruleset.terrains)
|
||||
tileImprovements.putAll(ruleset.tileImprovements)
|
||||
tileResources.putAll(ruleset.tileResources)
|
||||
unitPromotions.putAll(ruleset.unitPromotions)
|
||||
units.putAll(ruleset.units)
|
||||
for(unitToRemove in ruleset.modOptions.unitsToRemove) units.remove(unitToRemove)
|
||||
for (unitToRemove in ruleset.modOptions.unitsToRemove) units.remove(unitToRemove)
|
||||
for (nationToRemove in ruleset.modOptions.unitsToRemove) nations.remove(nationToRemove)
|
||||
mods += ruleset.mods
|
||||
}
|
||||
|
||||
|
@ -96,19 +98,19 @@ class Ruleset {
|
|||
}
|
||||
|
||||
|
||||
fun load(folderHandle :FileHandle ) {
|
||||
fun load(folderHandle: FileHandle) {
|
||||
val gameBasicsStartTime = System.currentTimeMillis()
|
||||
|
||||
val modOptionsFile = folderHandle.child("ModOptions.json")
|
||||
if(modOptionsFile.exists()){
|
||||
if (modOptionsFile.exists()) {
|
||||
try {
|
||||
modOptions = jsonParser.getFromJson(ModOptions::class.java, modOptionsFile)
|
||||
} catch (ex: Exception) {
|
||||
}
|
||||
catch (ex:Exception){}
|
||||
}
|
||||
|
||||
val techFile =folderHandle.child("Techs.json")
|
||||
if(techFile.exists()) {
|
||||
val techFile = folderHandle.child("Techs.json")
|
||||
if (techFile.exists()) {
|
||||
val techColumns = jsonParser.getFromJson(Array<TechColumn>::class.java, techFile)
|
||||
for (techColumn in techColumns) {
|
||||
for (tech in techColumn.techs) {
|
||||
|
@ -120,25 +122,25 @@ class Ruleset {
|
|||
}
|
||||
|
||||
val buildingsFile = folderHandle.child("Buildings.json")
|
||||
if(buildingsFile.exists()) buildings += createHashmap(jsonParser.getFromJson(Array<Building>::class.java, buildingsFile))
|
||||
if (buildingsFile.exists()) buildings += createHashmap(jsonParser.getFromJson(Array<Building>::class.java, buildingsFile))
|
||||
|
||||
val terrainsFile = folderHandle.child("Terrains.json")
|
||||
if(terrainsFile.exists()) terrains += createHashmap(jsonParser.getFromJson(Array<Terrain>::class.java, terrainsFile))
|
||||
if (terrainsFile.exists()) terrains += createHashmap(jsonParser.getFromJson(Array<Terrain>::class.java, terrainsFile))
|
||||
|
||||
val resourcesFile = folderHandle.child("TileResources.json")
|
||||
if(resourcesFile.exists()) tileResources += createHashmap(jsonParser.getFromJson(Array<TileResource>::class.java, resourcesFile))
|
||||
if (resourcesFile.exists()) tileResources += createHashmap(jsonParser.getFromJson(Array<TileResource>::class.java, resourcesFile))
|
||||
|
||||
val improvementsFile = folderHandle.child("TileImprovements.json")
|
||||
if(improvementsFile.exists()) tileImprovements += createHashmap(jsonParser.getFromJson(Array<TileImprovement>::class.java, improvementsFile))
|
||||
if (improvementsFile.exists()) tileImprovements += createHashmap(jsonParser.getFromJson(Array<TileImprovement>::class.java, improvementsFile))
|
||||
|
||||
val unitsFile = folderHandle.child("Units.json")
|
||||
if(unitsFile.exists()) units += createHashmap(jsonParser.getFromJson(Array<BaseUnit>::class.java, unitsFile))
|
||||
if (unitsFile.exists()) units += createHashmap(jsonParser.getFromJson(Array<BaseUnit>::class.java, unitsFile))
|
||||
|
||||
val promotionsFile = folderHandle.child("UnitPromotions.json")
|
||||
if(promotionsFile.exists()) unitPromotions += createHashmap(jsonParser.getFromJson(Array<Promotion>::class.java, promotionsFile))
|
||||
if (promotionsFile.exists()) unitPromotions += createHashmap(jsonParser.getFromJson(Array<Promotion>::class.java, promotionsFile))
|
||||
|
||||
val policiesFile = folderHandle.child("Policies.json")
|
||||
if(policiesFile.exists()) {
|
||||
if (policiesFile.exists()) {
|
||||
policyBranches += createHashmap(jsonParser.getFromJson(Array<PolicyBranch>::class.java, policiesFile))
|
||||
for (branch in policyBranches.values) {
|
||||
branch.requires = ArrayList()
|
||||
|
@ -152,13 +154,13 @@ class Ruleset {
|
|||
}
|
||||
|
||||
val nationsFile = folderHandle.child("Nations.json")
|
||||
if(nationsFile.exists()) {
|
||||
if (nationsFile.exists()) {
|
||||
nations += createHashmap(jsonParser.getFromJson(Array<Nation>::class.java, nationsFile))
|
||||
for (nation in nations.values) nation.setTransients()
|
||||
}
|
||||
|
||||
val difficultiesFile = folderHandle.child("Difficulties.json")
|
||||
if(difficultiesFile.exists()) difficulties += createHashmap(jsonParser.getFromJson(Array<Difficulty>::class.java, difficultiesFile))
|
||||
if (difficultiesFile.exists()) difficulties += createHashmap(jsonParser.getFromJson(Array<Difficulty>::class.java, difficultiesFile))
|
||||
|
||||
val gameBasicsLoadTime = System.currentTimeMillis() - gameBasicsStartTime
|
||||
println("Loading game basics - " + gameBasicsLoadTime + "ms")
|
||||
|
@ -169,7 +171,7 @@ class Ruleset {
|
|||
* Alternatively, if you edit a tech column's building costs, you want it to affect all buildings in that column.
|
||||
* This deals with that
|
||||
* */
|
||||
fun updateBuildingCosts(){
|
||||
fun updateBuildingCosts() {
|
||||
for (building in buildings.values) {
|
||||
if (building.cost == 0) {
|
||||
val column = technologies[building.requiredTech]?.column
|
||||
|
@ -183,15 +185,16 @@ class Ruleset {
|
|||
return technologies.values.map { it.column!!.era }.distinct()
|
||||
}
|
||||
|
||||
fun getEraNumber(era:String) = getEras().indexOf(era)
|
||||
fun getEraNumber(era: String) = getEras().indexOf(era)
|
||||
fun getSummary(): String {
|
||||
val stringList = ArrayList<String>()
|
||||
if (modOptions.isBaseRuleset) stringList += "Base Ruleset\n"
|
||||
if (technologies.isNotEmpty()) stringList.add(technologies.size.toString() + " Techs")
|
||||
if (nations.isNotEmpty()) stringList.add(nations.size.toString() + " Nations")
|
||||
if (units.isNotEmpty()) stringList.add(units.size.toString() + " Units")
|
||||
if (buildings.isNotEmpty()) stringList.add(buildings.size.toString() + " Buildings")
|
||||
if (tileResources.isNotEmpty()) stringList.add(tileResources.size.toString() + " Resources")
|
||||
if (tileImprovements.isNotEmpty()) stringList.add(tileResources.size.toString() + " Improvements")
|
||||
if (tileImprovements.isNotEmpty()) stringList.add(tileImprovements.size.toString() + " Improvements")
|
||||
stringList += ""
|
||||
return stringList.joinToString()
|
||||
}
|
||||
|
|
|
@ -43,7 +43,13 @@ class ModManagementScreen: PickerScreen() {
|
|||
removeRightSideClickListeners()
|
||||
rightSideButton.enable()
|
||||
rightSideButton.setText("Download [${repo.name}]".tr())
|
||||
rightSideButton.onClick { downloadMod(repo.svn_url) }
|
||||
rightSideButton.onClick {
|
||||
rightSideButton.setText("Downloading...")
|
||||
rightSideButton.disable()
|
||||
downloadMod(repo.svn_url){
|
||||
rightSideButton.setText("Done!".tr())
|
||||
}
|
||||
}
|
||||
}
|
||||
downloadTable.add(downloadButton).row()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue