mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-15 04:54:05 +09:00
tevd update; seemingly working savefile export
This commit is contained in:
@@ -13,12 +13,12 @@ import java.math.BigInteger
|
||||
*/
|
||||
object WriteActor {
|
||||
|
||||
operator fun invoke(actor: IngamePlayer): String {
|
||||
operator fun invoke(actor: Actor): String {
|
||||
val s = Common.jsoner.toJson(actor, actor.javaClass)
|
||||
return """{"class":"${actor.javaClass.canonicalName}",${s.substring(1)}"""
|
||||
}
|
||||
|
||||
fun encodeToByteArray64(actor: IngamePlayer): ByteArray64 {
|
||||
fun encodeToByteArray64(actor: Actor): ByteArray64 {
|
||||
val ba = ByteArray64()
|
||||
this.invoke(actor).toByteArray().forEach { ba.add(it) }
|
||||
return ba
|
||||
|
||||
@@ -20,7 +20,7 @@ open class WriteMeta(val ingame: TerrarumIngame) {
|
||||
val world = ingame.world
|
||||
|
||||
val json = """{
|
||||
"genver": 4,
|
||||
"genver": ${Common.GENVER},
|
||||
"savename": "${world.worldName}",
|
||||
"terrseed": ${world.generatorSeed},
|
||||
"randseed0": ${RoguelikeRandomiser.RNG.state0},
|
||||
|
||||
@@ -18,7 +18,7 @@ open class WriteWorld(val ingame: TerrarumIngame) {
|
||||
}
|
||||
|
||||
fun encodeToByteArray64(): ByteArray64 {
|
||||
val world = ingame.world
|
||||
/*val world = ingame.world
|
||||
world.genver = Common.GENVER
|
||||
world.comp = Common.COMP_GZIP
|
||||
|
||||
@@ -38,6 +38,10 @@ open class WriteWorld(val ingame: TerrarumIngame) {
|
||||
Common.jsoner.toJson(world, wr)
|
||||
wr.flush(); wr.close()
|
||||
|
||||
return ba*/
|
||||
|
||||
val ba = ByteArray64()
|
||||
this.invoke().toByteArray().forEach { ba.add(it) }
|
||||
return ba
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user