mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
code cleanup, shortening things
Former-commit-id: d1c81cf3207fff4dd311e9b6c3beb04c194aebc5 Former-commit-id: 26f5042ba41cd577e681a22465435945434c864b
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
package net.torvald.serialise
|
||||
|
||||
import net.torvald.CSVFetcher
|
||||
import net.torvald.terrarum.itemproperties.ItemPropCodex
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.itemproperties.MaterialPropCodex
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import net.torvald.terrarum.tileproperties.TileCodex
|
||||
import java.io.IOException
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
@@ -20,8 +20,8 @@ object WriteCSV {
|
||||
val META_FILENAME_MAT = "worldinfo4"
|
||||
|
||||
fun write(saveDirectoryName: String): Boolean {
|
||||
//val tileCSV = CSVFetcher.readCSVasString(TilePropCodex.CSV_PATH)
|
||||
//val itemCSV = CSVFetcher.readCSVasString(ItemPropCodex.CSV_PATH)
|
||||
//val tileCSV = CSVFetcher.readCSVasString(TileCodex.CSV_PATH)
|
||||
//val itemCSV = CSVFetcher.readCSVasString(ItemCodex.CSV_PATH)
|
||||
//val matCSV = CSVFetcher.readCSVasString(MaterialPropCodex.CSV_PATH)
|
||||
|
||||
val pathTile = Paths.get("${Terrarum.defaultSaveDir}" +
|
||||
|
||||
@@ -3,10 +3,10 @@ package net.torvald.serialise
|
||||
import net.torvald.terrarum.mapgenerator.WorldGenerator
|
||||
import net.torvald.terrarum.mapgenerator.RoguelikeRandomiser
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.itemproperties.ItemPropCodex
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.itemproperties.MaterialPropCodex
|
||||
import net.torvald.terrarum.tileproperties.TilePropCSV
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import net.torvald.terrarum.tileproperties.TileCodex
|
||||
import org.apache.commons.codec.digest.DigestUtils
|
||||
import java.io.FileInputStream
|
||||
import java.io.File
|
||||
|
||||
@@ -23,7 +23,7 @@ import net.torvald.terrarum.mapdrawer.MapCamera
|
||||
import net.torvald.terrarum.mapdrawer.MapDrawer
|
||||
import net.torvald.terrarum.mapgenerator.WorldGenerator
|
||||
import net.torvald.terrarum.mapgenerator.RoguelikeRandomiser
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import net.torvald.terrarum.tileproperties.TileCodex
|
||||
import net.torvald.terrarum.tilestats.TileStats
|
||||
import net.torvald.terrarum.ui.*
|
||||
import net.torvald.terrarum.weather.WeatherMixer
|
||||
@@ -113,8 +113,8 @@ constructor() : BasicGameState() {
|
||||
|
||||
// generate terrain for the map
|
||||
WorldGenerator.attachMap(world)
|
||||
WorldGenerator.SEED = 0x51621D2
|
||||
//WorldGenerator.SEED = HQRNG().nextLong()
|
||||
//WorldGenerator.SEED = 0x51621D2
|
||||
WorldGenerator.SEED = HQRNG().nextLong()
|
||||
WorldGenerator.generateMap()
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package net.torvald.terrarum.console
|
||||
import net.torvald.colourutil.Col4096
|
||||
import net.torvald.RasterWriter
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.tileproperties.TileNameCode
|
||||
import net.torvald.terrarum.tileproperties.Tile
|
||||
|
||||
import java.io.*
|
||||
import java.util.HashMap
|
||||
@@ -68,46 +68,46 @@ internal object ExportMap : ConsoleCommand {
|
||||
|
||||
Echo("Usage: export <name>")
|
||||
Echo("Exports current map into echo image.")
|
||||
Echo("The image can be found at %adddata%/terrarum/Exports")
|
||||
Echo("The image can be found at %appdata%/terrarum/Exports")
|
||||
}
|
||||
|
||||
private fun buildColorTable() {
|
||||
colorTable.put(TileNameCode.AIR, Col4096(0xCEF))
|
||||
colorTable.put(TileNameCode.STONE, Col4096(0x888))
|
||||
colorTable.put(TileNameCode.DIRT, Col4096(0x753))
|
||||
colorTable.put(TileNameCode.GRASS, Col4096(0x472))
|
||||
colorTable.put(Tile.AIR, Col4096(0xCEF))
|
||||
colorTable.put(Tile.STONE, Col4096(0x888))
|
||||
colorTable.put(Tile.DIRT, Col4096(0x753))
|
||||
colorTable.put(Tile.GRASS, Col4096(0x472))
|
||||
|
||||
colorTable.put(TileNameCode.ORE_COPPER, Col4096(0x6A8))
|
||||
colorTable.put(TileNameCode.ORE_IRON, Col4096(0xC75))
|
||||
colorTable.put(TileNameCode.ORE_GOLD, Col4096(0xA87))
|
||||
colorTable.put(TileNameCode.ORE_ILMENITE, Col4096(0x8AB))
|
||||
colorTable.put(TileNameCode.ORE_AURICHALCUM, Col4096(0xD92))
|
||||
colorTable.put(TileNameCode.ORE_SILVER, Col4096(0xDDD))
|
||||
colorTable.put(Tile.ORE_COPPER, Col4096(0x6A8))
|
||||
colorTable.put(Tile.ORE_IRON, Col4096(0xC75))
|
||||
colorTable.put(Tile.ORE_GOLD, Col4096(0xA87))
|
||||
colorTable.put(Tile.ORE_ILMENITE, Col4096(0x8AB))
|
||||
colorTable.put(Tile.ORE_AURICHALCUM, Col4096(0xD92))
|
||||
colorTable.put(Tile.ORE_SILVER, Col4096(0xDDD))
|
||||
|
||||
colorTable.put(TileNameCode.RAW_DIAMOND, Col4096(0x2BF))
|
||||
colorTable.put(TileNameCode.RAW_RUBY, Col4096(0xB10))
|
||||
colorTable.put(TileNameCode.RAW_EMERALD, Col4096(0x0B1))
|
||||
colorTable.put(TileNameCode.RAW_SAPPHIRE, Col4096(0x01B))
|
||||
colorTable.put(TileNameCode.RAW_TOPAZ, Col4096(0xC70))
|
||||
colorTable.put(TileNameCode.RAW_AMETHYST, Col4096(0x70C))
|
||||
colorTable.put(Tile.RAW_DIAMOND, Col4096(0x2BF))
|
||||
colorTable.put(Tile.RAW_RUBY, Col4096(0xB10))
|
||||
colorTable.put(Tile.RAW_EMERALD, Col4096(0x0B1))
|
||||
colorTable.put(Tile.RAW_SAPPHIRE, Col4096(0x01B))
|
||||
colorTable.put(Tile.RAW_TOPAZ, Col4096(0xC70))
|
||||
colorTable.put(Tile.RAW_AMETHYST, Col4096(0x70C))
|
||||
|
||||
colorTable.put(TileNameCode.WATER, Col4096(0x038))
|
||||
colorTable.put(TileNameCode.LAVA, Col4096(0xF50))
|
||||
colorTable.put(Tile.WATER, Col4096(0x038))
|
||||
colorTable.put(Tile.LAVA, Col4096(0xF50))
|
||||
|
||||
colorTable.put(TileNameCode.SAND, Col4096(0xDDB))
|
||||
colorTable.put(TileNameCode.SAND_WHITE, Col4096(0xFFD))
|
||||
colorTable.put(TileNameCode.SAND_RED, Col4096(0xA32))
|
||||
colorTable.put(TileNameCode.SAND_DESERT, Col4096(0xEDB))
|
||||
colorTable.put(TileNameCode.SAND_BLACK, Col4096(0x444))
|
||||
colorTable.put(TileNameCode.SAND_GREEN, Col4096(0x9A6))
|
||||
colorTable.put(Tile.SAND, Col4096(0xDDB))
|
||||
colorTable.put(Tile.SAND_WHITE, Col4096(0xFFD))
|
||||
colorTable.put(Tile.SAND_RED, Col4096(0xA32))
|
||||
colorTable.put(Tile.SAND_DESERT, Col4096(0xEDB))
|
||||
colorTable.put(Tile.SAND_BLACK, Col4096(0x444))
|
||||
colorTable.put(Tile.SAND_GREEN, Col4096(0x9A6))
|
||||
|
||||
colorTable.put(TileNameCode.GRAVEL, Col4096(0x664))
|
||||
colorTable.put(TileNameCode.GRAVEL_GREY, Col4096(0x999))
|
||||
colorTable.put(Tile.GRAVEL, Col4096(0x664))
|
||||
colorTable.put(Tile.GRAVEL_GREY, Col4096(0x999))
|
||||
|
||||
colorTable.put(TileNameCode.ICE_NATURAL, Col4096(0x9AB))
|
||||
colorTable.put(TileNameCode.ICE_MAGICAL, Col4096(0x7AC))
|
||||
colorTable.put(TileNameCode.ICE_FRAGILE, Col4096(0x6AF))
|
||||
colorTable.put(TileNameCode.SNOW, Col4096(0xCDE))
|
||||
colorTable.put(Tile.ICE_NATURAL, Col4096(0x9AB))
|
||||
colorTable.put(Tile.ICE_MAGICAL, Col4096(0x7AC))
|
||||
colorTable.put(Tile.ICE_FRAGILE, Col4096(0x6AF))
|
||||
colorTable.put(Tile.SNOW, Col4096(0xCDE))
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ import net.torvald.terrarum.gameactors.ActorInventory
|
||||
import net.torvald.terrarum.gameactors.Player
|
||||
import net.torvald.terrarum.gameactors.Pocketed
|
||||
import net.torvald.terrarum.gameitem.EquipPosition
|
||||
import net.torvald.terrarum.itemproperties.ItemPropCodex
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
|
||||
/**
|
||||
* Created by SKYHi14 on 2016-12-12.
|
||||
@@ -55,11 +55,11 @@ internal object Inventory : ConsoleCommand {
|
||||
}
|
||||
|
||||
private fun addItem(refId: Int, amount: Int = 1) {
|
||||
target.inventory.add(ItemPropCodex[refId], amount)
|
||||
target.inventory.add(ItemCodex[refId], amount)
|
||||
}
|
||||
|
||||
private fun equipItem(refId: Int) {
|
||||
val item = ItemPropCodex[refId]
|
||||
val item = ItemCodex[refId]
|
||||
|
||||
// if the item does not exist, add it first
|
||||
if (!target.inventory.contains(item)) {
|
||||
|
||||
@@ -10,10 +10,10 @@ internal object Seed : ConsoleCommand {
|
||||
val ccG = GameFontBase.colToCode["g"]
|
||||
val ccW = GameFontBase.colToCode["w"]
|
||||
val ccY = GameFontBase.colToCode["y"]
|
||||
// tsalagi
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
Echo("Map$ccW: $ccG${Terrarum.ingame.world.generatorSeed}")
|
||||
println("[seed] Map$ccW: $ccG${Terrarum.ingame.world.generatorSeed}")
|
||||
// TODO display randomiser seed
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.itemproperties.ItemPropCodex
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import org.newdawn.slick.GameContainer
|
||||
|
||||
/**
|
||||
@@ -40,7 +40,7 @@ abstract class Actor : Comparable<Actor>, Runnable {
|
||||
var ret: Int
|
||||
do {
|
||||
ret = HQRNG().nextInt().and(0x7FFFFFFF) // set new ID
|
||||
} while (Terrarum.ingame.hasActor(ret) || ret < ItemPropCodex.ITEM_COUNT_MAX) // check for collision
|
||||
} while (Terrarum.ingame.hasActor(ret) || ret < ItemCodex.ITEM_COUNT_MAX) // check for collision
|
||||
return ret
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameitem.InventoryItem
|
||||
import net.torvald.terrarum.itemproperties.ItemPropCodex
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -51,7 +51,7 @@ class ActorInventory() {
|
||||
}
|
||||
}
|
||||
|
||||
fun add(itemID: Int, count: Int = 1) = add(ItemPropCodex[itemID], count)
|
||||
fun add(itemID: Int, count: Int = 1) = add(ItemCodex[itemID], count)
|
||||
fun add(item: InventoryItem, count: Int = 1) {
|
||||
if (item.id == Player.PLAYER_REF_ID)
|
||||
throw IllegalArgumentException("Attempted to put human player into the inventory.")
|
||||
@@ -64,7 +64,7 @@ class ActorInventory() {
|
||||
itemList.put(item, itemList[item] ?: 0 + count)
|
||||
}
|
||||
|
||||
fun remove(itemID: Int, count: Int = 1) = remove(ItemPropCodex[itemID], count)
|
||||
fun remove(itemID: Int, count: Int = 1) = remove(ItemCodex[itemID], count)
|
||||
fun remove(item: InventoryItem, count: Int = 1) {
|
||||
// check if the item does NOT exist
|
||||
if (itemList[item] == null) {
|
||||
@@ -84,7 +84,7 @@ class ActorInventory() {
|
||||
|
||||
|
||||
fun contains(item: InventoryItem) = itemList.containsKey(item)
|
||||
fun contains(itemID: Int) = itemList.containsKey(ItemPropCodex[itemID])
|
||||
fun contains(itemID: Int) = itemList.containsKey(ItemCodex[itemID])
|
||||
|
||||
fun forEach(consumer: (InventoryItem, Int) -> Unit) = itemList.forEach(consumer)
|
||||
|
||||
|
||||
@@ -5,10 +5,10 @@ import net.torvald.point.Point2d
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.mapdrawer.MapDrawer
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import net.torvald.terrarum.tileproperties.TileCodex
|
||||
import net.torvald.spriteanimation.SpriteAnimation
|
||||
import net.torvald.terrarum.mapdrawer.MapDrawer.TILE_SIZE
|
||||
import net.torvald.terrarum.tileproperties.TileNameCode
|
||||
import net.torvald.terrarum.tileproperties.Tile
|
||||
import net.torvald.terrarum.tileproperties.TileProp
|
||||
import org.dyn4j.Epsilon
|
||||
import org.dyn4j.geometry.Vector2
|
||||
@@ -694,7 +694,7 @@ open class ActorWithBody : Actor() {
|
||||
for (y in tyStart..tyEnd) {
|
||||
for (x in txStart..txEnd) {
|
||||
val tile = world.getTileFromTerrain(x, y)
|
||||
if (TilePropCodex[tile].isSolid)
|
||||
if (TileCodex[tile].isSolid)
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -736,7 +736,7 @@ open class ActorWithBody : Actor() {
|
||||
}
|
||||
|
||||
// evaluate
|
||||
if (TilePropCodex[world.getTileFromTerrain(tileX, tileY)].isFluid) {
|
||||
if (TileCodex[world.getTileFromTerrain(tileX, tileY)].isFluid) {
|
||||
contactAreaCounter += 1
|
||||
}
|
||||
}
|
||||
@@ -746,7 +746,7 @@ open class ActorWithBody : Actor() {
|
||||
|
||||
private fun setHorizontalFriction() {
|
||||
val friction = if (isPlayerNoClip)
|
||||
BASE_FRICTION * TilePropCodex[TileNameCode.STONE].friction.tileFrictionToMult()
|
||||
BASE_FRICTION * TileCodex[Tile.STONE].friction.tileFrictionToMult()
|
||||
else
|
||||
BASE_FRICTION * bodyFriction.tileFrictionToMult()
|
||||
|
||||
@@ -773,7 +773,7 @@ open class ActorWithBody : Actor() {
|
||||
|
||||
private fun setVerticalFriction() {
|
||||
val friction = if (isPlayerNoClip)
|
||||
BASE_FRICTION * TilePropCodex[TileNameCode.STONE].friction.tileFrictionToMult()
|
||||
BASE_FRICTION * TileCodex[Tile.STONE].friction.tileFrictionToMult()
|
||||
else
|
||||
BASE_FRICTION * bodyFriction.tileFrictionToMult()
|
||||
|
||||
@@ -833,8 +833,8 @@ open class ActorWithBody : Actor() {
|
||||
get() {
|
||||
var friction = 0
|
||||
forEachFeetTile {
|
||||
if (it?.friction ?: 4 > friction) // 4: friction of the air
|
||||
friction = it?.friction ?: 4
|
||||
if (it?.friction ?: TileCodex[Tile.AIR].friction > friction)
|
||||
friction = it?.friction ?: TileCodex[Tile.AIR].friction
|
||||
}
|
||||
|
||||
return friction
|
||||
@@ -1021,7 +1021,7 @@ open class ActorWithBody : Actor() {
|
||||
val tileProps = ArrayList<TileProp?>()
|
||||
for (y in tilewiseHitbox.posY.toInt()..tilewiseHitbox.endPointY.toInt()) {
|
||||
for (x in tilewiseHitbox.posX.toInt()..tilewiseHitbox.endPointX.toInt()) {
|
||||
tileProps.add(TilePropCodex[world.getTileFromTerrain(x, y)])
|
||||
tileProps.add(TileCodex[world.getTileFromTerrain(x, y)])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1048,7 +1048,7 @@ open class ActorWithBody : Actor() {
|
||||
val y = nextHitbox.endPointY.plus(1.0).div(TILE_SIZE).floorInt()
|
||||
|
||||
for (x in tilewiseHitbox.posX.toInt()..tilewiseHitbox.endPointX.toInt()) {
|
||||
tileProps.add(TilePropCodex[world.getTileFromTerrain(x, y)])
|
||||
tileProps.add(TileCodex[world.getTileFromTerrain(x, y)])
|
||||
}
|
||||
|
||||
return tileProps.forEach(consumer)
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.terrarum.gameitem.InventoryItem
|
||||
import net.torvald.terrarum.itemproperties.ItemPropCodex
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.tileproperties.TileCodex
|
||||
import org.newdawn.slick.GameContainer
|
||||
import org.newdawn.slick.Graphics
|
||||
|
||||
@@ -12,17 +12,17 @@ import org.newdawn.slick.Graphics
|
||||
class DroppedItem(private val item: InventoryItem) : ActorWithBody() {
|
||||
|
||||
init {
|
||||
if (item.id >= ItemPropCodex.ITEM_COUNT_MAX)
|
||||
if (item.id >= ItemCodex.ITEM_COUNT_MAX)
|
||||
throw RuntimeException("Attempted to create DroppedItem actor of a real actor; the real actor must be dropped instead.")
|
||||
|
||||
isVisible = true
|
||||
|
||||
mass = if (item.id < TilePropCodex.TILE_UNIQUE_MAX)
|
||||
TilePropCodex[item.id].density / 1000.0
|
||||
mass = if (item.id < TileCodex.TILE_UNIQUE_MAX)
|
||||
TileCodex[item.id].density / 1000.0
|
||||
else
|
||||
ItemPropCodex[item.id].mass
|
||||
ItemCodex[item.id].mass
|
||||
|
||||
scale = ItemPropCodex[item.id].scale
|
||||
scale = ItemCodex[item.id].scale
|
||||
}
|
||||
|
||||
override fun update(gc: GameContainer, delta: Int) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import net.torvald.spriteanimation.SpriteAnimation
|
||||
import net.torvald.terrarum.tileproperties.TileNameCode
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import net.torvald.terrarum.tileproperties.Tile
|
||||
import net.torvald.terrarum.tileproperties.TileCodex
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
@@ -11,7 +11,7 @@ import java.util.*
|
||||
class FixtureTikiTorch : FixtureBase(), Luminous {
|
||||
|
||||
override var luminosity: Int
|
||||
get() = TilePropCodex[TileNameCode.TORCH].luminosity
|
||||
get() = TileCodex[Tile.TORCH].luminosity
|
||||
set(value) {
|
||||
throw UnsupportedOperationException()
|
||||
}
|
||||
@@ -35,6 +35,6 @@ class FixtureTikiTorch : FixtureBase(), Luminous {
|
||||
|
||||
actorValue[AVKey.BASEMASS] = 1.0
|
||||
|
||||
luminosity = TilePropCodex[TileNameCode.TORCH].luminosity
|
||||
luminosity = TileCodex[Tile.TORCH].luminosity
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,7 @@ import com.google.gson.JsonObject
|
||||
import net.torvald.terrarum.gameactors.ActorHumanoid
|
||||
import net.torvald.terrarum.gameactors.faction.FactionFactory
|
||||
import net.torvald.terrarum.gameitem.EquipPosition
|
||||
import net.torvald.terrarum.itemproperties.ItemPropCodex
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import net.torvald.terrarum.mapdrawer.MapDrawer
|
||||
import org.newdawn.slick.SlickException
|
||||
import java.io.IOException
|
||||
@@ -77,7 +77,7 @@ object PlayerBuilderSigrid {
|
||||
|
||||
// Test fill up inventory
|
||||
p.inventory.add(16)
|
||||
p.equipItem(ItemPropCodex[16])
|
||||
p.equipItem(ItemCodex[16])
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -6,8 +6,8 @@ import net.torvald.terrarum.mapdrawer.MapCamera
|
||||
import net.torvald.terrarum.mapdrawer.MapDrawer
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.ProjectileSimple
|
||||
import net.torvald.terrarum.tileproperties.TileNameCode
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import net.torvald.terrarum.tileproperties.Tile
|
||||
import net.torvald.terrarum.tileproperties.TileCodex
|
||||
import net.torvald.terrarum.ui.UIHandler
|
||||
import org.dyn4j.geometry.Vector2
|
||||
import org.newdawn.slick.GameContainer
|
||||
@@ -58,8 +58,8 @@ object GameController {
|
||||
// test tile remove
|
||||
/*if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) {
|
||||
try {
|
||||
Terrarum.ingame.world.setTileTerrain(mouseTileX, mouseTileY, TileNameCode.AIR)
|
||||
// terrarum.game.map.setTileWall(mouseTileX, mouseTileY, TileNameCode.AIR);
|
||||
Terrarum.ingame.world.setTileTerrain(mouseTileX, mouseTileY, Tile.AIR)
|
||||
// terrarum.game.map.setTileWall(mouseTileX, mouseTileY, Tile.AIR);
|
||||
}
|
||||
catch (e: ArrayIndexOutOfBoundsException) {
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.gameitem
|
||||
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.KVHashMap
|
||||
import net.torvald.terrarum.itemproperties.ItemPropCodex
|
||||
import net.torvald.terrarum.itemproperties.ItemCodex
|
||||
import org.newdawn.slick.GameContainer
|
||||
|
||||
/**
|
||||
@@ -26,7 +26,7 @@ open class DynamicItem(val baseItemID: Int?, newMass: Double? = null, newScale:
|
||||
|
||||
override val equipPosition: Int = // default to HAND_GRIP if no baseItemID given
|
||||
if (baseItemID != null)
|
||||
ItemPropCodex[baseItemID].equipPosition
|
||||
ItemCodex[baseItemID].equipPosition
|
||||
else
|
||||
EquipPosition.HAND_GRIP
|
||||
|
||||
@@ -35,7 +35,7 @@ open class DynamicItem(val baseItemID: Int?, newMass: Double? = null, newScale:
|
||||
var ret: Int
|
||||
do {
|
||||
ret = HQRNG().nextInt().and(0x7FFFFFFF) // set new ID
|
||||
} while (ItemPropCodex.hasItem(ret) || ret < ItemPropCodex.ITEM_DYNAMIC_MIN || ret > ItemPropCodex.ITEM_DYNAMIC_MAX) // check for collision
|
||||
} while (ItemCodex.hasItem(ret) || ret < ItemCodex.ITEM_DYNAMIC_MIN || ret > ItemCodex.ITEM_DYNAMIC_MAX) // check for collision
|
||||
return ret
|
||||
}
|
||||
|
||||
@@ -67,14 +67,14 @@ open class DynamicItem(val baseItemID: Int?, newMass: Double? = null, newScale:
|
||||
mass = newMass!!
|
||||
}
|
||||
else {
|
||||
mass = newMass ?: ItemPropCodex[baseItemID].mass
|
||||
mass = newMass ?: ItemCodex[baseItemID].mass
|
||||
}
|
||||
|
||||
if (baseItemID == null) {
|
||||
scale = newScale!!
|
||||
}
|
||||
else {
|
||||
scale = newScale ?: ItemPropCodex[baseItemID].scale
|
||||
scale = newScale ?: ItemCodex[baseItemID].scale
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,8 @@ import net.torvald.terrarum.gameactors.roundInt
|
||||
import net.torvald.terrarum.gameworld.WorldSimulator.isSolid
|
||||
import net.torvald.terrarum.mapdrawer.MapCamera
|
||||
import net.torvald.terrarum.mapdrawer.MapDrawer
|
||||
import net.torvald.terrarum.tileproperties.TileNameCode
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import net.torvald.terrarum.tileproperties.Tile
|
||||
import net.torvald.terrarum.tileproperties.TileCodex
|
||||
import org.newdawn.slick.Color
|
||||
import org.newdawn.slick.Graphics
|
||||
|
||||
@@ -67,10 +67,10 @@ object WorldSimulator {
|
||||
/////////////////////////////////////////////////////////////
|
||||
for (y in updateYFrom..updateYTo) {
|
||||
for (x in updateXFrom..updateXTo) {
|
||||
val tile = world.getTileFromTerrain(x, y) ?: TileNameCode.STONE
|
||||
val tileBottom = world.getTileFromTerrain(x, y + 1) ?: TileNameCode.STONE
|
||||
val tileLeft = world.getTileFromTerrain(x - 1, y) ?: TileNameCode.STONE
|
||||
val tileRight = world.getTileFromTerrain(x + 1, y) ?: TileNameCode.STONE
|
||||
val tile = world.getTileFromTerrain(x, y) ?: Tile.STONE
|
||||
val tileBottom = world.getTileFromTerrain(x, y + 1) ?: Tile.STONE
|
||||
val tileLeft = world.getTileFromTerrain(x - 1, y) ?: Tile.STONE
|
||||
val tileRight = world.getTileFromTerrain(x + 1, y) ?: Tile.STONE
|
||||
if (tile.isFluid()) {
|
||||
|
||||
// move down if not obstructed
|
||||
@@ -126,21 +126,21 @@ object WorldSimulator {
|
||||
fun displaceFallables(world: GameWorld, delta: Int) {
|
||||
for (y in updateYFrom..updateYTo) {
|
||||
for (x in updateXFrom..updateXTo) {
|
||||
val tile = world.getTileFromTerrain(x, y) ?: TileNameCode.STONE
|
||||
val tileBelow = world.getTileFromTerrain(x, y + 1) ?: TileNameCode.STONE
|
||||
val tile = world.getTileFromTerrain(x, y) ?: Tile.STONE
|
||||
val tileBelow = world.getTileFromTerrain(x, y + 1) ?: Tile.STONE
|
||||
|
||||
if (tile.isFallable()) {
|
||||
// displace fluid. This statement must precede isSolid()
|
||||
if (tileBelow.isFluid()) {
|
||||
// remove tileThis to create air pocket
|
||||
world.setTileTerrain(x, y, TileNameCode.AIR)
|
||||
world.setTileTerrain(x, y, Tile.AIR)
|
||||
|
||||
pour(world, x, y, drain(world, x, y, tileBelow.fluidLevel()))
|
||||
// place our tile
|
||||
world.setTileTerrain(x, y + 1, tile)
|
||||
}
|
||||
else if (!tileBelow.isSolid()) {
|
||||
world.setTileTerrain(x, y, TileNameCode.AIR)
|
||||
world.setTileTerrain(x, y, Tile.AIR)
|
||||
world.setTileTerrain(x, y + 1, tile)
|
||||
}
|
||||
}
|
||||
@@ -186,7 +186,7 @@ object WorldSimulator {
|
||||
private fun worldToFluidMap(world: GameWorld) {
|
||||
for (y in updateYFrom..updateYTo) {
|
||||
for (x in updateXFrom..updateXTo) {
|
||||
val tile = world.getTileFromTerrain(x, y) ?: TileNameCode.STONE
|
||||
val tile = world.getTileFromTerrain(x, y) ?: Tile.STONE
|
||||
if (tile.isFluid()) {
|
||||
fluidMap[y - updateYFrom][x - updateXFrom] = tile.fluidLevel()
|
||||
fluidTypeMap[y - updateYFrom][x - updateXFrom] = tile.fluidType().toByte()
|
||||
@@ -206,13 +206,13 @@ object WorldSimulator {
|
||||
}
|
||||
}
|
||||
|
||||
fun Int.isFluid() = TilePropCodex[this].isFluid
|
||||
fun Int.isSolid() = this.fluidLevel() == FLUID_MAX || TilePropCodex[this].isSolid
|
||||
//fun Int.viscosity() = TilePropCodex[this].
|
||||
fun Int.isFluid() = TileCodex[this].isFluid
|
||||
fun Int.isSolid() = this.fluidLevel() == FLUID_MAX || TileCodex[this].isSolid
|
||||
//fun Int.viscosity() = TileCodex[this].
|
||||
fun Int.fluidLevel() = if (!this.isFluid()) 0 else (this % FLUID_MAX) + 1
|
||||
fun Int.fluidType() = this / FLUID_MAX
|
||||
fun Int.isEven() = (this and 0x01) == 0
|
||||
fun Int.isFallable() = TilePropCodex[this].isFallable
|
||||
fun Int.isFallable() = TileCodex[this].isFallable
|
||||
|
||||
private fun placeFluid(world: GameWorld, x: Int, y: Int, fluidType: Byte, amount: Int) {
|
||||
if (world.layerTerrain.isInBound(x, y)) {
|
||||
@@ -220,7 +220,7 @@ object WorldSimulator {
|
||||
world.setTileTerrain(x, y, fluidType, amount - 1)
|
||||
}
|
||||
else if (amount == 0 && world.getTileFromTerrain(x, y)!!.isFluid()) {
|
||||
world.setTileTerrain(x, y, TileNameCode.AIR)
|
||||
world.setTileTerrain(x, y, Tile.AIR)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,27 +1,23 @@
|
||||
package net.torvald.terrarum.itemproperties
|
||||
|
||||
import net.torvald.point.Point2d
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.KVHashMap
|
||||
import net.torvald.terrarum.gameactors.CanBeAnItem
|
||||
import net.torvald.terrarum.gameitem.InventoryItem
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.gamecontroller.mouseTileX
|
||||
import net.torvald.terrarum.gamecontroller.mouseTileY
|
||||
import net.torvald.terrarum.gameitem.EquipPosition
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.tileproperties.TileProp
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import org.apache.commons.csv.CSVRecord
|
||||
import net.torvald.terrarum.tileproperties.TileCodex
|
||||
import org.newdawn.slick.GameContainer
|
||||
import java.util.*
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-03-15.
|
||||
*/
|
||||
object ItemPropCodex {
|
||||
object ItemCodex {
|
||||
|
||||
/**
|
||||
* <ItemID or RefID for Actor, TheItem>
|
||||
@@ -43,7 +39,7 @@ object ItemPropCodex {
|
||||
itemCodex[i] = object : InventoryItem() {
|
||||
override val id: Int = i
|
||||
override val equipPosition = EquipPosition.HAND_GRIP
|
||||
override var mass: Double = TilePropCodex[i].density / 1000.0
|
||||
override var mass: Double = TileCodex[i].density / 1000.0
|
||||
override var scale: Double = 1.0 // no need to set setter as scale would not change
|
||||
|
||||
override fun primaryUse(gc: GameContainer, delta: Int) {
|
||||
@@ -1,195 +0,0 @@
|
||||
package net.torvald.terrarum.mapdrawer
|
||||
|
||||
import com.jme3.math.FastMath
|
||||
import org.newdawn.slick.Color
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-07-08.
|
||||
*/
|
||||
|
||||
/*class Light10B {
|
||||
|
||||
private var data = 0
|
||||
|
||||
constructor(r: Int, g: Int, b: Int) {
|
||||
data = constructRGBFromInt(r, g, b)
|
||||
}
|
||||
|
||||
constructor(r: Float, g: Float, b: Float) {
|
||||
if (r < 0 || r > 1.0f) throw IllegalArgumentException("Red: out of range ($r)")
|
||||
if (g < 0 || g > 1.0f) throw IllegalArgumentException("Green: out of range ($g)")
|
||||
if (b < 0 || b > 1.0f) throw IllegalArgumentException("Blue: out of range ($b)")
|
||||
|
||||
val intR = (r * CHANNEL_MAX).floor()
|
||||
val intG = (g * CHANNEL_MAX).floor()
|
||||
val intB = (b * CHANNEL_MAX).floor()
|
||||
|
||||
data = constructRGBFromInt(intR, intG, intB)
|
||||
}
|
||||
|
||||
constructor(raw: Int) {
|
||||
data = raw
|
||||
}
|
||||
|
||||
constructor(color: Color) {
|
||||
data = constructRGBFromInt(color.red, color.green, color.blue)
|
||||
}
|
||||
|
||||
/**
|
||||
* Assigners
|
||||
*/
|
||||
fun fromRGB(r: Int, g: Int, b: Int): Light10B {
|
||||
data = constructRGBFromInt(r, g, b)
|
||||
return this
|
||||
}
|
||||
|
||||
fun fromInt(raw: Int): Light10B {
|
||||
data = raw
|
||||
return this
|
||||
}
|
||||
|
||||
fun fromSlickColor(color: Color): Light10B {
|
||||
data = constructRGBFromInt(color.red, color.green, color.blue)
|
||||
return this
|
||||
}
|
||||
|
||||
|
||||
|
||||
fun toInt(): Int = data
|
||||
|
||||
fun constructRGBFromInt(r: Int, g: Int, b: Int): Int {
|
||||
if (r !in 0..CHANNEL_MAX) throw IllegalArgumentException("Red: out of range ($r)")
|
||||
if (g !in 0..CHANNEL_MAX) throw IllegalArgumentException("Green: out of range ($g)")
|
||||
if (b !in 0..CHANNEL_MAX) throw IllegalArgumentException("Blue: out of range ($b)")
|
||||
return (r * STEPS_2 + g * STEPS + b)
|
||||
}
|
||||
|
||||
val STEPS = 1024
|
||||
val STEPS_2 = STEPS * STEPS
|
||||
val CHANNEL_MAX = STEPS - 1
|
||||
val CHANNEL_MAX_FLOAT = CHANNEL_MAX.toFloat()
|
||||
val CHANNEL_MAX_DECIMAL = 4f
|
||||
val COLOUR_RANGE_SIZE = STEPS * STEPS_2
|
||||
|
||||
override fun toString() = "10BitCol:$data"
|
||||
|
||||
fun rawR() = data / STEPS_2
|
||||
fun rawG() = data % STEPS_2 / STEPS
|
||||
fun rawB() = data % STEPS
|
||||
|
||||
fun r(): Float = this.rawR() / CHANNEL_MAX_FLOAT
|
||||
fun g(): Float = this.rawG() / CHANNEL_MAX_FLOAT
|
||||
fun b(): Float = this.rawB() / CHANNEL_MAX_FLOAT
|
||||
|
||||
fun Float.floor() = FastMath.floor(this)
|
||||
private fun Float.clampChannel() = if (this < 0) 0f else if (this > CHANNEL_MAX_DECIMAL) CHANNEL_MAX_DECIMAL else this
|
||||
private fun Int.clampChannel() = if (this < 0) 0 else if (this > CHANNEL_MAX) CHANNEL_MAX else this
|
||||
|
||||
operator fun plus(other: Light10B) =
|
||||
Light10B(
|
||||
rawR().plus(other.rawR()).clampChannel(),
|
||||
rawG().plus(other.rawG()).clampChannel(),
|
||||
rawB().plus(other.rawB()).clampChannel()
|
||||
)
|
||||
operator fun minus(other: Light10B) =
|
||||
Light10B(
|
||||
rawR().minus(other.rawR()).clampChannel(),
|
||||
rawG().minus(other.rawG()).clampChannel(),
|
||||
rawB().minus(other.rawB()).clampChannel()
|
||||
)
|
||||
operator fun times(other: Light10B) =
|
||||
Light10B(
|
||||
r().times(other.r()).clampChannel(),
|
||||
g().times(other.g()).clampChannel(),
|
||||
b().times(other.b()).clampChannel()
|
||||
)
|
||||
infix fun darken(other: Light10B): Light10B {
|
||||
if (other.toInt() < 0 || other.toInt() >= COLOUR_RANGE_SIZE)
|
||||
throw IllegalArgumentException("darken: out of range ($other)")
|
||||
|
||||
val r = this.r() * (1f - other.r() * 6) // 6: Arbitrary value
|
||||
val g = this.g() * (1f - other.g() * 6) // TODO gamma correction?
|
||||
val b = this.b() * (1f - other.b() * 6)
|
||||
|
||||
return Light10B(r.clampChannel(), g.clampChannel(), b.clampChannel())
|
||||
}
|
||||
infix fun darken(darken: Int): Light10B {
|
||||
if (darken < 0 || darken > CHANNEL_MAX)
|
||||
throw IllegalArgumentException("darken: out of range ($darken)")
|
||||
|
||||
val darkenColoured = constructRGBFromInt(darken, darken, darken)
|
||||
return (this darken darkenColoured)
|
||||
}
|
||||
infix fun brighten(other: Light10B): Light10B {
|
||||
if (other.toInt() < 0 || other.toInt() >= COLOUR_RANGE_SIZE)
|
||||
throw IllegalArgumentException("brighten: out of range ($other)")
|
||||
|
||||
val r = this.r() * (1f + other.r() * 6) // 6: Arbitrary value
|
||||
val g = this.g() * (1f + other.g() * 6) // TODO gamma correction?
|
||||
val b = this.b() * (1f + other.b() * 6)
|
||||
|
||||
return Light10B(r.clampChannel(), g.clampChannel(), b.clampChannel())
|
||||
}
|
||||
/**
|
||||
* Darken or brighten colour by 'brighten' argument
|
||||
*
|
||||
* @param data Raw channel value (0-255) per channel
|
||||
* @param brighten (-1.0 - 1.0) negative means darkening
|
||||
* @return processed colour
|
||||
*/
|
||||
fun alterBrightnessUniform(data: Light10B, brighten: Float): Light10B {
|
||||
val modifier = if (brighten < 0)
|
||||
Light10B(-brighten, -brighten, -brighten)
|
||||
else
|
||||
Light10B(brighten, brighten, brighten)
|
||||
return if (brighten < 0)
|
||||
data darken modifier
|
||||
else
|
||||
data brighten modifier
|
||||
}
|
||||
|
||||
/** Get each channel from two RGB values, return new RGB that has max value of each channel
|
||||
* @param rgb
|
||||
* @param rgb2
|
||||
* @return
|
||||
*/
|
||||
infix fun maxBlend(other: Light10B): Light10B {
|
||||
val r1 = this.rawR()
|
||||
val r2 = other.rawR()
|
||||
val newR = if (r1 > r2) r1 else r2
|
||||
val g1 = this.rawG()
|
||||
val g2 = other.rawG()
|
||||
val newG = if (g1 > g2) g1 else g2
|
||||
val b1 = this.rawB()
|
||||
val b2 = other.rawB()
|
||||
val newB = if (b1 > b2) b1 else b2
|
||||
|
||||
return Light10B(newR, newG, newB)
|
||||
}
|
||||
|
||||
infix fun screenBlend(other: Light10B): Light10B {
|
||||
val r1 = this.r()
|
||||
val r2 = other.r()
|
||||
val newR = 1 - (1 - r1) * (1 - r2)
|
||||
val g1 = this.g()
|
||||
val g2 = other.g()
|
||||
val newG = 1 - (1 - g1) * (1 - g2)
|
||||
val b1 = this.b()
|
||||
val b2 = other.b()
|
||||
val newB = 1 - (1 - b1) * (1 - b2)
|
||||
|
||||
return Light10B(newR, newG, newB)
|
||||
}
|
||||
|
||||
private infix fun colSub(other: Light10B) = Light10B(
|
||||
(this.rawR() - other.rawR()).clampChannel() ,
|
||||
(this.rawG() - other.rawG()).clampChannel() ,
|
||||
(this.rawB() - other.rawB()).clampChannel()
|
||||
)
|
||||
|
||||
private infix fun colAdd(other: Light10B) = Light10B(
|
||||
(this.rawR() + other.rawR()).clampChannel() ,
|
||||
(this.rawG() + other.rawG()).clampChannel() ,
|
||||
(this.rawB() + other.rawB()).clampChannel()
|
||||
)
|
||||
}*/
|
||||
@@ -2,12 +2,12 @@ package net.torvald.terrarum.mapdrawer
|
||||
|
||||
import net.torvald.terrarum.gameactors.Luminous
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import net.torvald.terrarum.tileproperties.TileCodex
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.colourutil.RGB
|
||||
import net.torvald.colourutil.CIELuvUtil.additiveLuv
|
||||
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||
import net.torvald.terrarum.tileproperties.TileNameCode
|
||||
import net.torvald.terrarum.tileproperties.Tile
|
||||
import net.torvald.terrarum.tileproperties.TilePropUtil
|
||||
import org.newdawn.slick.Color
|
||||
import org.newdawn.slick.Graphics
|
||||
@@ -18,8 +18,8 @@ import java.util.*
|
||||
*/
|
||||
|
||||
object LightmapRenderer {
|
||||
val overscan_open: Int = Math.min(32, 256f.div(TilePropCodex[TileNameCode.AIR].opacity and 0xFF).toFloat().ceil())
|
||||
val overscan_opaque: Int = Math.min(8, 256f.div(TilePropCodex[TileNameCode.STONE].opacity and 0xFF).toFloat().ceil())
|
||||
val overscan_open: Int = Math.min(32, 256f.div(TileCodex[Tile.AIR].opacity and 0xFF).toFloat().ceil())
|
||||
val overscan_opaque: Int = Math.min(8, 256f.div(TileCodex[Tile.STONE].opacity and 0xFF).toFloat().ceil())
|
||||
|
||||
private val LIGHTMAP_WIDTH = Terrarum.ingame.ZOOM_MIN.inv().times(Terrarum.WIDTH)
|
||||
.div(MapDrawer.TILE_SIZE).ceil() + overscan_open * 2 + 3
|
||||
@@ -32,7 +32,7 @@ object LightmapRenderer {
|
||||
private val lightmap: Array<IntArray> = Array(LIGHTMAP_HEIGHT) { IntArray(LIGHTMAP_WIDTH) }
|
||||
private val lanternMap = ArrayList<Lantern>(Terrarum.ingame.ACTORCONTAINER_INITIAL_SIZE * 4)
|
||||
|
||||
private val AIR = TileNameCode.AIR
|
||||
private val AIR = Tile.AIR
|
||||
|
||||
private val OFFSET_R = 2
|
||||
private val OFFSET_G = 1
|
||||
@@ -151,8 +151,8 @@ object LightmapRenderer {
|
||||
// build noop map
|
||||
for (i in 0..rect_size) {
|
||||
val point = edgeToMaskNum(i)
|
||||
val tile = Terrarum.ingame.world.getTileFromTerrain(point.first, point.second) ?: TileNameCode.NULL
|
||||
val isSolid = TilePropCodex[tile].isSolid
|
||||
val tile = Terrarum.ingame.world.getTileFromTerrain(point.first, point.second) ?: Tile.NULL
|
||||
val isSolid = TileCodex[tile].isSolid
|
||||
|
||||
noop_mask.set(i, isSolid)
|
||||
}
|
||||
@@ -237,8 +237,8 @@ object LightmapRenderer {
|
||||
var lightLevelThis: Int = 0
|
||||
val thisTerrain = Terrarum.ingame.world.getTileFromTerrain(x, y)
|
||||
val thisWall = Terrarum.ingame.world.getTileFromWall(x, y)
|
||||
val thisTileLuminosity = TilePropCodex[thisTerrain].luminosity
|
||||
val thisTileOpacity = TilePropCodex[thisTerrain].opacity
|
||||
val thisTileLuminosity = TileCodex[thisTerrain].luminosity
|
||||
val thisTileOpacity = TileCodex[thisTerrain].opacity
|
||||
val sunLight = Terrarum.ingame.world.globalLight
|
||||
|
||||
// MIX TILE
|
||||
|
||||
@@ -3,8 +3,8 @@ package net.torvald.terrarum.mapdrawer
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.gameworld.PairedMapLayer
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.tileproperties.TileNameCode
|
||||
import net.torvald.terrarum.tileproperties.TilePropCodex
|
||||
import net.torvald.terrarum.tileproperties.Tile
|
||||
import net.torvald.terrarum.tileproperties.TileCodex
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.terrarum.concurrent.ThreadPool
|
||||
import net.torvald.terrarum.blendMul
|
||||
@@ -63,48 +63,48 @@ object MapCamera {
|
||||
* These are the tiles that only connects to itself, will not connect to colour variants
|
||||
*/
|
||||
val TILES_CONNECT_SELF = arrayOf(
|
||||
TileNameCode.ICE_MAGICAL
|
||||
, TileNameCode.GLASS_CRUDE
|
||||
, TileNameCode.GLASS_CLEAN
|
||||
, TileNameCode.ILLUMINATOR_BLACK
|
||||
, TileNameCode.ILLUMINATOR_BLUE
|
||||
, TileNameCode.ILLUMINATOR_BROWN
|
||||
, TileNameCode.ILLUMINATOR_CYAN
|
||||
, TileNameCode.ILLUMINATOR_FUCHSIA
|
||||
, TileNameCode.ILLUMINATOR_GREEN
|
||||
, TileNameCode.ILLUMINATOR_GREEN_DARK
|
||||
, TileNameCode.ILLUMINATOR_GREY_DARK
|
||||
, TileNameCode.ILLUMINATOR_GREY_LIGHT
|
||||
, TileNameCode.ILLUMINATOR_GREY_MED
|
||||
, TileNameCode.ILLUMINATOR_ORANGE
|
||||
, TileNameCode.ILLUMINATOR_PURPLE
|
||||
, TileNameCode.ILLUMINATOR_RED
|
||||
, TileNameCode.ILLUMINATOR_TAN
|
||||
, TileNameCode.ILLUMINATOR_WHITE
|
||||
, TileNameCode.ILLUMINATOR_YELLOW
|
||||
, TileNameCode.ILLUMINATOR_BLACK_OFF
|
||||
, TileNameCode.ILLUMINATOR_BLUE_OFF
|
||||
, TileNameCode.ILLUMINATOR_BROWN_OFF
|
||||
, TileNameCode.ILLUMINATOR_CYAN_OFF
|
||||
, TileNameCode.ILLUMINATOR_FUCHSIA_OFF
|
||||
, TileNameCode.ILLUMINATOR_GREEN_OFF
|
||||
, TileNameCode.ILLUMINATOR_GREEN_DARK_OFF
|
||||
, TileNameCode.ILLUMINATOR_GREY_DARK_OFF
|
||||
, TileNameCode.ILLUMINATOR_GREY_LIGHT_OFF
|
||||
, TileNameCode.ILLUMINATOR_GREY_MED_OFF
|
||||
, TileNameCode.ILLUMINATOR_ORANGE_OFF
|
||||
, TileNameCode.ILLUMINATOR_PURPLE_OFF
|
||||
, TileNameCode.ILLUMINATOR_RED_OFF
|
||||
, TileNameCode.ILLUMINATOR_TAN_OFF
|
||||
, TileNameCode.ILLUMINATOR_WHITE_OFF
|
||||
, TileNameCode.ILLUMINATOR_YELLOW
|
||||
, TileNameCode.SANDSTONE
|
||||
, TileNameCode.SANDSTONE_BLACK
|
||||
, TileNameCode.SANDSTONE_DESERT
|
||||
, TileNameCode.SANDSTONE_RED
|
||||
, TileNameCode.SANDSTONE_WHITE
|
||||
, TileNameCode.SANDSTONE_GREEN
|
||||
, TileNameCode.DAYLIGHT_CAPACITOR
|
||||
Tile.ICE_MAGICAL
|
||||
, Tile.GLASS_CRUDE
|
||||
, Tile.GLASS_CLEAN
|
||||
, Tile.ILLUMINATOR_BLACK
|
||||
, Tile.ILLUMINATOR_BLUE
|
||||
, Tile.ILLUMINATOR_BROWN
|
||||
, Tile.ILLUMINATOR_CYAN
|
||||
, Tile.ILLUMINATOR_FUCHSIA
|
||||
, Tile.ILLUMINATOR_GREEN
|
||||
, Tile.ILLUMINATOR_GREEN_DARK
|
||||
, Tile.ILLUMINATOR_GREY_DARK
|
||||
, Tile.ILLUMINATOR_GREY_LIGHT
|
||||
, Tile.ILLUMINATOR_GREY_MED
|
||||
, Tile.ILLUMINATOR_ORANGE
|
||||
, Tile.ILLUMINATOR_PURPLE
|
||||
, Tile.ILLUMINATOR_RED
|
||||
, Tile.ILLUMINATOR_TAN
|
||||
, Tile.ILLUMINATOR_WHITE
|
||||
, Tile.ILLUMINATOR_YELLOW
|
||||
, Tile.ILLUMINATOR_BLACK_OFF
|
||||
, Tile.ILLUMINATOR_BLUE_OFF
|
||||
, Tile.ILLUMINATOR_BROWN_OFF
|
||||
, Tile.ILLUMINATOR_CYAN_OFF
|
||||
, Tile.ILLUMINATOR_FUCHSIA_OFF
|
||||
, Tile.ILLUMINATOR_GREEN_OFF
|
||||
, Tile.ILLUMINATOR_GREEN_DARK_OFF
|
||||
, Tile.ILLUMINATOR_GREY_DARK_OFF
|
||||
, Tile.ILLUMINATOR_GREY_LIGHT_OFF
|
||||
, Tile.ILLUMINATOR_GREY_MED_OFF
|
||||
, Tile.ILLUMINATOR_ORANGE_OFF
|
||||
, Tile.ILLUMINATOR_PURPLE_OFF
|
||||
, Tile.ILLUMINATOR_RED_OFF
|
||||
, Tile.ILLUMINATOR_TAN_OFF
|
||||
, Tile.ILLUMINATOR_WHITE_OFF
|
||||
, Tile.ILLUMINATOR_YELLOW
|
||||
, Tile.SANDSTONE
|
||||
, Tile.SANDSTONE_BLACK
|
||||
, Tile.SANDSTONE_DESERT
|
||||
, Tile.SANDSTONE_RED
|
||||
, Tile.SANDSTONE_WHITE
|
||||
, Tile.SANDSTONE_GREEN
|
||||
, Tile.DAYLIGHT_CAPACITOR
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -112,75 +112,75 @@ object MapCamera {
|
||||
* It holds different shading rule to discriminate with group 01, index 0 is middle tile.
|
||||
*/
|
||||
val TILES_CONNECT_MUTUAL = arrayOf(
|
||||
TileNameCode.STONE
|
||||
, TileNameCode.STONE_QUARRIED
|
||||
, TileNameCode.STONE_TILE_WHITE
|
||||
, TileNameCode.STONE_BRICKS
|
||||
, TileNameCode.DIRT
|
||||
, TileNameCode.GRASS
|
||||
, TileNameCode.PLANK_BIRCH
|
||||
, TileNameCode.PLANK_BLOODROSE
|
||||
, TileNameCode.PLANK_EBONY
|
||||
, TileNameCode.PLANK_NORMAL
|
||||
, TileNameCode.SAND
|
||||
, TileNameCode.SAND_WHITE
|
||||
, TileNameCode.SAND_RED
|
||||
, TileNameCode.SAND_DESERT
|
||||
, TileNameCode.SAND_BLACK
|
||||
, TileNameCode.SAND_GREEN
|
||||
, TileNameCode.GRAVEL
|
||||
, TileNameCode.GRAVEL_GREY
|
||||
, TileNameCode.SNOW
|
||||
, TileNameCode.ICE_NATURAL
|
||||
, TileNameCode.ORE_COPPER
|
||||
, TileNameCode.ORE_IRON
|
||||
, TileNameCode.ORE_GOLD
|
||||
, TileNameCode.ORE_SILVER
|
||||
, TileNameCode.ORE_ILMENITE
|
||||
, TileNameCode.ORE_AURICHALCUM
|
||||
Tile.STONE
|
||||
, Tile.STONE_QUARRIED
|
||||
, Tile.STONE_TILE_WHITE
|
||||
, Tile.STONE_BRICKS
|
||||
, Tile.DIRT
|
||||
, Tile.GRASS
|
||||
, Tile.PLANK_BIRCH
|
||||
, Tile.PLANK_BLOODROSE
|
||||
, Tile.PLANK_EBONY
|
||||
, Tile.PLANK_NORMAL
|
||||
, Tile.SAND
|
||||
, Tile.SAND_WHITE
|
||||
, Tile.SAND_RED
|
||||
, Tile.SAND_DESERT
|
||||
, Tile.SAND_BLACK
|
||||
, Tile.SAND_GREEN
|
||||
, Tile.GRAVEL
|
||||
, Tile.GRAVEL_GREY
|
||||
, Tile.SNOW
|
||||
, Tile.ICE_NATURAL
|
||||
, Tile.ORE_COPPER
|
||||
, Tile.ORE_IRON
|
||||
, Tile.ORE_GOLD
|
||||
, Tile.ORE_SILVER
|
||||
, Tile.ORE_ILMENITE
|
||||
, Tile.ORE_AURICHALCUM
|
||||
|
||||
, TileNameCode.WATER
|
||||
, TileNameCode.WATER_1
|
||||
, TileNameCode.WATER_2
|
||||
, TileNameCode.WATER_3
|
||||
, TileNameCode.WATER_4
|
||||
, TileNameCode.WATER_5
|
||||
, TileNameCode.WATER_6
|
||||
, TileNameCode.WATER_7
|
||||
, TileNameCode.WATER_8
|
||||
, TileNameCode.WATER_9
|
||||
, TileNameCode.WATER_10
|
||||
, TileNameCode.WATER_11
|
||||
, TileNameCode.WATER_12
|
||||
, TileNameCode.WATER_13
|
||||
, TileNameCode.WATER_14
|
||||
, TileNameCode.WATER_15
|
||||
, TileNameCode.LAVA
|
||||
, TileNameCode.LAVA_1
|
||||
, TileNameCode.LAVA_2
|
||||
, TileNameCode.LAVA_3
|
||||
, TileNameCode.LAVA_4
|
||||
, TileNameCode.LAVA_5
|
||||
, TileNameCode.LAVA_6
|
||||
, TileNameCode.LAVA_7
|
||||
, TileNameCode.LAVA_8
|
||||
, TileNameCode.LAVA_9
|
||||
, TileNameCode.LAVA_10
|
||||
, TileNameCode.LAVA_11
|
||||
, TileNameCode.LAVA_12
|
||||
, TileNameCode.LAVA_13
|
||||
, TileNameCode.LAVA_14
|
||||
, TileNameCode.LAVA_15
|
||||
, Tile.WATER
|
||||
, Tile.WATER_1
|
||||
, Tile.WATER_2
|
||||
, Tile.WATER_3
|
||||
, Tile.WATER_4
|
||||
, Tile.WATER_5
|
||||
, Tile.WATER_6
|
||||
, Tile.WATER_7
|
||||
, Tile.WATER_8
|
||||
, Tile.WATER_9
|
||||
, Tile.WATER_10
|
||||
, Tile.WATER_11
|
||||
, Tile.WATER_12
|
||||
, Tile.WATER_13
|
||||
, Tile.WATER_14
|
||||
, Tile.WATER_15
|
||||
, Tile.LAVA
|
||||
, Tile.LAVA_1
|
||||
, Tile.LAVA_2
|
||||
, Tile.LAVA_3
|
||||
, Tile.LAVA_4
|
||||
, Tile.LAVA_5
|
||||
, Tile.LAVA_6
|
||||
, Tile.LAVA_7
|
||||
, Tile.LAVA_8
|
||||
, Tile.LAVA_9
|
||||
, Tile.LAVA_10
|
||||
, Tile.LAVA_11
|
||||
, Tile.LAVA_12
|
||||
, Tile.LAVA_13
|
||||
, Tile.LAVA_14
|
||||
, Tile.LAVA_15
|
||||
)
|
||||
|
||||
/**
|
||||
* Torches, levers, switches, ...
|
||||
*/
|
||||
val TILES_WALL_STICKER = arrayOf(
|
||||
TileNameCode.TORCH
|
||||
, TileNameCode.TORCH_FROST
|
||||
, TileNameCode.TORCH_OFF
|
||||
, TileNameCode.TORCH_FROST_OFF
|
||||
Tile.TORCH
|
||||
, Tile.TORCH_FROST
|
||||
, Tile.TORCH_OFF
|
||||
, Tile.TORCH_FROST_OFF
|
||||
)
|
||||
|
||||
/**
|
||||
@@ -196,38 +196,38 @@ object MapCamera {
|
||||
* i.e. red hues get lost if you dive into the water
|
||||
*/
|
||||
val TILES_BLEND_MUL = arrayOf(
|
||||
TileNameCode.WATER
|
||||
, TileNameCode.WATER_1
|
||||
, TileNameCode.WATER_2
|
||||
, TileNameCode.WATER_3
|
||||
, TileNameCode.WATER_4
|
||||
, TileNameCode.WATER_5
|
||||
, TileNameCode.WATER_6
|
||||
, TileNameCode.WATER_7
|
||||
, TileNameCode.WATER_8
|
||||
, TileNameCode.WATER_9
|
||||
, TileNameCode.WATER_10
|
||||
, TileNameCode.WATER_11
|
||||
, TileNameCode.WATER_12
|
||||
, TileNameCode.WATER_13
|
||||
, TileNameCode.WATER_14
|
||||
, TileNameCode.WATER_15
|
||||
, TileNameCode.LAVA
|
||||
, TileNameCode.LAVA_1
|
||||
, TileNameCode.LAVA_2
|
||||
, TileNameCode.LAVA_3
|
||||
, TileNameCode.LAVA_4
|
||||
, TileNameCode.LAVA_5
|
||||
, TileNameCode.LAVA_6
|
||||
, TileNameCode.LAVA_7
|
||||
, TileNameCode.LAVA_8
|
||||
, TileNameCode.LAVA_9
|
||||
, TileNameCode.LAVA_10
|
||||
, TileNameCode.LAVA_11
|
||||
, TileNameCode.LAVA_12
|
||||
, TileNameCode.LAVA_13
|
||||
, TileNameCode.LAVA_14
|
||||
, TileNameCode.LAVA_15
|
||||
Tile.WATER
|
||||
, Tile.WATER_1
|
||||
, Tile.WATER_2
|
||||
, Tile.WATER_3
|
||||
, Tile.WATER_4
|
||||
, Tile.WATER_5
|
||||
, Tile.WATER_6
|
||||
, Tile.WATER_7
|
||||
, Tile.WATER_8
|
||||
, Tile.WATER_9
|
||||
, Tile.WATER_10
|
||||
, Tile.WATER_11
|
||||
, Tile.WATER_12
|
||||
, Tile.WATER_13
|
||||
, Tile.WATER_14
|
||||
, Tile.WATER_15
|
||||
, Tile.LAVA
|
||||
, Tile.LAVA_1
|
||||
, Tile.LAVA_2
|
||||
, Tile.LAVA_3
|
||||
, Tile.LAVA_4
|
||||
, Tile.LAVA_5
|
||||
, Tile.LAVA_6
|
||||
, Tile.LAVA_7
|
||||
, Tile.LAVA_8
|
||||
, Tile.LAVA_9
|
||||
, Tile.LAVA_10
|
||||
, Tile.LAVA_11
|
||||
, Tile.LAVA_12
|
||||
, Tile.LAVA_13
|
||||
, Tile.LAVA_14
|
||||
, Tile.LAVA_15
|
||||
)
|
||||
|
||||
fun update(gc: GameContainer, delta_t: Int) {
|
||||
@@ -387,8 +387,8 @@ object MapCamera {
|
||||
var ret = 0
|
||||
for (i in 0..3) {
|
||||
try {
|
||||
if (!TilePropCodex[nearbyTiles[i]].isSolid &&
|
||||
!TilePropCodex[nearbyTiles[i]].isFluid) {
|
||||
if (!TileCodex[nearbyTiles[i]].isSolid &&
|
||||
!TileCodex[nearbyTiles[i]].isFluid) {
|
||||
ret += (1 shl i) // add 1, 2, 4, 8 for i = 0, 1, 2, 3
|
||||
}
|
||||
} catch (e: ArrayIndexOutOfBoundsException) {
|
||||
@@ -408,26 +408,26 @@ object MapCamera {
|
||||
nearbyTiles[NEARBY_TILE_KEY_BACK] = WORLD.getTileFrom(WALL, x , y) ?: 4096
|
||||
|
||||
try {
|
||||
if (TilePropCodex[nearbyTiles[NEARBY_TILE_KEY_DOWN]].isSolid)
|
||||
if (TileCodex[nearbyTiles[NEARBY_TILE_KEY_DOWN]].isSolid)
|
||||
// has tile on the bottom
|
||||
return 3
|
||||
else if (TilePropCodex[nearbyTiles[NEARBY_TILE_KEY_RIGHT]].isSolid
|
||||
&& TilePropCodex[nearbyTiles[NEARBY_TILE_KEY_LEFT]].isSolid)
|
||||
else if (TileCodex[nearbyTiles[NEARBY_TILE_KEY_RIGHT]].isSolid
|
||||
&& TileCodex[nearbyTiles[NEARBY_TILE_KEY_LEFT]].isSolid)
|
||||
// has tile on both sides
|
||||
return 0
|
||||
else if (TilePropCodex[nearbyTiles[NEARBY_TILE_KEY_RIGHT]].isSolid)
|
||||
else if (TileCodex[nearbyTiles[NEARBY_TILE_KEY_RIGHT]].isSolid)
|
||||
// has tile on the right
|
||||
return 2
|
||||
else if (TilePropCodex[nearbyTiles[NEARBY_TILE_KEY_LEFT]].isSolid)
|
||||
else if (TileCodex[nearbyTiles[NEARBY_TILE_KEY_LEFT]].isSolid)
|
||||
// has tile on the left
|
||||
return 1
|
||||
else if (TilePropCodex[nearbyTiles[NEARBY_TILE_KEY_BACK]].isSolid)
|
||||
else if (TileCodex[nearbyTiles[NEARBY_TILE_KEY_BACK]].isSolid)
|
||||
// has tile on the back
|
||||
return 0
|
||||
else
|
||||
return 3
|
||||
} catch (e: ArrayIndexOutOfBoundsException) {
|
||||
return if (TilePropCodex[nearbyTiles[NEARBY_TILE_KEY_DOWN]].isSolid)
|
||||
return if (TileCodex[nearbyTiles[NEARBY_TILE_KEY_DOWN]].isSolid)
|
||||
// has tile on the bottom
|
||||
3 else 0
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.mapdrawer
|
||||
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.tileproperties.TileNameCode
|
||||
import net.torvald.terrarum.tileproperties.Tile
|
||||
import net.torvald.terrarum.tilestats.TileStats
|
||||
import com.jme3.math.FastMath
|
||||
import net.torvald.colourutil.ColourTemp
|
||||
@@ -23,14 +23,14 @@ object MapDrawer {
|
||||
private set
|
||||
|
||||
private val TILES_COLD = intArrayOf(
|
||||
TileNameCode.ICE_MAGICAL
|
||||
, TileNameCode.ICE_FRAGILE
|
||||
, TileNameCode.ICE_NATURAL
|
||||
, TileNameCode.SNOW)
|
||||
Tile.ICE_MAGICAL
|
||||
, Tile.ICE_FRAGILE
|
||||
, Tile.ICE_NATURAL
|
||||
, Tile.SNOW)
|
||||
|
||||
private val TILES_WARM = intArrayOf(
|
||||
TileNameCode.SAND_DESERT
|
||||
, TileNameCode.SAND_RED)
|
||||
Tile.SAND_DESERT
|
||||
, Tile.SAND_RED)
|
||||
|
||||
fun update(gc: GameContainer, delta_t: Int) {
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package net.torvald.terrarum.mapgenerator
|
||||
|
||||
import net.torvald.random.HQRNG
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.tileproperties.TileNameCode
|
||||
import net.torvald.terrarum.tileproperties.Tile
|
||||
import com.jme3.math.FastMath
|
||||
import com.sudoplay.joise.Joise
|
||||
import com.sudoplay.joise.module.*
|
||||
@@ -112,32 +112,32 @@ object WorldGenerator {
|
||||
*/
|
||||
|
||||
//val noiseArray = arrayOf(
|
||||
// TaggedJoise("Carving caves", noiseRidged(1.7f, 1.4f), 1f, TILE_MACRO_ALL, TILE_MACRO_ALL, TileNameCode.AIR, NoiseFilterSqrt, CAVEGEN_THRE_START, CAVEGEN_THRE_END)
|
||||
//, TaggedJoise("Collapsing caves", noiseBlobs(0.5f, 0.5f), 0.3f, TileNameCode.AIR, TileNameCode.STONE, TileNameCode.STONE, NoiseFilterUniform)
|
||||
// TaggedJoise("Carving caves", noiseRidged(1.7f, 1.4f), 1f, TILE_MACRO_ALL, TILE_MACRO_ALL, Tile.AIR, NoiseFilterSqrt, CAVEGEN_THRE_START, CAVEGEN_THRE_END)
|
||||
//, TaggedJoise("Collapsing caves", noiseBlobs(0.5f, 0.5f), 0.3f, Tile.AIR, Tile.STONE, Tile.STONE, NoiseFilterUniform)
|
||||
//
|
||||
//, TaggedJoise("Putting stone patches on the ground", noiseBlobs(0.8f, 0.8f), 1.02f, intArrayOf(TileNameCode.DIRT, TileNameCode.GRASS), TileNameCode.DIRT, TileNameCode.STONE, NoiseFilterQuadratic, NOISE_GRAD_END, NOISE_GRAD_START)
|
||||
//, TaggedJoise("Placing dirt spots in the cave", noiseBlobs(0.5f, 0.5f), 0.98f, TileNameCode.STONE, TileNameCode.STONE, TileNameCode.DIRT, NoiseFilterQuadratic, NOISE_GRAD_END, NOISE_GRAD_START)
|
||||
//, TaggedJoise("Quarrying some stone into gravels", noiseBlobs(0.5f, 0.5f), 0.98f, TileNameCode.STONE, TileNameCode.STONE, TileNameCode.GRAVEL, NoiseFilterQuadratic, NOISE_GRAD_END, NOISE_GRAD_START)
|
||||
//, TaggedJoise("Putting stone patches on the ground", noiseBlobs(0.8f, 0.8f), 1.02f, intArrayOf(Tile.DIRT, Tile.GRASS), Tile.DIRT, Tile.STONE, NoiseFilterQuadratic, NOISE_GRAD_END, NOISE_GRAD_START)
|
||||
//, TaggedJoise("Placing dirt spots in the cave", noiseBlobs(0.5f, 0.5f), 0.98f, Tile.STONE, Tile.STONE, Tile.DIRT, NoiseFilterQuadratic, NOISE_GRAD_END, NOISE_GRAD_START)
|
||||
//, TaggedJoise("Quarrying some stone into gravels", noiseBlobs(0.5f, 0.5f), 0.98f, Tile.STONE, Tile.STONE, Tile.GRAVEL, NoiseFilterQuadratic, NOISE_GRAD_END, NOISE_GRAD_START)
|
||||
//
|
||||
//, TaggedJoise("Growing copper veins", noiseRidged(1.7f, 1.7f), 1.68f, TileNameCode.STONE, TileNameCode.STONE, TileNameCode.ORE_COPPER)
|
||||
//, TaggedJoise("Cutting copper veins", noiseBlobs(0.4f, 0.4f), 0.26f, TileNameCode.ORE_COPPER, TileNameCode.STONE, TileNameCode.STONE)
|
||||
//, TaggedJoise("Growing copper veins", noiseRidged(1.7f, 1.7f), 1.68f, Tile.STONE, Tile.STONE, Tile.ORE_COPPER)
|
||||
//, TaggedJoise("Cutting copper veins", noiseBlobs(0.4f, 0.4f), 0.26f, Tile.ORE_COPPER, Tile.STONE, Tile.STONE)
|
||||
//
|
||||
//, TaggedJoise("Growing iron veins", noiseRidged(1.7f, 1.7f), 1.68f, TileNameCode.STONE, TileNameCode.STONE, TileNameCode.ORE_IRON)
|
||||
//, TaggedJoise("Cutting iron veins", noiseBlobs(0.7f, 0.7f), 0.26f, TileNameCode.ORE_IRON, TileNameCode.STONE, TileNameCode.STONE)
|
||||
//, TaggedJoise("Growing iron veins", noiseRidged(1.7f, 1.7f), 1.68f, Tile.STONE, Tile.STONE, Tile.ORE_IRON)
|
||||
//, TaggedJoise("Cutting iron veins", noiseBlobs(0.7f, 0.7f), 0.26f, Tile.ORE_IRON, Tile.STONE, Tile.STONE)
|
||||
//
|
||||
//, TaggedJoise("Growing silver veins", noiseRidged(1.7f, 1.7f), 1.71f, TileNameCode.STONE, TileNameCode.STONE, TileNameCode.ORE_SILVER)
|
||||
//, TaggedJoise("Cutting silver veins", noiseBlobs(0.7f, 0.7f), 0.26f, TileNameCode.ORE_SILVER, TileNameCode.STONE, TileNameCode.STONE)
|
||||
//, TaggedJoise("Growing silver veins", noiseRidged(1.7f, 1.7f), 1.71f, Tile.STONE, Tile.STONE, Tile.ORE_SILVER)
|
||||
//, TaggedJoise("Cutting silver veins", noiseBlobs(0.7f, 0.7f), 0.26f, Tile.ORE_SILVER, Tile.STONE, Tile.STONE)
|
||||
//
|
||||
//, TaggedJoise("Growing gold veins", noiseRidged(1.7f, 1.7f), 1.73f, TileNameCode.STONE, TileNameCode.STONE, TileNameCode.ORE_GOLD)
|
||||
//, TaggedJoise("Cutting gold veins", noiseBlobs(0.7f, 0.7f), 0.26f, TileNameCode.ORE_GOLD, TileNameCode.STONE, TileNameCode.STONE)
|
||||
//, TaggedJoise("Growing gold veins", noiseRidged(1.7f, 1.7f), 1.73f, Tile.STONE, Tile.STONE, Tile.ORE_GOLD)
|
||||
//, TaggedJoise("Cutting gold veins", noiseBlobs(0.7f, 0.7f), 0.26f, Tile.ORE_GOLD, Tile.STONE, Tile.STONE)
|
||||
// // FIXME gem clusters are too large
|
||||
//, TaggedJoise("Growing topaz clusters", noiseBlobs(0.9f, 0.9f), 2f, TileNameCode.STONE, TileNameCode.STONE, TileNameCode.RAW_TOPAZ)
|
||||
//, TaggedJoise("Growing aluminium oxide clusters", noiseBlobs(0.9f, 0.9f), 1.7f, TileNameCode.STONE, TileNameCode.STONE, intArrayOf(TileNameCode.RAW_RUBY, TileNameCode.RAW_SAPPHIRE))
|
||||
//, TaggedJoise("Growing emerald clusters", noiseBlobs(0.9f, 0.9f), 1.7f, TileNameCode.STONE, TileNameCode.STONE, TileNameCode.RAW_EMERALD)
|
||||
//, TaggedJoise("Growing hearts of white", noiseBlobs(0.9f, 0.9f), 1.83f, TileNameCode.STONE, TileNameCode.STONE, TileNameCode.RAW_DIAMOND)
|
||||
//, TaggedJoise("Growing hearts of violet", noiseRidged(2.5f, 2.5f), 1.75f, TileNameCode.STONE, TileNameCode.STONE, TileNameCode.RAW_AMETHYST)
|
||||
//, TaggedJoise("Growing topaz clusters", noiseBlobs(0.9f, 0.9f), 2f, Tile.STONE, Tile.STONE, Tile.RAW_TOPAZ)
|
||||
//, TaggedJoise("Growing aluminium oxide clusters", noiseBlobs(0.9f, 0.9f), 1.7f, Tile.STONE, Tile.STONE, intArrayOf(Tile.RAW_RUBY, Tile.RAW_SAPPHIRE))
|
||||
//, TaggedJoise("Growing emerald clusters", noiseBlobs(0.9f, 0.9f), 1.7f, Tile.STONE, Tile.STONE, Tile.RAW_EMERALD)
|
||||
//, TaggedJoise("Growing hearts of white", noiseBlobs(0.9f, 0.9f), 1.83f, Tile.STONE, Tile.STONE, Tile.RAW_DIAMOND)
|
||||
//, TaggedJoise("Growing hearts of violet", noiseRidged(2.5f, 2.5f), 1.75f, Tile.STONE, Tile.STONE, Tile.RAW_AMETHYST)
|
||||
//
|
||||
//, TaggedJoise("Cutting over-grown hearts", noiseBlobs(0.7f, 0.7f), 0.17f, TileNameCode.RAW_AMETHYST, TileNameCode.STONE, TileNameCode.STONE)
|
||||
//, TaggedJoise("Cutting over-grown hearts", noiseBlobs(0.7f, 0.7f), 0.17f, Tile.RAW_AMETHYST, Tile.STONE, Tile.STONE)
|
||||
//)
|
||||
//processNoiseLayers(noiseArray)
|
||||
|
||||
@@ -489,11 +489,11 @@ object WorldGenerator {
|
||||
for (i in 0..HEIGHT - pillarOffset - 1) {
|
||||
|
||||
if (i < DIRT_LAYER_DEPTH) {
|
||||
world.setTileTerrain(x, i + pillarOffset, TileNameCode.DIRT)
|
||||
world.setTileWall(x, i + pillarOffset, TileNameCode.DIRT)
|
||||
world.setTileTerrain(x, i + pillarOffset, Tile.DIRT)
|
||||
world.setTileWall(x, i + pillarOffset, Tile.DIRT)
|
||||
} else {
|
||||
world.setTileTerrain(x, i + pillarOffset, TileNameCode.STONE)
|
||||
world.setTileWall(x, i + pillarOffset, TileNameCode.STONE)
|
||||
world.setTileTerrain(x, i + pillarOffset, Tile.STONE)
|
||||
world.setTileWall(x, i + pillarOffset, Tile.STONE)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -558,11 +558,11 @@ object WorldGenerator {
|
||||
for (x in 0..WIDTH - 1) {
|
||||
for (y in 0..HEIGHT - 1) {
|
||||
if (terrainMap[clamp(y + DIRT_LAYER_DEPTH, 0, HEIGHT - 1)].get(x)) {
|
||||
// map.setTileTerrain(x, y, TileNameCode.DIRT)
|
||||
// map.setTileWall(x, y, TileNameCode.DIRT)
|
||||
// map.setTileTerrain(x, y, Tile.DIRT)
|
||||
// map.setTileWall(x, y, Tile.DIRT)
|
||||
val tile =
|
||||
if (y < dirtStoneLine[x]) TileNameCode.DIRT
|
||||
else TileNameCode.STONE
|
||||
if (y < dirtStoneLine[x]) Tile.DIRT
|
||||
else Tile.STONE
|
||||
world.setTileTerrain(x, y, tile)
|
||||
world.setTileWall(x, y, tile)
|
||||
}
|
||||
@@ -729,7 +729,7 @@ object WorldGenerator {
|
||||
val nIslands = random.nextInt(nIslandsMax - nIslandsMin) + nIslandsMin
|
||||
val prevIndex = -1
|
||||
|
||||
val tiles = intArrayOf(TileNameCode.AIR, TileNameCode.STONE, TileNameCode.DIRT, TileNameCode.GRASS)
|
||||
val tiles = intArrayOf(Tile.AIR, Tile.STONE, Tile.DIRT, Tile.GRASS)
|
||||
|
||||
for (i in 0..nIslands - 1) {
|
||||
var currentIndex = random.nextInt(FloatingIslandsPreset.PRESETS)
|
||||
@@ -758,7 +758,7 @@ object WorldGenerator {
|
||||
for (i in HEIGHT * 14 / 15..HEIGHT - 1) {
|
||||
for (j in 0..WIDTH - 1) {
|
||||
if (world.terrainArray[i][j].toInt() == 0) {
|
||||
world.setTileTerrain(j, i, TileNameCode.LAVA)
|
||||
world.setTileTerrain(j, i, Tile.LAVA)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -786,8 +786,8 @@ object WorldGenerator {
|
||||
|
||||
if (nearbyWallTile == null) break;
|
||||
|
||||
if (i != 4 && thisTile == TileNameCode.DIRT && nearbyWallTile == TileNameCode.AIR) {
|
||||
world.setTileTerrain(x, y, TileNameCode.GRASS)
|
||||
if (i != 4 && thisTile == Tile.DIRT && nearbyWallTile == Tile.AIR) {
|
||||
world.setTileTerrain(x, y, Tile.GRASS)
|
||||
break
|
||||
}
|
||||
}
|
||||
@@ -797,7 +797,7 @@ object WorldGenerator {
|
||||
}
|
||||
|
||||
private fun isGrassOrDirt(x: Int, y: Int): Boolean {
|
||||
return world.getTileFromTerrain(x, y) == TileNameCode.GRASS || world.getTileFromTerrain(x, y) == TileNameCode.DIRT
|
||||
return world.getTileFromTerrain(x, y) == Tile.GRASS || world.getTileFromTerrain(x, y) == Tile.DIRT
|
||||
}
|
||||
|
||||
private fun replaceIfTerrain(ifTileRaw: Int, x: Int, y: Int, replaceTileRaw: Int) {
|
||||
@@ -816,19 +816,19 @@ object WorldGenerator {
|
||||
|
||||
private fun fillOcean() {
|
||||
val thisSandList = intArrayOf(
|
||||
TileNameCode.SAND, TileNameCode.SAND, TileNameCode.SAND, TileNameCode.SAND,
|
||||
TileNameCode.SAND_WHITE, TileNameCode.SAND_WHITE, TileNameCode.SAND_WHITE,
|
||||
TileNameCode.SAND_BLACK, TileNameCode.SAND_BLACK, TileNameCode.SAND_GREEN
|
||||
Tile.SAND, Tile.SAND, Tile.SAND, Tile.SAND,
|
||||
Tile.SAND_WHITE, Tile.SAND_WHITE, Tile.SAND_WHITE,
|
||||
Tile.SAND_BLACK, Tile.SAND_BLACK, Tile.SAND_GREEN
|
||||
)
|
||||
val thisRand = HQRNG(SEED xor random.nextLong())
|
||||
val thisSand = thisSandList[thisRand.nextInt(thisSandList.size)]
|
||||
// val thisSand = TileNameCode.SAND_GREEN
|
||||
// val thisSand = Tile.SAND_GREEN
|
||||
|
||||
val thisSandStr = if (thisSand == TileNameCode.SAND_BLACK)
|
||||
val thisSandStr = if (thisSand == Tile.SAND_BLACK)
|
||||
"black"
|
||||
else if (thisSand == TileNameCode.SAND_GREEN)
|
||||
else if (thisSand == Tile.SAND_GREEN)
|
||||
"green"
|
||||
else if (thisSand == TileNameCode.SAND)
|
||||
else if (thisSand == Tile.SAND)
|
||||
"yellow"
|
||||
else
|
||||
"white"
|
||||
@@ -840,11 +840,11 @@ object WorldGenerator {
|
||||
if (ix < OCEAN_WIDTH) {
|
||||
if (worldOceanPosition == TYPE_OCEAN_LEFT) {
|
||||
for (y in getTerrainHeightFromHeightMap(OCEAN_WIDTH)..getTerrainHeightFromHeightMap(ix) - 1) {
|
||||
world.setTileTerrain(ix, y, TileNameCode.WATER)
|
||||
world.setTileTerrain(ix, y, Tile.WATER)
|
||||
}
|
||||
} else if (worldOceanPosition == TYPE_OCEAN_RIGHT) {
|
||||
for (y in getTerrainHeightFromHeightMap(world.width - 1 - OCEAN_WIDTH)..getTerrainHeightFromHeightMap(world.width - 1 - ix) - 1) {
|
||||
world.setTileTerrain(world.width - 1 - ix, y, TileNameCode.WATER)
|
||||
world.setTileTerrain(world.width - 1 - ix, y, Tile.WATER)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -874,17 +874,17 @@ object WorldGenerator {
|
||||
for (y in 0..world.height - 1 - 1) {
|
||||
for (x in 0..getFrozenAreaWidth(y) - 1) {
|
||||
if (worldOceanPosition == TYPE_OCEAN_RIGHT) {
|
||||
replaceIfTerrain(TileNameCode.DIRT, x, y, TileNameCode.SNOW)
|
||||
replaceIfTerrain(TileNameCode.STONE, x, y, TileNameCode.ICE_NATURAL)
|
||||
replaceIfTerrain(Tile.DIRT, x, y, Tile.SNOW)
|
||||
replaceIfTerrain(Tile.STONE, x, y, Tile.ICE_NATURAL)
|
||||
|
||||
replaceIfWall(TileNameCode.DIRT, x, y, TileNameCode.SNOW)
|
||||
replaceIfWall(TileNameCode.STONE, x, y, TileNameCode.ICE_NATURAL)
|
||||
replaceIfWall(Tile.DIRT, x, y, Tile.SNOW)
|
||||
replaceIfWall(Tile.STONE, x, y, Tile.ICE_NATURAL)
|
||||
} else {
|
||||
replaceIfTerrain(TileNameCode.DIRT, world.width - 1 - x, y, TileNameCode.SNOW)
|
||||
replaceIfTerrain(TileNameCode.STONE, world.width - 1 - x, y, TileNameCode.ICE_NATURAL)
|
||||
replaceIfTerrain(Tile.DIRT, world.width - 1 - x, y, Tile.SNOW)
|
||||
replaceIfTerrain(Tile.STONE, world.width - 1 - x, y, Tile.ICE_NATURAL)
|
||||
|
||||
replaceIfWall(TileNameCode.DIRT, world.width - 1 - x, y, TileNameCode.SNOW)
|
||||
replaceIfWall(TileNameCode.STONE, world.width - 1 - x, y, TileNameCode.ICE_NATURAL)
|
||||
replaceIfWall(Tile.DIRT, world.width - 1 - x, y, Tile.SNOW)
|
||||
replaceIfWall(Tile.STONE, world.width - 1 - x, y, Tile.ICE_NATURAL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
154
src/net/torvald/terrarum/tileproperties/Tile.kt
Normal file
154
src/net/torvald/terrarum/tileproperties/Tile.kt
Normal file
@@ -0,0 +1,154 @@
|
||||
package net.torvald.terrarum.tileproperties
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-02-21.
|
||||
*/
|
||||
object Tile {
|
||||
|
||||
val AIR = 0
|
||||
|
||||
val STONE = TileCodex.idDamageToIndex(1, 0)
|
||||
val STONE_QUARRIED = TileCodex.idDamageToIndex(1, 1)
|
||||
val STONE_TILE_WHITE = TileCodex.idDamageToIndex(1, 2)
|
||||
val STONE_BRICKS = TileCodex.idDamageToIndex(1, 3)
|
||||
|
||||
val DIRT = TileCodex.idDamageToIndex(2, 0)
|
||||
val GRASS = TileCodex.idDamageToIndex(2, 1)
|
||||
|
||||
val PLANK_NORMAL = TileCodex.idDamageToIndex(3, 0)
|
||||
val PLANK_EBONY = TileCodex.idDamageToIndex(3, 1)
|
||||
val PLANK_BIRCH = TileCodex.idDamageToIndex(3, 2)
|
||||
val PLANK_BLOODROSE = TileCodex.idDamageToIndex(3, 3)
|
||||
|
||||
val TRUNK_NORMAL = TileCodex.idDamageToIndex(4, 0)
|
||||
val TRUNK_EBONY = TileCodex.idDamageToIndex(4, 1)
|
||||
val TRUNK_BIRCH = TileCodex.idDamageToIndex(4, 2)
|
||||
val TRUNK_BLOODROSE = TileCodex.idDamageToIndex(4, 3)
|
||||
|
||||
val SAND = TileCodex.idDamageToIndex(5, 0)
|
||||
val SAND_WHITE = TileCodex.idDamageToIndex(5, 1)
|
||||
val SAND_RED = TileCodex.idDamageToIndex(5, 2)
|
||||
val SAND_DESERT = TileCodex.idDamageToIndex(5, 3)
|
||||
val SAND_BLACK = TileCodex.idDamageToIndex(5, 4)
|
||||
val SAND_GREEN = TileCodex.idDamageToIndex(5, 5)
|
||||
|
||||
val GRAVEL = TileCodex.idDamageToIndex(6, 0)
|
||||
val GRAVEL_GREY = TileCodex.idDamageToIndex(6, 1)
|
||||
|
||||
val ORE_COPPER = TileCodex.idDamageToIndex(7, 0)
|
||||
val ORE_IRON = TileCodex.idDamageToIndex(7, 1)
|
||||
val ORE_GOLD = TileCodex.idDamageToIndex(7, 2)
|
||||
val ORE_SILVER = TileCodex.idDamageToIndex(7, 3)
|
||||
val ORE_ILMENITE = TileCodex.idDamageToIndex(7, 4)
|
||||
val ORE_AURICHALCUM = TileCodex.idDamageToIndex(7, 5)
|
||||
|
||||
val RAW_RUBY = TileCodex.idDamageToIndex(8, 0)
|
||||
val RAW_EMERALD = TileCodex.idDamageToIndex(8, 1)
|
||||
val RAW_SAPPHIRE = TileCodex.idDamageToIndex(8, 2)
|
||||
val RAW_TOPAZ = TileCodex.idDamageToIndex(8, 3)
|
||||
val RAW_DIAMOND = TileCodex.idDamageToIndex(8, 4)
|
||||
val RAW_AMETHYST = TileCodex.idDamageToIndex(8, 5)
|
||||
|
||||
val SNOW = TileCodex.idDamageToIndex(9, 0)
|
||||
val ICE_FRAGILE = TileCodex.idDamageToIndex(9, 1)
|
||||
val ICE_NATURAL = TileCodex.idDamageToIndex(9, 2)
|
||||
val ICE_MAGICAL = TileCodex.idDamageToIndex(9, 3)
|
||||
|
||||
val GLASS_CRUDE = TileCodex.idDamageToIndex(9, 4)
|
||||
val GLASS_CLEAN = TileCodex.idDamageToIndex(9, 5)
|
||||
|
||||
val PLATFORM_STONE = TileCodex.idDamageToIndex(10, 0)
|
||||
val PLATFORM_WOODEN = TileCodex.idDamageToIndex(10, 1)
|
||||
val PLATFORM_EBONY = TileCodex.idDamageToIndex(10, 2)
|
||||
val PLATFORM_BIRCH = TileCodex.idDamageToIndex(10, 3)
|
||||
val PLATFORM_BLOODROSE = TileCodex.idDamageToIndex(10, 4)
|
||||
|
||||
val TORCH = TileCodex.idDamageToIndex(11, 0)
|
||||
val TORCH_FROST = TileCodex.idDamageToIndex(11, 1)
|
||||
|
||||
val TORCH_OFF = TileCodex.idDamageToIndex(12, 0)
|
||||
val TORCH_FROST_OFF = TileCodex.idDamageToIndex(12, 1)
|
||||
|
||||
val ILLUMINATOR_WHITE = TileCodex.idDamageToIndex(13, 0)
|
||||
val ILLUMINATOR_YELLOW = TileCodex.idDamageToIndex(13, 1)
|
||||
val ILLUMINATOR_ORANGE = TileCodex.idDamageToIndex(13, 2)
|
||||
val ILLUMINATOR_RED = TileCodex.idDamageToIndex(13, 3)
|
||||
val ILLUMINATOR_FUCHSIA = TileCodex.idDamageToIndex(13, 4)
|
||||
val ILLUMINATOR_PURPLE = TileCodex.idDamageToIndex(13, 5)
|
||||
val ILLUMINATOR_BLUE = TileCodex.idDamageToIndex(13, 6)
|
||||
val ILLUMINATOR_CYAN = TileCodex.idDamageToIndex(13, 7)
|
||||
val ILLUMINATOR_GREEN = TileCodex.idDamageToIndex(13, 8)
|
||||
val ILLUMINATOR_GREEN_DARK = TileCodex.idDamageToIndex(13, 9)
|
||||
val ILLUMINATOR_BROWN = TileCodex.idDamageToIndex(13, 10)
|
||||
val ILLUMINATOR_TAN = TileCodex.idDamageToIndex(13, 11)
|
||||
val ILLUMINATOR_GREY_LIGHT = TileCodex.idDamageToIndex(13, 12)
|
||||
val ILLUMINATOR_GREY_MED = TileCodex.idDamageToIndex(13, 13)
|
||||
val ILLUMINATOR_GREY_DARK = TileCodex.idDamageToIndex(13, 14)
|
||||
val ILLUMINATOR_BLACK = TileCodex.idDamageToIndex(13, 15)
|
||||
|
||||
val ILLUMINATOR_WHITE_OFF = TileCodex.idDamageToIndex(14, 0)
|
||||
val ILLUMINATOR_YELLOW_OFF = TileCodex.idDamageToIndex(14, 1)
|
||||
val ILLUMINATOR_ORANGE_OFF = TileCodex.idDamageToIndex(14, 2)
|
||||
val ILLUMINATOR_RED_OFF = TileCodex.idDamageToIndex(14, 3)
|
||||
val ILLUMINATOR_FUCHSIA_OFF = TileCodex.idDamageToIndex(14, 4)
|
||||
val ILLUMINATOR_PURPLE_OFF = TileCodex.idDamageToIndex(14, 5)
|
||||
val ILLUMINATOR_BLUE_OFF = TileCodex.idDamageToIndex(14, 6)
|
||||
val ILLUMINATOR_CYAN_OFF = TileCodex.idDamageToIndex(14, 7)
|
||||
val ILLUMINATOR_GREEN_OFF = TileCodex.idDamageToIndex(14, 8)
|
||||
val ILLUMINATOR_GREEN_DARK_OFF = TileCodex.idDamageToIndex(14, 9)
|
||||
val ILLUMINATOR_BROWN_OFF = TileCodex.idDamageToIndex(14, 10)
|
||||
val ILLUMINATOR_TAN_OFF = TileCodex.idDamageToIndex(14, 11)
|
||||
val ILLUMINATOR_GREY_LIGHT_OFF = TileCodex.idDamageToIndex(14, 12)
|
||||
val ILLUMINATOR_GREY_MED_OFF = TileCodex.idDamageToIndex(14, 13)
|
||||
val ILLUMINATOR_GREY_DARK_OFF = TileCodex.idDamageToIndex(14, 14)
|
||||
val ILLUMINATOR_BLACK_OFF = TileCodex.idDamageToIndex(14, 15)
|
||||
|
||||
val SANDSTONE = TileCodex.idDamageToIndex(15, 0)
|
||||
val SANDSTONE_WHITE = TileCodex.idDamageToIndex(15, 1)
|
||||
val SANDSTONE_RED = TileCodex.idDamageToIndex(15, 2)
|
||||
val SANDSTONE_DESERT = TileCodex.idDamageToIndex(15, 3)
|
||||
val SANDSTONE_BLACK = TileCodex.idDamageToIndex(15, 4)
|
||||
val SANDSTONE_GREEN = TileCodex.idDamageToIndex(15, 5)
|
||||
|
||||
val LANTERN = TileCodex.idDamageToIndex(16, 0)
|
||||
val SUNSTONE = TileCodex.idDamageToIndex(16, 1)
|
||||
val DAYLIGHT_CAPACITOR = TileCodex.idDamageToIndex(16, 2)
|
||||
|
||||
val WATER_1 = TileCodex.idDamageToIndex(255, 0)
|
||||
val WATER_2 = TileCodex.idDamageToIndex(255, 1)
|
||||
val WATER_3 = TileCodex.idDamageToIndex(255, 2)
|
||||
val WATER_4 = TileCodex.idDamageToIndex(255, 3)
|
||||
val WATER_5 = TileCodex.idDamageToIndex(255, 4)
|
||||
val WATER_6 = TileCodex.idDamageToIndex(255, 5)
|
||||
val WATER_7 = TileCodex.idDamageToIndex(255, 6)
|
||||
val WATER_8 = TileCodex.idDamageToIndex(255, 7)
|
||||
val WATER_9 = TileCodex.idDamageToIndex(255, 8)
|
||||
val WATER_10 = TileCodex.idDamageToIndex(255, 9)
|
||||
val WATER_11 = TileCodex.idDamageToIndex(255, 10)
|
||||
val WATER_12 = TileCodex.idDamageToIndex(255, 11)
|
||||
val WATER_13 = TileCodex.idDamageToIndex(255, 12)
|
||||
val WATER_14 = TileCodex.idDamageToIndex(255, 13)
|
||||
val WATER_15 = TileCodex.idDamageToIndex(255, 14)
|
||||
val WATER = TileCodex.idDamageToIndex(255, 15)
|
||||
|
||||
val LAVA_1 = TileCodex.idDamageToIndex(254, 0)
|
||||
val LAVA_2 = TileCodex.idDamageToIndex(254, 1)
|
||||
val LAVA_3 = TileCodex.idDamageToIndex(254, 2)
|
||||
val LAVA_4 = TileCodex.idDamageToIndex(254, 3)
|
||||
val LAVA_5 = TileCodex.idDamageToIndex(254, 4)
|
||||
val LAVA_6 = TileCodex.idDamageToIndex(254, 5)
|
||||
val LAVA_7 = TileCodex.idDamageToIndex(254, 6)
|
||||
val LAVA_8 = TileCodex.idDamageToIndex(254, 7)
|
||||
val LAVA_9 = TileCodex.idDamageToIndex(254, 8)
|
||||
val LAVA_10 = TileCodex.idDamageToIndex(254, 9)
|
||||
val LAVA_11 = TileCodex.idDamageToIndex(254, 10)
|
||||
val LAVA_12 = TileCodex.idDamageToIndex(254, 11)
|
||||
val LAVA_13 = TileCodex.idDamageToIndex(254, 12)
|
||||
val LAVA_14 = TileCodex.idDamageToIndex(254, 13)
|
||||
val LAVA_15 = TileCodex.idDamageToIndex(254, 14)
|
||||
val LAVA = TileCodex.idDamageToIndex(254, 15)
|
||||
|
||||
val NULL = 4096
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import java.io.IOException
|
||||
/**
|
||||
* Created by minjaesong on 16-02-16.
|
||||
*/
|
||||
object TilePropCodex {
|
||||
object TileCodex {
|
||||
|
||||
private lateinit var tileProps: Array<TileProp>
|
||||
|
||||
@@ -31,7 +31,7 @@ object TilePropCodex {
|
||||
// todo verify CSV using pre-calculated SHA256 hash
|
||||
val records = CSVFetcher.readFromString(TilePropCSV.text)
|
||||
|
||||
println("[TilePropCodex] Building tile properties table")
|
||||
println("[TileCodex] Building tile properties table")
|
||||
|
||||
records.forEach { setProp(
|
||||
tileProps[idDamageToIndex(intVal(it, "id"), intVal(it, "dmg"))], it)
|
||||
@@ -56,13 +56,13 @@ object TilePropCodex {
|
||||
|
||||
operator fun get(rawIndex: Int?): TileProp {
|
||||
try {
|
||||
tileProps[rawIndex ?: TileNameCode.NULL].id
|
||||
tileProps[rawIndex ?: Tile.NULL].id
|
||||
}
|
||||
catch (e: NullPointerException) {
|
||||
throw NullPointerException("Tile prop with raw id $rawIndex does not exist.")
|
||||
}
|
||||
|
||||
return tileProps[rawIndex ?: TileNameCode.NULL]
|
||||
return tileProps[rawIndex ?: Tile.NULL]
|
||||
}
|
||||
|
||||
private fun setProp(prop: TileProp, record: CSVRecord) {
|
||||
@@ -1,154 +0,0 @@
|
||||
package net.torvald.terrarum.tileproperties
|
||||
|
||||
import net.torvald.terrarum.Terrarum
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 16-02-21.
|
||||
*/
|
||||
object TileNameCode {
|
||||
|
||||
val AIR = 0
|
||||
|
||||
val STONE = TilePropCodex.idDamageToIndex(1, 0)
|
||||
val STONE_QUARRIED = TilePropCodex.idDamageToIndex(1, 1)
|
||||
val STONE_TILE_WHITE = TilePropCodex.idDamageToIndex(1, 2)
|
||||
val STONE_BRICKS = TilePropCodex.idDamageToIndex(1, 3)
|
||||
|
||||
val DIRT = TilePropCodex.idDamageToIndex(2, 0)
|
||||
val GRASS = TilePropCodex.idDamageToIndex(2, 1)
|
||||
|
||||
val PLANK_NORMAL = TilePropCodex.idDamageToIndex(3, 0)
|
||||
val PLANK_EBONY = TilePropCodex.idDamageToIndex(3, 1)
|
||||
val PLANK_BIRCH = TilePropCodex.idDamageToIndex(3, 2)
|
||||
val PLANK_BLOODROSE = TilePropCodex.idDamageToIndex(3, 3)
|
||||
|
||||
val TRUNK_NORMAL = TilePropCodex.idDamageToIndex(4, 0)
|
||||
val TRUNK_EBONY = TilePropCodex.idDamageToIndex(4, 1)
|
||||
val TRUNK_BIRCH = TilePropCodex.idDamageToIndex(4, 2)
|
||||
val TRUNK_BLOODROSE = TilePropCodex.idDamageToIndex(4, 3)
|
||||
|
||||
val SAND = TilePropCodex.idDamageToIndex(5, 0)
|
||||
val SAND_WHITE = TilePropCodex.idDamageToIndex(5, 1)
|
||||
val SAND_RED = TilePropCodex.idDamageToIndex(5, 2)
|
||||
val SAND_DESERT = TilePropCodex.idDamageToIndex(5, 3)
|
||||
val SAND_BLACK = TilePropCodex.idDamageToIndex(5, 4)
|
||||
val SAND_GREEN = TilePropCodex.idDamageToIndex(5, 5)
|
||||
|
||||
val GRAVEL = TilePropCodex.idDamageToIndex(6, 0)
|
||||
val GRAVEL_GREY = TilePropCodex.idDamageToIndex(6, 1)
|
||||
|
||||
val ORE_COPPER = TilePropCodex.idDamageToIndex(7, 0)
|
||||
val ORE_IRON = TilePropCodex.idDamageToIndex(7, 1)
|
||||
val ORE_GOLD = TilePropCodex.idDamageToIndex(7, 2)
|
||||
val ORE_SILVER = TilePropCodex.idDamageToIndex(7, 3)
|
||||
val ORE_ILMENITE = TilePropCodex.idDamageToIndex(7, 4)
|
||||
val ORE_AURICHALCUM = TilePropCodex.idDamageToIndex(7, 5)
|
||||
|
||||
val RAW_RUBY = TilePropCodex.idDamageToIndex(8, 0)
|
||||
val RAW_EMERALD = TilePropCodex.idDamageToIndex(8, 1)
|
||||
val RAW_SAPPHIRE = TilePropCodex.idDamageToIndex(8, 2)
|
||||
val RAW_TOPAZ = TilePropCodex.idDamageToIndex(8, 3)
|
||||
val RAW_DIAMOND = TilePropCodex.idDamageToIndex(8, 4)
|
||||
val RAW_AMETHYST = TilePropCodex.idDamageToIndex(8, 5)
|
||||
|
||||
val SNOW = TilePropCodex.idDamageToIndex(9, 0)
|
||||
val ICE_FRAGILE = TilePropCodex.idDamageToIndex(9, 1)
|
||||
val ICE_NATURAL = TilePropCodex.idDamageToIndex(9, 2)
|
||||
val ICE_MAGICAL = TilePropCodex.idDamageToIndex(9, 3)
|
||||
|
||||
val GLASS_CRUDE = TilePropCodex.idDamageToIndex(9, 4)
|
||||
val GLASS_CLEAN = TilePropCodex.idDamageToIndex(9, 5)
|
||||
|
||||
val PLATFORM_STONE = TilePropCodex.idDamageToIndex(10, 0)
|
||||
val PLATFORM_WOODEN = TilePropCodex.idDamageToIndex(10, 1)
|
||||
val PLATFORM_EBONY = TilePropCodex.idDamageToIndex(10, 2)
|
||||
val PLATFORM_BIRCH = TilePropCodex.idDamageToIndex(10, 3)
|
||||
val PLATFORM_BLOODROSE = TilePropCodex.idDamageToIndex(10, 4)
|
||||
|
||||
val TORCH = TilePropCodex.idDamageToIndex(11, 0)
|
||||
val TORCH_FROST = TilePropCodex.idDamageToIndex(11, 1)
|
||||
|
||||
val TORCH_OFF = TilePropCodex.idDamageToIndex(12, 0)
|
||||
val TORCH_FROST_OFF = TilePropCodex.idDamageToIndex(12, 1)
|
||||
|
||||
val ILLUMINATOR_WHITE = TilePropCodex.idDamageToIndex(13, 0)
|
||||
val ILLUMINATOR_YELLOW = TilePropCodex.idDamageToIndex(13, 1)
|
||||
val ILLUMINATOR_ORANGE = TilePropCodex.idDamageToIndex(13, 2)
|
||||
val ILLUMINATOR_RED = TilePropCodex.idDamageToIndex(13, 3)
|
||||
val ILLUMINATOR_FUCHSIA = TilePropCodex.idDamageToIndex(13, 4)
|
||||
val ILLUMINATOR_PURPLE = TilePropCodex.idDamageToIndex(13, 5)
|
||||
val ILLUMINATOR_BLUE = TilePropCodex.idDamageToIndex(13, 6)
|
||||
val ILLUMINATOR_CYAN = TilePropCodex.idDamageToIndex(13, 7)
|
||||
val ILLUMINATOR_GREEN = TilePropCodex.idDamageToIndex(13, 8)
|
||||
val ILLUMINATOR_GREEN_DARK = TilePropCodex.idDamageToIndex(13, 9)
|
||||
val ILLUMINATOR_BROWN = TilePropCodex.idDamageToIndex(13, 10)
|
||||
val ILLUMINATOR_TAN = TilePropCodex.idDamageToIndex(13, 11)
|
||||
val ILLUMINATOR_GREY_LIGHT = TilePropCodex.idDamageToIndex(13, 12)
|
||||
val ILLUMINATOR_GREY_MED = TilePropCodex.idDamageToIndex(13, 13)
|
||||
val ILLUMINATOR_GREY_DARK = TilePropCodex.idDamageToIndex(13, 14)
|
||||
val ILLUMINATOR_BLACK = TilePropCodex.idDamageToIndex(13, 15)
|
||||
|
||||
val ILLUMINATOR_WHITE_OFF = TilePropCodex.idDamageToIndex(14, 0)
|
||||
val ILLUMINATOR_YELLOW_OFF = TilePropCodex.idDamageToIndex(14, 1)
|
||||
val ILLUMINATOR_ORANGE_OFF = TilePropCodex.idDamageToIndex(14, 2)
|
||||
val ILLUMINATOR_RED_OFF = TilePropCodex.idDamageToIndex(14, 3)
|
||||
val ILLUMINATOR_FUCHSIA_OFF = TilePropCodex.idDamageToIndex(14, 4)
|
||||
val ILLUMINATOR_PURPLE_OFF = TilePropCodex.idDamageToIndex(14, 5)
|
||||
val ILLUMINATOR_BLUE_OFF = TilePropCodex.idDamageToIndex(14, 6)
|
||||
val ILLUMINATOR_CYAN_OFF = TilePropCodex.idDamageToIndex(14, 7)
|
||||
val ILLUMINATOR_GREEN_OFF = TilePropCodex.idDamageToIndex(14, 8)
|
||||
val ILLUMINATOR_GREEN_DARK_OFF = TilePropCodex.idDamageToIndex(14, 9)
|
||||
val ILLUMINATOR_BROWN_OFF = TilePropCodex.idDamageToIndex(14, 10)
|
||||
val ILLUMINATOR_TAN_OFF = TilePropCodex.idDamageToIndex(14, 11)
|
||||
val ILLUMINATOR_GREY_LIGHT_OFF = TilePropCodex.idDamageToIndex(14, 12)
|
||||
val ILLUMINATOR_GREY_MED_OFF = TilePropCodex.idDamageToIndex(14, 13)
|
||||
val ILLUMINATOR_GREY_DARK_OFF = TilePropCodex.idDamageToIndex(14, 14)
|
||||
val ILLUMINATOR_BLACK_OFF = TilePropCodex.idDamageToIndex(14, 15)
|
||||
|
||||
val SANDSTONE = TilePropCodex.idDamageToIndex(15, 0)
|
||||
val SANDSTONE_WHITE = TilePropCodex.idDamageToIndex(15, 1)
|
||||
val SANDSTONE_RED = TilePropCodex.idDamageToIndex(15, 2)
|
||||
val SANDSTONE_DESERT = TilePropCodex.idDamageToIndex(15, 3)
|
||||
val SANDSTONE_BLACK = TilePropCodex.idDamageToIndex(15, 4)
|
||||
val SANDSTONE_GREEN = TilePropCodex.idDamageToIndex(15, 5)
|
||||
|
||||
val LANTERN = TilePropCodex.idDamageToIndex(16, 0)
|
||||
val SUNSTONE = TilePropCodex.idDamageToIndex(16, 1)
|
||||
val DAYLIGHT_CAPACITOR = TilePropCodex.idDamageToIndex(16, 2)
|
||||
|
||||
val WATER_1 = TilePropCodex.idDamageToIndex(255, 0)
|
||||
val WATER_2 = TilePropCodex.idDamageToIndex(255, 1)
|
||||
val WATER_3 = TilePropCodex.idDamageToIndex(255, 2)
|
||||
val WATER_4 = TilePropCodex.idDamageToIndex(255, 3)
|
||||
val WATER_5 = TilePropCodex.idDamageToIndex(255, 4)
|
||||
val WATER_6 = TilePropCodex.idDamageToIndex(255, 5)
|
||||
val WATER_7 = TilePropCodex.idDamageToIndex(255, 6)
|
||||
val WATER_8 = TilePropCodex.idDamageToIndex(255, 7)
|
||||
val WATER_9 = TilePropCodex.idDamageToIndex(255, 8)
|
||||
val WATER_10 = TilePropCodex.idDamageToIndex(255, 9)
|
||||
val WATER_11 = TilePropCodex.idDamageToIndex(255, 10)
|
||||
val WATER_12 = TilePropCodex.idDamageToIndex(255, 11)
|
||||
val WATER_13 = TilePropCodex.idDamageToIndex(255, 12)
|
||||
val WATER_14 = TilePropCodex.idDamageToIndex(255, 13)
|
||||
val WATER_15 = TilePropCodex.idDamageToIndex(255, 14)
|
||||
val WATER = TilePropCodex.idDamageToIndex(255, 15)
|
||||
|
||||
val LAVA_1 = TilePropCodex.idDamageToIndex(254, 0)
|
||||
val LAVA_2 = TilePropCodex.idDamageToIndex(254, 1)
|
||||
val LAVA_3 = TilePropCodex.idDamageToIndex(254, 2)
|
||||
val LAVA_4 = TilePropCodex.idDamageToIndex(254, 3)
|
||||
val LAVA_5 = TilePropCodex.idDamageToIndex(254, 4)
|
||||
val LAVA_6 = TilePropCodex.idDamageToIndex(254, 5)
|
||||
val LAVA_7 = TilePropCodex.idDamageToIndex(254, 6)
|
||||
val LAVA_8 = TilePropCodex.idDamageToIndex(254, 7)
|
||||
val LAVA_9 = TilePropCodex.idDamageToIndex(254, 8)
|
||||
val LAVA_10 = TilePropCodex.idDamageToIndex(254, 9)
|
||||
val LAVA_11 = TilePropCodex.idDamageToIndex(254, 10)
|
||||
val LAVA_12 = TilePropCodex.idDamageToIndex(254, 11)
|
||||
val LAVA_13 = TilePropCodex.idDamageToIndex(254, 12)
|
||||
val LAVA_14 = TilePropCodex.idDamageToIndex(254, 13)
|
||||
val LAVA_15 = TilePropCodex.idDamageToIndex(254, 14)
|
||||
val LAVA = TilePropCodex.idDamageToIndex(254, 15)
|
||||
|
||||
val NULL = 4096
|
||||
}
|
||||
Reference in New Issue
Block a user