From 6926b18cef1a755cae3022c38fa154e42554730d Mon Sep 17 00:00:00 2001 From: minjaesong Date: Fri, 8 Dec 2023 13:25:40 +0900 Subject: [PATCH] ForcedSnapshot for snapshot releases --- .../terrarum/TerrarumAppConfiguration.kt | 17 +++++++++++++---- .../gameactors/PlayerBuilderTestSubject1.kt | 6 ++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/net/torvald/terrarum/TerrarumAppConfiguration.kt b/src/net/torvald/terrarum/TerrarumAppConfiguration.kt index 41109e646..dc6b06704 100644 --- a/src/net/torvald/terrarum/TerrarumAppConfiguration.kt +++ b/src/net/torvald/terrarum/TerrarumAppConfiguration.kt @@ -81,17 +81,26 @@ basegame const val TILE_SIZE = 16 const val TILE_SIZEF = TILE_SIZE.toFloat() const val TILE_SIZED = TILE_SIZE.toDouble() + + + private fun ForcedSnapshot(string: String): Snapshot { + val s = Snapshot(string.last().code - 0x61) + s.year = string.substring(0, 2).toInt() + s.week = string.substring(3, 5).toInt() + s.update() + return s + } } data class Snapshot(var revision: Int) { - private var today = Calendar.getInstance(); - private var year = today.get(Calendar.YEAR) - 2000 - private var week = today.get(Calendar.WEEK_OF_YEAR) + private var today = Calendar.getInstance() + internal var year = today.get(Calendar.YEAR) - 2000 + internal var week = today.get(Calendar.WEEK_OF_YEAR) private var string = "" private var bytes = byteArrayOf() - private fun update() { + internal fun update() { string = "${year}w${week}${Char(0x61 + revision)}" bytes = byteArrayOf( revision.and(4).shl(7).or(year.and(127)).toByte(), diff --git a/src/net/torvald/terrarum/modulebasegame/gameactors/PlayerBuilderTestSubject1.kt b/src/net/torvald/terrarum/modulebasegame/gameactors/PlayerBuilderTestSubject1.kt index 1835c8643..62d0af2ad 100644 --- a/src/net/torvald/terrarum/modulebasegame/gameactors/PlayerBuilderTestSubject1.kt +++ b/src/net/torvald/terrarum/modulebasegame/gameactors/PlayerBuilderTestSubject1.kt @@ -46,9 +46,15 @@ object PlayerBuilderTestSubject1 { //p.actorValue[AVKey.LUMB] = 1.37 //p.actorValue[AVKey.LUMA] = 1.93 + giveFreeStarterPackUntilPotsWithItemsAreImplemented(p) + p.actorValue[AVKey.AIRJUMPPOINT] = 0 p.actorValue[AVKey.SCALE] = 1.0 return p } + + private fun giveFreeStarterPackUntilPotsWithItemsAreImplemented(p: IngamePlayer) { + p.inventory.add("basegame:176", 20) // torches + } } \ No newline at end of file