mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-08 12:51:51 +09:00
itemised the torch
This commit is contained in:
@@ -89,9 +89,9 @@
|
||||
"164";"164";"164";"BLOCK_PLATFORM_ROSEWOOD";"0.0312";"0.0312";"0.0312";"0.0312";"5";"900";"WOOD";"0";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"PLATFORM,WOODEN"
|
||||
|
||||
# lights
|
||||
"176";"176";"176";"BLOCK_TORCH";"0.0312";"0.0312";"0.0312";"0.0312";"1";"800";"FXTR";"0";"0";"N/A";"1";"0";"16";"1.0000";"0.6372";"0.0000";"0.0000";"N/A";"N/A";"0.0";"LIGHT,WOODEN"
|
||||
"176";"item@basegame:33";"item@basegame:33";"BLOCK_TORCH";"0.0312";"0.0312";"0.0312";"0.0312";"1";"800";"FXTR";"0";"0";"N/A";"1";"0";"16";"1.0000";"0.6372";"0.0000";"0.0000";"N/A";"N/A";"0.0";"LIGHT,WOODEN"
|
||||
#"177";"177";"177";"BLOCK_TORCH_FROST";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1100";"FXTR";"0";"0";"N/A";"1";"0";"16";"0.3048";"0.4848";"1.0000";"0.0000";"N/A";"N/A";"0.0";"LIGHT,WOODEN"
|
||||
"192";"176";"176";"BLOCK_TORCH";"0.0312";"0.0312";"0.0312";"0.0312";"1";"800";"FXTR";"0";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"LIGHT,UNLIT,INTERNAL,WOODEN"
|
||||
"192";"item@basegame:33";"item@basegame:33";"BLOCK_TORCH";"0.0312";"0.0312";"0.0312";"0.0312";"1";"800";"FXTR";"0";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"LIGHT,UNLIT,INTERNAL,WOODEN"
|
||||
#"193";"177";"177";"BLOCK_TORCH_FROST";"0.0312";"0.0312";"0.0312";"0.0312";"1";"1100";"FXTR";"0";"0";"N/A";"0";"0";"16";"0.0000";"0.0000";"0.0000";"0.0000";"N/A";"N/A";"0.0";"LIGHT,UNLIT,INTERNAL,WOODEN"
|
||||
"208";"208";"208";"BLOCK_ILLUMINATOR_WHITE";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"1";"N/A";"0";"0";"16";"0.9270";"0.9414";"0.8519";"0.0000";"N/A";"N/A";"0.0";"LIGHT,NORANDTILE"
|
||||
"209";"209";"209";"BLOCK_ILLUMINATOR_YELLOW";"0.0312";"0.0312";"0.0312";"0.0312";"1";"2500";"GLAS";"1";"1";"N/A";"0";"0";"16";"1.0000";"0.8408";"0.0000";"0.0000";"N/A";"N/A";"0.0";"LIGHT,NORANDTILE"
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 18 and column 2.
|
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"basegame:176": { /* torch */
|
||||
"item@basegame:33": { /* torch */
|
||||
"workbench": "",
|
||||
"ingredients": [
|
||||
[5, 1, "item@basegame:18", 1, "item@basegame:130"], /* 5 torches = 1 stick, 1 coal */
|
||||
@@ -9,8 +9,7 @@
|
||||
"item@basegame:5": { /* tiki torch */
|
||||
"workbench": "",
|
||||
"ingredients": [
|
||||
[1, 1, "$WOOD", 3, "item@basegame:18", 1, "basegame:176"], /* 1 tiki torch = 1 wood, 3 sticks, 1 torch */
|
||||
[1, 1, "$WOOD", 3, "item@basegame:18", 1, "basegame:192"]
|
||||
[1, 1, "$WOOD", 3, "item@basegame:18", 1, "item@basegame:33"] /* 1 tiki torch = 1 wood, 3 sticks, 1 torch */
|
||||
]
|
||||
},
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ id;classname;tags
|
||||
30;net.torvald.terrarum.modulebasegame.gameitems.ItemMusicalTurntable;FIXTURE,MUSIC
|
||||
31;net.torvald.terrarum.modulebasegame.gameitems.ItemGunpowder;POWDER,EXPLOSIVE
|
||||
32;net.torvald.terrarum.modulebasegame.gameitems.ItemCherryBomb;EXPLOSIVE,THROWABLE
|
||||
33;net.torvald.terrarum.modulebasegame.gameitems.ItemTorch;FIXTURE,LIGHT
|
||||
|
||||
# ingots
|
||||
26;net.torvald.terrarum.modulebasegame.gameitems.IngotSteel;INGOT
|
||||
|
||||
|
BIN
assets/mods/basegame/items/torch.tga
LFS
Normal file
BIN
assets/mods/basegame/items/torch.tga
LFS
Normal file
Binary file not shown.
BIN
assets/mods/basegame/items/torch_emsv.tga
LFS
Normal file
BIN
assets/mods/basegame/items/torch_emsv.tga
LFS
Normal file
Binary file not shown.
@@ -133,13 +133,6 @@ class AssembledSpriteAnimation(
|
||||
}
|
||||
}
|
||||
|
||||
private fun fetchItemImage(item: GameItem) = if (isEmissive)
|
||||
ItemCodex.getItemImageEmissive(item)
|
||||
else if (isGlow)
|
||||
ItemCodex.getItemImageGlow(item)
|
||||
else
|
||||
ItemCodex.getItemImage(item)
|
||||
|
||||
private fun fetchItemImage(mode: Int, item: GameItem) = when (mode) {
|
||||
0 -> ItemCodex.getItemImage(item)
|
||||
1 -> ItemCodex.getItemImageGlow(item)
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.files.FileHandle
|
||||
import com.badlogic.gdx.graphics.Pixmap
|
||||
import com.badlogic.gdx.utils.JsonValue
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.terrarum.App.*
|
||||
import net.torvald.terrarum.App.setToGameConfig
|
||||
import net.torvald.terrarum.audio.AudioCodex
|
||||
@@ -537,13 +538,10 @@ object ModMgr {
|
||||
Terrarum.blockCodex.fromModule(module, "blocks/blocks.csv") { tile ->
|
||||
// register blocks as items
|
||||
ItemCodex[tile.id] = makeNewItemObj(tile, false)
|
||||
|
||||
if (IS_DEVELOPMENT_BUILD) print(tile.id+" ")
|
||||
|
||||
if (BlockCodex[tile.id].isWallable) {
|
||||
ItemCodex["wall@" + tile.id] = makeNewItemObj(tile, true).also {
|
||||
it.tags.add("WALL")
|
||||
}
|
||||
ItemCodex["wall@" + tile.id] = makeNewItemObj(tile, true)
|
||||
if (IS_DEVELOPMENT_BUILD) print("wall@" + tile.id + " ")
|
||||
}
|
||||
|
||||
@@ -585,8 +583,12 @@ object ModMgr {
|
||||
// )
|
||||
// }
|
||||
|
||||
@Transient private var isWall1: Boolean = true
|
||||
|
||||
init {
|
||||
isWall1 = isWall
|
||||
tags.addAll(tile.tags)
|
||||
if (isWall) tags.add("WALL")
|
||||
originalName =
|
||||
if (isWall && tags.contains("UNLIT")) "${tile.nameKey}>>=BLOCK_UNLIT_TEMPLATE>>=BLOCK_WALL_NAME_TEMPLATE"
|
||||
else if (isWall) "${tile.nameKey}>>=BLOCK_WALL_NAME_TEMPLATE"
|
||||
@@ -594,6 +596,9 @@ object ModMgr {
|
||||
else tile.nameKey
|
||||
}
|
||||
|
||||
override fun getLumCol() =
|
||||
if (isWall1) Cvec(0)
|
||||
else BlockCodex[originalID].getLumCol(0, 0)
|
||||
|
||||
override fun startPrimaryUse(actor: ActorWithBody, delta: Float): Long {
|
||||
return BlockBase.blockStartPrimaryUse(actor, this, dynamicID, delta)
|
||||
|
||||
@@ -1797,7 +1797,7 @@ open class ActorWithBody : Actor {
|
||||
if (spriteGlow != null)
|
||||
drawSpriteInGoodPosition(frameDelta, spriteGlow!!, batch, 1)
|
||||
else if (sprite != null)
|
||||
drawSpriteInGoodPosition(frameDelta, sprite!!, batch, 0, Color.BLACK) // use black version of normal sprite as a substitution
|
||||
drawSpriteInGoodPosition(frameDelta, sprite!!, batch, 1, Color.BLACK) // use black version of normal sprite as a substitution
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1807,7 +1807,7 @@ open class ActorWithBody : Actor {
|
||||
if (spriteEmissive != null)
|
||||
drawSpriteInGoodPosition(frameDelta, spriteEmissive!!, batch, 2)
|
||||
else if (sprite != null)
|
||||
drawSpriteInGoodPosition(frameDelta, sprite!!, batch, 0, Color.BLACK) // use black version of normal sprite as a substitution
|
||||
drawSpriteInGoodPosition(frameDelta, sprite!!, batch, 2, Color.BLACK) // use black version of normal sprite as a substitution
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package net.torvald.terrarum.gameitems
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.ReferencingRanges.PREFIX_ACTORITEM
|
||||
import net.torvald.terrarum.ReferencingRanges.PREFIX_DYNAMICITEM
|
||||
@@ -28,6 +29,8 @@ abstract class GameItem(val originalID: ItemID) : Comparable<GameItem>, Cloneabl
|
||||
|
||||
constructor() : this("-uninitialised-")
|
||||
|
||||
open fun getLumCol(): Cvec = Cvec(0)
|
||||
|
||||
/**
|
||||
* For items with COMBUSTIBLE tag only
|
||||
*
|
||||
|
||||
@@ -10,6 +10,7 @@ import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||
import net.torvald.terrarum.gameactors.*
|
||||
import net.torvald.terrarum.gameitems.*
|
||||
import net.torvald.terrarum.weather.WeatherMixer.max
|
||||
import org.dyn4j.geometry.Vector2
|
||||
|
||||
/**
|
||||
@@ -130,12 +131,14 @@ open class DroppedItem : ActorWithBody {
|
||||
else if (itemID.isWall())
|
||||
BlockCodex[itemID.substringAfter('@')].getLumCol(randKey1, randKey2)
|
||||
else {
|
||||
Cvec(
|
||||
ItemCodex[itemID]?.itemProperties?.getAsFloat(AVKey.LUMR) ?: 0f,
|
||||
ItemCodex[itemID]?.itemProperties?.getAsFloat(AVKey.LUMG) ?: 0f,
|
||||
ItemCodex[itemID]?.itemProperties?.getAsFloat(AVKey.LUMB) ?: 0f,
|
||||
ItemCodex[itemID]?.itemProperties?.getAsFloat(AVKey.LUMA) ?: 0f,
|
||||
)
|
||||
val itemprop = ItemCodex[itemID]
|
||||
(itemprop?.getLumCol() ?: Cvec(0)).max(
|
||||
Cvec(
|
||||
itemprop?.itemProperties?.getAsFloat(AVKey.LUMR) ?: 0f,
|
||||
itemprop?.itemProperties?.getAsFloat(AVKey.LUMG) ?: 0f,
|
||||
itemprop?.itemProperties?.getAsFloat(AVKey.LUMB) ?: 0f,
|
||||
itemprop?.itemProperties?.getAsFloat(AVKey.LUMA) ?: 0f,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameitems
|
||||
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.gdx.graphics.Cvec
|
||||
import net.torvald.terrarum.BlockCodex
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.blockproperties.Block
|
||||
import net.torvald.terrarum.gameitems.GameItem
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
|
||||
@@ -47,4 +50,20 @@ class ItemGunpowder(originalID: ItemID) : LightIngredientBase(originalID) {
|
||||
override var originalName = "ITEM_GUNPOWDER"
|
||||
override val itemImage: TextureRegion
|
||||
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(0,12)
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2024-02-15.
|
||||
*/
|
||||
class ItemTorch(originalID: ItemID) : LightIngredientBase(originalID) {
|
||||
override var baseMass = 0.8 // from blocks.csv
|
||||
override var inventoryCategory = Category.FIXTURE
|
||||
|
||||
override var originalName = "BLOCK_TORCH"
|
||||
override val itemImage: TextureRegion
|
||||
get() = FixtureItemBase.getItemImageFromSingleImage("basegame", "items/torch.tga")
|
||||
override val itemImageEmissive: TextureRegion
|
||||
get() = FixtureItemBase.getItemImageFromSingleImage("basegame", "items/torch_emsv.tga")
|
||||
|
||||
override fun getLumCol() = BlockCodex[Block.TORCH].getLumCol(0, 0)
|
||||
}
|
||||
@@ -506,7 +506,7 @@ class UICrafting(val full: UIInventoryFull?) : UICanvas(
|
||||
return if (ingredient.keyMode == CraftingCodex.CraftingItemKeyMode.TAG) {
|
||||
candidate.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")
|
||||
throw NullPointerException("Item with tag '${ingredient.key}' not found. Possible cause: game or a module not updated or installed (ingredient: $ingredient)")
|
||||
)
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -741,8 +741,8 @@ internal object WeatherMixer : RNGConsumer {
|
||||
|
||||
}
|
||||
|
||||
private operator fun Cvec.times(other: Float) = Cvec(this.r * other, this.g * other, this.b * other, this.a * other)
|
||||
private infix fun Cvec.max(other: Cvec) = Cvec(
|
||||
operator fun Cvec.times(other: Float) = Cvec(this.r * other, this.g * other, this.b * other, this.a * other)
|
||||
infix fun Cvec.max(other: Cvec) = Cvec(
|
||||
if (this.r > other.r) this.r else other.r,
|
||||
if (this.g > other.g) this.g else other.g,
|
||||
if (this.b > other.b) this.b else other.b,
|
||||
|
||||
@@ -377,10 +377,7 @@ object LightmapRenderer {
|
||||
|
||||
val heldItem = it.inventory.itemEquipped[GameItem.EquipPosition.HAND_GRIP]
|
||||
|
||||
val light = if (heldItem != null && (heldItem.isBlock()))
|
||||
BlockCodex[heldItem].getLumCol(0, 0)
|
||||
else
|
||||
Cvec(0)
|
||||
val light = ItemCodex[heldItem]?.getLumCol() ?: Cvec(0)
|
||||
|
||||
|
||||
Lightbox(Hitbox(
|
||||
|
||||
Reference in New Issue
Block a user