mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 02:54:04 +09:00
fixing issue #47 using new tag on blocks.csv
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
"id";"drop";"spawn";"name";"shdr";"shdg";"shdb";"shduv";"str";"dsty";"mate";"solid";"wall";"grav";"dlfn";"fv";"fr";"lumr";"lumg";"lumb";"lumuv";"colour";"vscs";"refl";"tags"
|
"id";"drop";"spawn";"name";"shdr";"shdg";"shdb";"shduv";"str";"dsty";"mate";"solid";"wall";"grav";"dlfn";"fv";"fr";"lumr";"lumg";"lumb";"lumuv";"colour";"vscs";"refl";"tags"
|
||||||
"0";"0";"0";"BLOCK_AIR";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"1";"N/A";"0";"0";"4";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";""
|
"0";"0";"0";"BLOCK_AIR";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1";"NULL";"0";"1";"N/A";"0";"0";"4";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"INCONSEQUENTIAL"
|
||||||
"16";"17";"17";"BLOCK_STONE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"ROCK,NATURAL"
|
"16";"17";"17";"BLOCK_STONE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"ROCK,NATURAL"
|
||||||
"17";"17";"17";"BLOCK_STONE_QUARRIED";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"ROCK"
|
"17";"17";"17";"BLOCK_STONE_QUARRIED";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"ROCK"
|
||||||
"18";"18";"18";"BLOCK_STONE_TILE_WHITE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.18";"STONE"
|
"18";"18";"18";"BLOCK_STONE_TILE_WHITE";"0.1252";"0.1252";"0.1252";"0.1252";"48";"2400";"ROCK";"1";"1";"N/A";"0";"4";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.18";"STONE"
|
||||||
@@ -188,6 +188,7 @@
|
|||||||
## Some tags are reserved for internal use, which are:
|
## Some tags are reserved for internal use, which are:
|
||||||
## - INTERNAL: denotes that the tile is internal-use. Will not be rendered unless debug window is on.
|
## - INTERNAL: denotes that the tile is internal-use. Will not be rendered unless debug window is on.
|
||||||
## - DORENDER: this internal tile must go through the standard-issue tile drawing routine.
|
## - DORENDER: this internal tile must go through the standard-issue tile drawing routine.
|
||||||
|
## - INCONSEQUENTIAL: denotes that this tile can be overwritten without dropping it. Usually used with flower tiles.
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
## References ##
|
## References ##
|
||||||
|
|||||||
|
Can't render this file because it contains an unexpected character in line 179 and column 37.
|
@@ -209,8 +209,8 @@ class BlockCodex {
|
|||||||
prop.isSolid = record.boolVal("solid")
|
prop.isSolid = record.boolVal("solid")
|
||||||
//prop.isClear = record.boolVal("clear")
|
//prop.isClear = record.boolVal("clear")
|
||||||
|
|
||||||
prop.isPlatform = prop.tags.contains("PLATFORM")
|
prop.isPlatform = prop.hasTag("PLATFORM")
|
||||||
prop.isActorBlock = prop.tags.contains("ACTORBLOCK")
|
prop.isActorBlock = prop.hasTag("ACTORBLOCK")
|
||||||
|
|
||||||
prop.isWallable = record.boolVal("wall")
|
prop.isWallable = record.boolVal("wall")
|
||||||
prop.maxSupport = record.intVal("grav")
|
prop.maxSupport = record.intVal("grav")
|
||||||
|
|||||||
@@ -75,6 +75,8 @@ class BlockProp {
|
|||||||
BlockCodex[BlockCodex.tileToVirtual[id]!![offset]]._lumCol.lane(channel)
|
BlockCodex[BlockCodex.tileToVirtual[id]!![offset]]._lumCol.lane(channel)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun hasTag(s: String) = tags.contains(s)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param luminosity
|
* @param luminosity
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -359,6 +359,8 @@ abstract class GameItem(val originalID: ItemID) : Comparable<GameItem>, Cloneabl
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun hasTag(s: String) = tags.contains(s)
|
||||||
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
|||||||
@@ -248,7 +248,7 @@ open class FixtureBase : ActorWithBody, CuedByTerrainChange {
|
|||||||
forEachBlockbox { x, y, _, _ ->
|
forEachBlockbox { x, y, _, _ ->
|
||||||
if (!hasCollision) {
|
if (!hasCollision) {
|
||||||
val tile = world!!.getTileFromTerrain(x, y)
|
val tile = world!!.getTileFromTerrain(x, y)
|
||||||
if (BlockCodex[tile].isSolid || BlockCodex[tile].isActorBlock) {
|
if (!BlockCodex[tile].hasTag("INCONSEQUENTIAL")) {
|
||||||
hasCollision = true
|
hasCollision = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -311,7 +311,7 @@ open class FixtureBase : ActorWithBody, CuedByTerrainChange {
|
|||||||
forEachBlockbox { x, y, _, _ ->
|
forEachBlockbox { x, y, _, _ ->
|
||||||
if (!hasCollision) {
|
if (!hasCollision) {
|
||||||
val tile = world!!.getTileFromTerrain(x, y)
|
val tile = world!!.getTileFromTerrain(x, y)
|
||||||
if (BlockCodex[tile].isSolid || BlockCodex[tile].isActorBlock) {
|
if (!BlockCodex[tile].hasTag("INCONSEQUENTIAL")) {
|
||||||
hasCollision = true
|
hasCollision = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ object BlockBase {
|
|||||||
|
|
||||||
// return false if there is a "solid" tile already
|
// return false if there is a "solid" tile already
|
||||||
if (isWall && BlockCodex[wallUnderCursor].isSolid ||
|
if (isWall && BlockCodex[wallUnderCursor].isSolid ||
|
||||||
!isWall && (BlockCodex[terrainUnderCursor].isSolid || BlockCodex[terrainUnderCursor].isActorBlock))
|
!isWall && !BlockCodex[terrainUnderCursor].hasTag("INCONSEQUENTIAL"))
|
||||||
return@mouseInInteractableRange -1L
|
return@mouseInInteractableRange -1L
|
||||||
|
|
||||||
// filter passed, do the job
|
// filter passed, do the job
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ object ControlPanelCommon {
|
|||||||
val optionsList = arg.subList(1, arg.size).map { it.toInt() }
|
val optionsList = arg.subList(1, arg.size).map { it.toInt() }
|
||||||
|
|
||||||
val initialSel = optionsList.indexOf(App.getConfigInt(optionName))
|
val initialSel = optionsList.indexOf(App.getConfigInt(optionName))
|
||||||
if (initialSel < 0) throw IllegalArgumentException("config value '${App.getConfigString(optionName)}' for option '$optionName' is not found on the options list")
|
if (initialSel < 0) throw IllegalArgumentException("config value '${App.getConfigInt(optionName)}' for option '$optionName' is not found on the options list")
|
||||||
|
|
||||||
UIItemTextSelector(parent, x, y, labelFuns, initialSel, CONFIG_SPINNER_WIDTH, clickToShowPalette = false, useSpinnerButtons = true) to { it: UIItem, optionStr: String ->
|
UIItemTextSelector(parent, x, y, labelFuns, initialSel, CONFIG_SPINNER_WIDTH, clickToShowPalette = false, useSpinnerButtons = true) to { it: UIItem, optionStr: String ->
|
||||||
(it as UIItemTextSelector).selectionChangeListener = {
|
(it as UIItemTextSelector).selectionChangeListener = {
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
|
|||||||
// If the player has the required item, use it; otherwise, will take an item from the ItemCodex
|
// If the player has the required item, use it; otherwise, will take an item from the ItemCodex
|
||||||
player.itemList.filter { (itm, qty) ->
|
player.itemList.filter { (itm, qty) ->
|
||||||
ItemCodex[itm]?.tags?.contains(ingredient.key) == true && qty >= ingredient.qty
|
ItemCodex[itm]?.tags?.contains(ingredient.key) == true && qty >= ingredient.qty
|
||||||
}.maxByOrNull { it.qty }?.itm ?: ((ItemCodex.itemCodex.firstNotNullOfOrNull { if (it.value.tags.contains(ingredient.key)) it.key else null }) ?: throw NullPointerException("Item with tag '${ingredient.key}' not found. Possible cause: game or a module not updated or installed"))
|
}.maxByOrNull { it.qty }?.itm ?: ((ItemCodex.itemCodex.firstNotNullOfOrNull { if (it.value.hasTag(ingredient.key)) it.key else null }) ?: throw NullPointerException("Item with tag '${ingredient.key}' not found. Possible cause: game or a module not updated or installed"))
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ingredient.key
|
ingredient.key
|
||||||
@@ -234,7 +234,7 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
|
|||||||
// don't rely on highlightedness of the button to determine the item on the button is the selected
|
// don't rely on highlightedness of the button to determine the item on the button is the selected
|
||||||
// ingredient (because I don't fully trust my code lol)
|
// ingredient (because I don't fully trust my code lol)
|
||||||
val targetItemToAlter = recipe.ingredients.filter { // altering recipe doesn't make sense if player selected a recipe that requires no tag-ingredients
|
val targetItemToAlter = recipe.ingredients.filter { // altering recipe doesn't make sense if player selected a recipe that requires no tag-ingredients
|
||||||
(it.keyMode == CraftingCodex.CraftingItemKeyMode.TAG && gameItem.tags.contains(it.key))
|
(it.keyMode == CraftingCodex.CraftingItemKeyMode.TAG && gameItem.hasTag(it.key))
|
||||||
}.let {
|
}.let {
|
||||||
if (it.size > 1)
|
if (it.size > 1)
|
||||||
println("[UICrafting] Your recipe seems to have two similar ingredients defined\n" +
|
println("[UICrafting] Your recipe seems to have two similar ingredients defined\n" +
|
||||||
@@ -245,7 +245,7 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
|
|||||||
|
|
||||||
targetItemToAlter?.let {
|
targetItemToAlter?.let {
|
||||||
val oldItem = _getItemListIngredients().getInventory().itemList.first { itemPair ->
|
val oldItem = _getItemListIngredients().getInventory().itemList.first { itemPair ->
|
||||||
(it.keyMode == CraftingCodex.CraftingItemKeyMode.TAG && ItemCodex[itemPair.itm]!!.tags.contains(it.key))
|
(it.keyMode == CraftingCodex.CraftingItemKeyMode.TAG && ItemCodex[itemPair.itm]!!.hasTag(it.key))
|
||||||
}
|
}
|
||||||
changeIngredient(oldItem, itemID)
|
changeIngredient(oldItem, itemID)
|
||||||
refreshCraftButtonStatus()
|
refreshCraftButtonStatus()
|
||||||
@@ -279,7 +279,7 @@ class UICrafting(val full: UIInventoryFull) : UICanvas(), HasInventory {
|
|||||||
// If the player has the required item, use it; otherwise, will take an item from the ItemCodex
|
// If the player has the required item, use it; otherwise, will take an item from the ItemCodex
|
||||||
val selectedItem = playerInventory.itemList.filter { (itm, qty) ->
|
val selectedItem = playerInventory.itemList.filter { (itm, qty) ->
|
||||||
ItemCodex[itm]?.tags?.contains(ingredient.key) == true && qty >= ingredient.qty
|
ItemCodex[itm]?.tags?.contains(ingredient.key) == true && qty >= ingredient.qty
|
||||||
}.maxByOrNull { it.qty }?.itm ?: ((ItemCodex.itemCodex.firstNotNullOfOrNull { if (it.value.tags.contains(ingredient.key)) it.key else null }) ?: throw NullPointerException("Item with tag '${ingredient.key}' not found. Possible cause: game or a module not updated or installed"))
|
}.maxByOrNull { it.qty }?.itm ?: ((ItemCodex.itemCodex.firstNotNullOfOrNull { if (it.value.hasTag(ingredient.key)) it.key else null }) ?: throw NullPointerException("Item with tag '${ingredient.key}' not found. Possible cause: game or a module not updated or installed"))
|
||||||
|
|
||||||
// printdbg(this, "Adding ingredients by tag ${selectedItem} (${ingredient.qty})")
|
// printdbg(this, "Adding ingredients by tag ${selectedItem} (${ingredient.qty})")
|
||||||
selectedItem
|
selectedItem
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ class UIPerformanceControlPanel(remoCon: UIRemoCon?) : UICanvas() {
|
|||||||
arrayOf("autosaveinterval", { Lang["MENU_OPTIONS_AUTOSAVE"] + " (${Lang["CONTEXT_TIME_MINUTE_PLURAL"]})" }, "spinnerimul,1,120,1,60000"),
|
arrayOf("autosaveinterval", { Lang["MENU_OPTIONS_AUTOSAVE"] + " (${Lang["CONTEXT_TIME_MINUTE_PLURAL"]})" }, "spinnerimul,1,120,1,60000"),
|
||||||
arrayOf("notificationshowuptime", { Lang["MENU_OPTIONS_NOTIFICATION_DISPLAY_DURATION"] + " (${Lang["CONTEXT_TIME_SECOND_PLURAL"]})" }, "spinnerimul,2,10,1,1000"),
|
arrayOf("notificationshowuptime", { Lang["MENU_OPTIONS_NOTIFICATION_DISPLAY_DURATION"] + " (${Lang["CONTEXT_TIME_SECOND_PLURAL"]})" }, "spinnerimul,2,10,1,1000"),
|
||||||
arrayOf("", { Lang["MENU_LABEL_GRAPHICS"] }, "h1"),
|
arrayOf("", { Lang["MENU_LABEL_GRAPHICS"] }, "h1"),
|
||||||
arrayOf("atlastexsize", { Lang["MENU_OPTIONS_ATLAS_TEXTURE_SIZE"] }, "spinnersel,2048,4096,8192"),
|
arrayOf("atlastexsize", { Lang["MENU_OPTIONS_ATLAS_TEXTURE_SIZE"] }, "spinnersel,1024,2048,4096,8192"),
|
||||||
arrayOf("", { Lang["MENU_LABEL_JVM_DNT"] }, "h1"),
|
arrayOf("", { Lang["MENU_LABEL_JVM_DNT"] }, "h1"),
|
||||||
arrayOf("jvm_xmx", { Lang["MENU_OPTIONS_JVM_HEAP_MAX"] + " (GB)" }, "spinner,2,32,1"),
|
arrayOf("jvm_xmx", { Lang["MENU_OPTIONS_JVM_HEAP_MAX"] + " (GB)" }, "spinner,2,32,1"),
|
||||||
arrayOf("jvm_extra_cmd", { Lang["MENU_LABEL_EXTRA_JVM_ARGUMENTS"] }, "typein"),
|
arrayOf("jvm_extra_cmd", { Lang["MENU_LABEL_EXTRA_JVM_ARGUMENTS"] }, "typein"),
|
||||||
|
|||||||
Reference in New Issue
Block a user