mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-27 22:06:05 -04:00
Resources no longer spawn under unbuildable, unremovable terrain features
This commit is contained in:
parent
39e5d0df0f
commit
0262ee816b
@ -50,8 +50,7 @@
|
|||||||
"type": "Water",
|
"type": "Water",
|
||||||
"food": 2,
|
"food": 2,
|
||||||
"gold": 1,
|
"gold": 1,
|
||||||
"RGB": [ 200, 200, 255],
|
"RGB": [ 200, 200, 255]
|
||||||
"canHaveOverlay": false
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Hill",
|
"name": "Hill",
|
||||||
|
@ -379,7 +379,9 @@ class MapGenerator(val ruleset: Ruleset) {
|
|||||||
for (resource in strategicResources) {
|
for (resource in strategicResources) {
|
||||||
// remove the tiles where previous resources have been placed
|
// remove the tiles where previous resources have been placed
|
||||||
val suitableTiles = candidateTiles
|
val suitableTiles = candidateTiles
|
||||||
.filter { it.resource == null && resource.terrainsCanBeFoundOn.contains(it.getBaseTerrain().name)}
|
.filter { it.resource == null
|
||||||
|
&& resource.terrainsCanBeFoundOn.contains(it.getBaseTerrain().name)
|
||||||
|
&& (it.terrainFeature==null || ruleset.tileImprovements.containsKey("Remove "+it.terrainFeature)) }
|
||||||
|
|
||||||
val locations = chooseSpreadOutLocations(resourcesPerType, suitableTiles, distance)
|
val locations = chooseSpreadOutLocations(resourcesPerType, suitableTiles, distance)
|
||||||
|
|
||||||
|
@ -8,6 +8,43 @@ import com.unciv.models.translations.tr
|
|||||||
import com.unciv.ui.utils.colorFromRGB
|
import com.unciv.ui.utils.colorFromRGB
|
||||||
|
|
||||||
class Terrain : NamedStats() {
|
class Terrain : NamedStats() {
|
||||||
|
|
||||||
|
lateinit var type: TerrainType
|
||||||
|
|
||||||
|
var overrideStats = false
|
||||||
|
|
||||||
|
/** If true, other terrain layers can come over this one. For mountains, lakes etc. this is false */
|
||||||
|
var canHaveOverlay = true
|
||||||
|
|
||||||
|
/** If true, nothing can be built here - not even resource improvements */
|
||||||
|
var unbuildable = false
|
||||||
|
|
||||||
|
/** For terrain features */
|
||||||
|
val occursOn: Collection<String>? = null
|
||||||
|
|
||||||
|
/** Used by Natural Wonders: it is the baseTerrain on top of which the Natural Wonder is placed */
|
||||||
|
val turnsInto: String? = null
|
||||||
|
|
||||||
|
/** Uniques (currently used only for Natural Wonders) */
|
||||||
|
val uniques = ArrayList<String>()
|
||||||
|
|
||||||
|
/** Natural Wonder weight: probability to be picked */
|
||||||
|
var weight = 10
|
||||||
|
|
||||||
|
/** RGB color of base terrain */
|
||||||
|
var RGB: List<Int>? = null
|
||||||
|
var movementCost = 1
|
||||||
|
var defenceBonus:Float = 0f
|
||||||
|
var impassable = false
|
||||||
|
var rough = false
|
||||||
|
|
||||||
|
|
||||||
|
fun getColor(): Color { // Can't be a lazy initialize. because w play around with the resulting color with lerp()s and the like
|
||||||
|
if (RGB == null) return Color.GOLD
|
||||||
|
return colorFromRGB(RGB!![0], RGB!![1], RGB!![2])
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
fun getDescription(ruleset: Ruleset): String {
|
fun getDescription(ruleset: Ruleset): String {
|
||||||
val sb = StringBuilder()
|
val sb = StringBuilder()
|
||||||
sb.appendln(this.clone().toString())
|
sb.appendln(this.clone().toString())
|
||||||
@ -37,53 +74,4 @@ class Terrain : NamedStats() {
|
|||||||
|
|
||||||
return sb.toString()
|
return sb.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
lateinit var type: TerrainType
|
|
||||||
|
|
||||||
var overrideStats = false
|
|
||||||
|
|
||||||
/***
|
|
||||||
* If true, other terrain layers can come over this one. For mountains, lakes etc. this is false
|
|
||||||
*/
|
|
||||||
|
|
||||||
var canHaveOverlay = true
|
|
||||||
|
|
||||||
/***
|
|
||||||
* If true, nothing can be built here - not even resource improvements
|
|
||||||
*/
|
|
||||||
var unbuildable = false
|
|
||||||
|
|
||||||
/***
|
|
||||||
* For terrain features
|
|
||||||
*/
|
|
||||||
val occursOn: Collection<String>? = null
|
|
||||||
|
|
||||||
/***
|
|
||||||
* Used by Natural Wonders: it is the baseTerrain on top of which the Natural Wonder is placed
|
|
||||||
*/
|
|
||||||
val turnsInto: String? = null
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Uniques (currently used only for Natural Wonders)
|
|
||||||
*/
|
|
||||||
val uniques = ArrayList<String>()
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Natural Wonder weight: probability to be picked
|
|
||||||
*/
|
|
||||||
var weight = 10
|
|
||||||
|
|
||||||
/**
|
|
||||||
* RGB color of base terrain
|
|
||||||
*/
|
|
||||||
var RGB: List<Int>? = null
|
|
||||||
var movementCost = 1
|
|
||||||
var defenceBonus:Float = 0f
|
|
||||||
var impassable = false
|
|
||||||
var rough = false
|
|
||||||
|
|
||||||
fun getColor(): Color {
|
|
||||||
if (RGB == null) return Color.GOLD
|
|
||||||
return colorFromRGB(RGB!![0], RGB!![1], RGB!![2])
|
|
||||||
}
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user