mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
season variable moved to worldtime
This commit is contained in:
@@ -155,6 +155,17 @@ class WorldTime(initTime: Long = 0L) {
|
||||
return -23.44 * cos(TWO_PI * x / YEAR_DAYS)
|
||||
}
|
||||
|
||||
/**
|
||||
* Ecological season, defined as Prevernal, Vernal, Aestival, Serotinal, Autumnal and Hibernal.
|
||||
*
|
||||
* @return yearly progress of the six seasons, 0f (inclusve) to 6f (exclusive)
|
||||
*/
|
||||
val ecologicalSeason: Float
|
||||
get() {
|
||||
val drawTIME_T = TIME_T - (WorldTime.DAY_LENGTH * 10) // offset by -10 days
|
||||
return (drawTIME_T fmod (WorldTime.DAY_LENGTH * WorldTime.YEAR_DAYS).toLong()).toFloat() / (WorldTime.DAY_LENGTH * WorldTime.YEAR_DAYS / 6)
|
||||
}
|
||||
|
||||
@Transient private var realSecAcc: Double = 0.0
|
||||
@Transient private val REAL_SEC_TO_GAME_SECS = 1.0 / GAME_MIN_TO_REAL_SEC // how slow is real-life clock (second-wise) relative to the ingame one
|
||||
|
||||
|
||||
@@ -181,9 +181,6 @@ internal object BlocksDrawer {
|
||||
return TILES_BLEND_MUL.add(blockID)
|
||||
}
|
||||
|
||||
private var drawTIME_T = 0L
|
||||
private val SECONDS_IN_MONTH = WorldTime.MONTH_LENGTH * WorldTime.DAY_LENGTH.toLong()
|
||||
|
||||
///////////////////////////////////////////
|
||||
// NO draw lightmap using colour filter, actors must also be hidden behind the darkness
|
||||
///////////////////////////////////////////
|
||||
@@ -196,8 +193,7 @@ internal object BlocksDrawer {
|
||||
internal fun renderData() {
|
||||
|
||||
try {
|
||||
drawTIME_T = world.worldTime.TIME_T - (WorldTime.DAY_LENGTH * 10) // offset by -10 days
|
||||
val seasonalMonth = (drawTIME_T fmod (WorldTime.DAY_LENGTH * WorldTime.YEAR_DAYS).toLong()).toFloat() / (WorldTime.DAY_LENGTH * WorldTime.YEAR_DAYS / weatherTerrains.size)
|
||||
val seasonalMonth = world.worldTime.ecologicalSeason
|
||||
|
||||
tilesTerrain = weatherTerrains[seasonalMonth.floorToInt()]
|
||||
tilesTerrainNext = weatherTerrains[(seasonalMonth + 1).floorToInt() fmod weatherTerrains.size]
|
||||
|
||||
Reference in New Issue
Block a user