mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-08 04:41:51 +09:00
electric workbench
This commit is contained in:
@@ -32,4 +32,30 @@ class FixtureWorkbench : FixtureBase, CraftingStation {
|
||||
actorValue[AVKey.BASEMASS] = 20.0
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2024-03-14.
|
||||
*/
|
||||
class FixtureElectricWorkbench : FixtureBase, CraftingStation {
|
||||
|
||||
@Transient override val tags = listOf("soldering")
|
||||
|
||||
constructor() : super(
|
||||
BlockBox(BlockBox.NO_COLLISION, 2, 2),
|
||||
nameFun = { Lang["ITEM_ELECTRIC_WORKBENCH"] },
|
||||
mainUI = UICrafting(null)
|
||||
) {
|
||||
val itemImage = FixtureItemBase.getItemImageFromSingleImage("basegame", "sprites/fixtures/electric_workbench.tga")
|
||||
|
||||
density = BlockCodex[Block.PLANK_NORMAL].density.toDouble()
|
||||
setHitboxDimension(itemImage.texture.width, itemImage.texture.height, 0, 0)
|
||||
|
||||
makeNewSprite(TextureRegionPack(itemImage.texture, 32, 32)).let {
|
||||
it.setRowsAndFrames(2,1)
|
||||
}
|
||||
|
||||
actorValue[AVKey.BASEMASS] = 40.0
|
||||
}
|
||||
|
||||
}
|
||||
@@ -114,16 +114,16 @@ open class FixtureItemBase(originalID: ItemID, val fixtureClassName: String) : G
|
||||
*/
|
||||
companion object {
|
||||
/** Always use with Getter! */
|
||||
fun getItemImageFromSheet(module: String, path: String, tileW: Int, tileH: Int): TextureRegion {
|
||||
val id = "$module/${path.replace('\\','/')}"
|
||||
fun getItemImageFromSheet(module: String, path: String, tileW: Int, tileH: Int, tileIndexX: Int = 0, tileIndexY: Int = 0): TextureRegion {
|
||||
val id = "sheet:$module/${path.replace('\\','/')}"
|
||||
return (CommonResourcePool.getOrPut(id) {
|
||||
TextureRegionPack(ModMgr.getGdxFile(module, path), tileW, tileH)
|
||||
} as TextureRegionPack).get(0,0)
|
||||
} as TextureRegionPack).get(tileIndexX, tileIndexY)
|
||||
}
|
||||
|
||||
/** Always use with Getter! */
|
||||
fun getItemImageFromSingleImage(module: String, path: String): TextureRegion {
|
||||
val id = "$module/${path.replace('\\','/')}"
|
||||
val id = "singleton:$module/${path.replace('\\','/')}"
|
||||
return CommonResourcePool.getOrPut(id) {
|
||||
TextureRegion(Texture(ModMgr.getGdxFile(module, path)))
|
||||
} as TextureRegion
|
||||
|
||||
@@ -18,4 +18,21 @@ class ItemWorkbench(originalID: ItemID) : FixtureItemBase(originalID, "net.torva
|
||||
override var baseToolSize: Double? = baseMass
|
||||
override var originalName = "ITEM_WORKBENCH"
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2024-03-14.
|
||||
*/
|
||||
class ItemElectricWorkbench(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulebasegame.gameactors.FixtureElectricWorkbench") {
|
||||
|
||||
|
||||
override var baseMass = 40.0
|
||||
override val canBeDynamic = false
|
||||
override val materialId = ""
|
||||
override val itemImage: TextureRegion
|
||||
get() = getItemImageFromSheet("basegame", "sprites/fixtures/electric_workbench.tga", 32, 32, 0, 1)
|
||||
|
||||
override var baseToolSize: Double? = baseMass
|
||||
override var originalName = "ITEM_ELECTRIC_WORKBENCH"
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user