mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 10:34:06 +09:00
new smelter design
This commit is contained in:
BIN
assets/mods/basegame/sprites/fixtures/smelter_tall.tga
LFS
Normal file
BIN
assets/mods/basegame/sprites/fixtures/smelter_tall.tga
LFS
Normal file
Binary file not shown.
BIN
assets/mods/basegame/sprites/fixtures/smelter_tall_illum.tga
LFS
Normal file
BIN
assets/mods/basegame/sprites/fixtures/smelter_tall_illum.tga
LFS
Normal file
Binary file not shown.
@@ -1,13 +1,14 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.gameactors
|
package net.torvald.terrarum.modulebasegame.gameactors
|
||||||
|
|
||||||
import net.torvald.gdx.graphics.Cvec
|
import net.torvald.gdx.graphics.Cvec
|
||||||
import net.torvald.terrarum.BlockCodex
|
import net.torvald.spriteanimation.SheetSpriteAnimation
|
||||||
import net.torvald.terrarum.INGAME
|
import net.torvald.terrarum.*
|
||||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZED
|
||||||
import net.torvald.terrarum.blockproperties.Block
|
import net.torvald.terrarum.blockproperties.Block
|
||||||
import net.torvald.terrarum.gameactors.AVKey
|
import net.torvald.terrarum.gameactors.AVKey
|
||||||
import net.torvald.terrarum.gameactors.Hitbox
|
import net.torvald.terrarum.gameactors.Hitbox
|
||||||
import net.torvald.terrarum.gameactors.Lightbox
|
import net.torvald.terrarum.gameactors.Lightbox
|
||||||
|
import net.torvald.terrarum.gameparticles.ParticleVanishingSprite
|
||||||
import net.torvald.terrarum.langpack.Lang
|
import net.torvald.terrarum.langpack.Lang
|
||||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||||
import net.torvald.terrarum.modulebasegame.gameitems.FixtureItemBase
|
import net.torvald.terrarum.modulebasegame.gameitems.FixtureItemBase
|
||||||
@@ -24,11 +25,17 @@ class FixtureSmelterBasic : FixtureBase, CraftingStation {
|
|||||||
@Transient override val tags = listOf("basicsmelter")
|
@Transient override val tags = listOf("basicsmelter")
|
||||||
|
|
||||||
constructor() : super(
|
constructor() : super(
|
||||||
BlockBox(BlockBox.ALLOW_MOVE_DOWN, 2, 2), // temporary value, will be overwritten by spawn()
|
BlockBox(BlockBox.NO_COLLISION, 3, 4), // temporary value, will be overwritten by spawn()
|
||||||
nameFun = { Lang["ITEM_SMELTER_BASIC"] }
|
nameFun = { Lang["ITEM_SMELTER_BASIC"] }
|
||||||
) {
|
) {
|
||||||
val itemImage = FixtureItemBase.getItemImageFromSingleImage("basegame", "sprites/fixtures/smelter_basic.tga")
|
CommonResourcePool.addToLoadingList("particles-tiki_smoke.tga") {
|
||||||
// val itemImage2 = FixtureItemBase.getItemImageFromSingleImage("basegame", "sprites/fixtures/smelter_basic_glow.tga") // put this sprite to the hypothetical "SpriteIllum"
|
TextureRegionPack(ModMgr.getGdxFile("basegame", "particles/bigger_smoke.tga"), 16, 16)
|
||||||
|
}
|
||||||
|
CommonResourcePool.loadAll()
|
||||||
|
|
||||||
|
|
||||||
|
val itemImage = FixtureItemBase.getItemImageFromSingleImage("basegame", "sprites/fixtures/smelter_tall.tga")
|
||||||
|
// val itemImage2 = FixtureItemBase.getItemImageFromSingleImage("basegame", "sprites/fixtures/smelter_tall_illum.tga") // put this sprite to the hypothetical "SpriteIllum"
|
||||||
|
|
||||||
density = BlockCodex[Block.STONE].density.toDouble()
|
density = BlockCodex[Block.STONE].density.toDouble()
|
||||||
setHitboxDimension(itemImage.texture.width, itemImage.texture.height, 0, 0)
|
setHitboxDimension(itemImage.texture.width, itemImage.texture.height, 0, 0)
|
||||||
@@ -47,11 +54,13 @@ class FixtureSmelterBasic : FixtureBase, CraftingStation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transient override var lightBoxList = arrayListOf(Lightbox(Hitbox(0.0, 0.0, TILE_SIZED * 2, TILE_SIZED * 2), Cvec(0.5f, 0.18f, 0f, 0f)))
|
@Transient override var lightBoxList = arrayListOf(Lightbox(Hitbox(0.0, 2*TILE_SIZED, TILE_SIZED * 2, TILE_SIZED * 2), Cvec(0.5f, 0.18f, 0f, 0f)))
|
||||||
|
|
||||||
@Transient private val actorBlocks = arrayOf(
|
@Transient private val actorBlocks = arrayOf(
|
||||||
arrayOf(Block.ACTORBLOCK_ALLOW_MOVE_DOWN, null),
|
arrayOf(Block.ACTORBLOCK_NO_COLLISION, Block.ACTORBLOCK_NO_COLLISION, null),
|
||||||
arrayOf(Block.ACTORBLOCK_NO_COLLISION, Block.ACTORBLOCK_ALLOW_MOVE_DOWN)
|
arrayOf(Block.ACTORBLOCK_NO_COLLISION, Block.ACTORBLOCK_NO_COLLISION, null),
|
||||||
|
arrayOf(Block.ACTORBLOCK_NO_COLLISION, Block.ACTORBLOCK_NO_COLLISION, null),
|
||||||
|
arrayOf(Block.ACTORBLOCK_NO_COLLISION, Block.ACTORBLOCK_NO_COLLISION, Block.ACTORBLOCK_NO_COLLISION),
|
||||||
)
|
)
|
||||||
override fun placeActorBlocks() {
|
override fun placeActorBlocks() {
|
||||||
forEachBlockbox { x, y, ox, oy ->
|
forEachBlockbox { x, y, ox, oy ->
|
||||||
@@ -62,6 +71,9 @@ class FixtureSmelterBasic : FixtureBase, CraftingStation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var nextDelay = 0.25f
|
||||||
|
private var spawnTimer = 0f
|
||||||
|
|
||||||
@Transient private var mainUIhookHackInstalled = false
|
@Transient private var mainUIhookHackInstalled = false
|
||||||
override fun update(delta: Float) {
|
override fun update(delta: Float) {
|
||||||
// adding UI to the fixture as players may right-click on the workbenches instead of pressing a keyboard key
|
// adding UI to the fixture as players may right-click on the workbenches instead of pressing a keyboard key
|
||||||
@@ -73,6 +85,23 @@ class FixtureSmelterBasic : FixtureBase, CraftingStation {
|
|||||||
}
|
}
|
||||||
|
|
||||||
super.update(delta)
|
super.update(delta)
|
||||||
|
|
||||||
|
|
||||||
|
// emit smokes TODO: only when hot
|
||||||
|
if (spawnTimer >= nextDelay) {
|
||||||
|
(Terrarum.ingame as TerrarumIngame).addParticle(
|
||||||
|
ParticleVanishingSprite(
|
||||||
|
CommonResourcePool.getAsTextureRegionPack("particles-tiki_smoke.tga"),
|
||||||
|
25f, true, hitbox.startX + TILE_SIZED, hitbox.startY + 16, false, (Math.random() * 256).toInt()
|
||||||
|
))
|
||||||
|
|
||||||
|
spawnTimer -= nextDelay
|
||||||
|
nextDelay = Math.random().toFloat() * 0.25f + 0.25f
|
||||||
|
|
||||||
|
(sprite as? SheetSpriteAnimation)?.delays?.set(0, Math.random().toFloat() * 0.4f + 0.1f)
|
||||||
|
}
|
||||||
|
|
||||||
|
spawnTimer += delta
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ class ItemSmelterBasic(originalID: ItemID) : FixtureItemBase(originalID, "net.to
|
|||||||
override val isDynamic = false
|
override val isDynamic = false
|
||||||
override val materialId = ""
|
override val materialId = ""
|
||||||
override val itemImage: TextureRegion
|
override val itemImage: TextureRegion
|
||||||
get() = getItemImageFromSingleImage("basegame", "sprites/fixtures/smelter_basic.tga")
|
get() = getItemImageFromSingleImage("basegame", "sprites/fixtures/smelter_tall.tga")
|
||||||
|
|
||||||
override var baseToolSize: Double? = baseMass
|
override var baseToolSize: Double? = baseMass
|
||||||
override var originalName = "ITEM_SMELTER_BASIC"
|
override var originalName = "ITEM_SMELTER_BASIC"
|
||||||
|
|||||||
BIN
work_files/graphics/sprites/fixtures/smelter_tall.kra
LFS
Normal file
BIN
work_files/graphics/sprites/fixtures/smelter_tall.kra
LFS
Normal file
Binary file not shown.
Reference in New Issue
Block a user