mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 20:44:05 +09:00
fixes, bits and pieces, changes in ID referencing, terrain and wall takes damage, working test pickaxe, and a new issue
This commit is contained in:
@@ -150,5 +150,5 @@ object Tile {
|
||||
val LAVA_15 = TileCodex.idDamageToIndex(254, 14)
|
||||
val LAVA = TileCodex.idDamageToIndex(254, 15)
|
||||
|
||||
val NULL = 4096
|
||||
val NULL = -1
|
||||
}
|
||||
|
||||
@@ -18,8 +18,10 @@ object TileCodex {
|
||||
|
||||
const val TILE_UNIQUE_MAX = MapLayer.RANGE * PairedMapLayer.RANGE
|
||||
|
||||
private val nullProp = TileProp()
|
||||
|
||||
init {
|
||||
tileProps = Array<TileProp>(TILE_UNIQUE_MAX + 1, { i -> TileProp() })
|
||||
tileProps = Array<TileProp>(TILE_UNIQUE_MAX * 2, { i -> TileProp() })
|
||||
|
||||
for (i in tileProps.indices) {
|
||||
tileProps[i] = TileProp()
|
||||
@@ -31,8 +33,15 @@ object TileCodex {
|
||||
|
||||
println("[TileCodex] Building tile properties table")
|
||||
|
||||
records.forEach { setProp(
|
||||
tileProps[idDamageToIndex(intVal(it, "id"), intVal(it, "dmg"))], it)
|
||||
records.forEach {
|
||||
if (intVal(it, "dmg") == -1) {
|
||||
setProp(nullProp, it)
|
||||
}
|
||||
else {
|
||||
setProp(
|
||||
tileProps[idDamageToIndex(intVal(it, "id"), intVal(it, "dmg"))], it
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e: IOException) {
|
||||
@@ -53,14 +62,16 @@ object TileCodex {
|
||||
}
|
||||
|
||||
operator fun get(rawIndex: Int?): TileProp {
|
||||
if (rawIndex == null || rawIndex == Tile.NULL) {
|
||||
return nullProp
|
||||
}
|
||||
|
||||
try {
|
||||
tileProps[rawIndex ?: Tile.NULL].id
|
||||
return tileProps[rawIndex]
|
||||
}
|
||||
catch (e: NullPointerException) {
|
||||
throw NullPointerException("Tile prop with raw id $rawIndex does not exist.")
|
||||
}
|
||||
|
||||
return tileProps[rawIndex ?: Tile.NULL]
|
||||
}
|
||||
|
||||
private fun setProp(prop: TileProp, record: CSVRecord) {
|
||||
|
||||
@@ -135,7 +135,7 @@ object TilePropCSV {
|
||||
"255"; "13";"TILE_WATER" ; "27282445"; "100";"1000";"watr"; "1"; "0"; "0"; "0"; "N/A"; "N/A"; "0"; "0"; "16"; "0";"16"
|
||||
"255"; "14";"TILE_WATER" ; "27282445"; "100";"1000";"watr"; "1"; "0"; "0"; "0"; "N/A"; "N/A"; "0"; "0"; "16"; "0";"16"
|
||||
"255"; "15";"TILE_WATER" ; "27282445"; "100";"1000";"watr"; "1"; "0"; "0"; "0"; "N/A"; "N/A"; "0"; "0"; "16"; "0";"16"
|
||||
"256"; "0";"TILE_NULL" ;"1073741823"; "-1";"2600";"null"; "0"; "0"; "1"; "0"; "N/A"; "N/A"; "0"; "0"; "N/A"; "0";"16"
|
||||
"0"; "-1";"TILE_NULL" ;"1073741823"; "-1";"2600";"null"; "0"; "0"; "1"; "0"; "N/A"; "N/A"; "0"; "0"; "N/A"; "0";"16"
|
||||
|
||||
## Notes ##
|
||||
|
||||
|
||||
Reference in New Issue
Block a user