Skip to content

Commit

Permalink
ForcedSnapshot for snapshot releases
Browse files Browse the repository at this point in the history
  • Loading branch information
curioustorvald committed Dec 8, 2023
1 parent b2b9dac commit 6926b18
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/net/torvald/terrarum/TerrarumAppConfiguration.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 6926b18

Please sign in to comment.