Starting techs no longer hardcoded - this means that mods can have their own tech trees starting wherever

This commit is contained in:
Yair Morgenstern 2020-04-17 17:52:45 +03:00
parent c764324e81
commit a3843450bf
3 changed files with 5 additions and 4 deletions

View File

@ -8,9 +8,9 @@
{ {
"name": "Agriculture", "name": "Agriculture",
"row": 5, "row": 5,
"quote": "'Where tillage begins, other arts follow. The farmers therefore are the founders of human civilization.' - Daniel Webster" "quote": "'Where tillage begins, other arts follow. The farmers therefore are the founders of human civilization.' - Daniel Webster",
"uniques": ["Starting tech"]
} }
] ]
}, },
{ {

View File

@ -42,7 +42,7 @@ object GameStarter {
civInfo.tech.addTechnology(tech) civInfo.tech.addTechnology(tech)
for (tech in ruleset.technologies.values for (tech in ruleset.technologies.values
.filter { it.era() < newGameParameters.startingEra }) .filter { ruleset.getEraNumber(it.era()) < ruleset.getEraNumber(newGameParameters.startingEra) })
if (!civInfo.tech.isResearched(tech.name)) if (!civInfo.tech.isResearched(tech.name))
civInfo.tech.addTechnology(tech.name) civInfo.tech.addTechnology(tech.name)
@ -70,6 +70,8 @@ object GameStarter {
else availableCivNames.pop() else availableCivNames.pop()
val playerCiv = CivilizationInfo(nationName) val playerCiv = CivilizationInfo(nationName)
for(tech in ruleset.technologies.values.filter { it.uniques.contains("Starting tech") })
playerCiv.tech.techsResearched.add(tech.name) // can't be .addTechnology because the civInfo isn't assigned yet
playerCiv.playerType = player.playerType playerCiv.playerType = player.playerType
playerCiv.playerId = player.playerId playerCiv.playerId = player.playerId
gameInfo.civilizations.add(playerCiv) gameInfo.civilizations.add(playerCiv)

View File

@ -83,7 +83,6 @@ class CivilizationInfo {
constructor(civName: String) { constructor(civName: String) {
this.civName = civName this.civName = civName
tech.techsResearched.add("Agriculture") // can't be .addTechnology because the civInfo isn't assigned yet
} }
fun clone(): CivilizationInfo { fun clone(): CivilizationInfo {