mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-18 06:24:06 +09:00
font update; ui remocon fix; save doc elaboration
UI RemoCon fix: RemoCon will no longer widen to the screen width when being used
This commit is contained in:
29
src/net/torvald/terrarum/modulebasegame/RNGConsumer.kt
Normal file
29
src/net/torvald/terrarum/modulebasegame/RNGConsumer.kt
Normal file
@@ -0,0 +1,29 @@
|
||||
package net.torvald.terrarum.modulebasegame
|
||||
|
||||
import java.util.*
|
||||
|
||||
internal interface RNGConsumer {
|
||||
|
||||
val RNG: Random
|
||||
var seed: Long
|
||||
var iterations: Int
|
||||
|
||||
fun loadFromSave(seed: Long, iterations: Int) {
|
||||
this.seed = seed
|
||||
this.iterations = iterations
|
||||
|
||||
repeat(iterations, { RNG.nextInt() })
|
||||
}
|
||||
|
||||
private fun incIterations() {
|
||||
iterations++
|
||||
|
||||
if (iterations < 0) iterations = 0
|
||||
}
|
||||
|
||||
fun getRandomLong(): Long {
|
||||
iterations++
|
||||
return RNG.nextLong()
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user