mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-09 21:31:51 +09:00
smelter lightbox depends on its internal temperature
This commit is contained in:
@@ -13,13 +13,9 @@ import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameactors.Hitbox
|
||||
import net.torvald.terrarum.gameactors.Lightbox
|
||||
import net.torvald.terrarum.gamecontroller.KeyToggler
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
import net.torvald.terrarum.gameparticles.ParticleVanishingSprite
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.gameitems.FixtureItemBase
|
||||
import net.torvald.terrarum.modulebasegame.ui.UICrafting
|
||||
import net.torvald.terrarum.modulebasegame.ui.UIInventoryFull
|
||||
import net.torvald.terrarum.modulebasegame.ui.UISmelterBasic
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
@@ -80,6 +76,8 @@ class FixtureSmelterBasic : FixtureBase, CraftingStation {
|
||||
this.mainUI = UISmelterBasic(this)
|
||||
}
|
||||
|
||||
@Transient val light = 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(
|
||||
@@ -265,8 +263,15 @@ class FixtureSmelterBasic : FixtureBase, CraftingStation {
|
||||
progress = 0f
|
||||
}
|
||||
|
||||
// update lightbox
|
||||
lightBoxList.forEach {
|
||||
it.light = light.cpy().mul(temperature)
|
||||
}
|
||||
|
||||
spawnTimer += delta
|
||||
if (temperature > 0.001f)
|
||||
spawnTimer += delta
|
||||
else
|
||||
spawnTimer = 0f
|
||||
}
|
||||
|
||||
}
|
||||
@@ -155,14 +155,9 @@ class UICrafting(val full: UIInventoryFull?) : UICanvas(
|
||||
val recipe = recipe as CraftingCodex.CraftingRecipe
|
||||
|
||||
// change selected recipe to mostViableRecipe then update the UIs accordingly
|
||||
// FIXME recipe highlighting will not change correctly!
|
||||
val selectedItems = ArrayList<ItemID>()
|
||||
|
||||
// auto-dial the spinner so that player would just have to click the Craft! button (for the most time, that is)
|
||||
val howManyRequired = craftMult * amount
|
||||
val howManyPlayerHas = player.searchByID(gameItem.dynamicID)?.qty ?: 0
|
||||
val howManyPlayerMightNeed = ceil((howManyRequired - howManyPlayerHas).toDouble() / recipe.moq).toLong()
|
||||
resetSpinner(howManyPlayerMightNeed.coerceIn(1L, App.getConfigInt("basegame:gameplay_max_crafting").toLong()))
|
||||
resetSpinner()
|
||||
|
||||
ingredients.clear()
|
||||
recipeClicked = recipe
|
||||
@@ -372,10 +367,10 @@ class UICrafting(val full: UIInventoryFull?) : UICanvas(
|
||||
refreshCraftButtonStatus()
|
||||
}
|
||||
|
||||
private fun resetSpinner(value: Long = 1L) {
|
||||
private fun resetSpinner() {
|
||||
spinnerCraftCount.resetToSmallest()
|
||||
itemListIngredients.numberMultiplier = value
|
||||
itemListCraftable.numberMultiplier = value
|
||||
itemListIngredients.numberMultiplier = 1L
|
||||
itemListCraftable.numberMultiplier = 1L
|
||||
}
|
||||
|
||||
private var openingClickLatched = false
|
||||
|
||||
@@ -83,7 +83,7 @@ class UIItemSpinner(
|
||||
fboUpdateLatch = true
|
||||
}
|
||||
|
||||
private fun changeValueBy(diff: Int) {
|
||||
fun changeValueBy(diff: Int) {
|
||||
currentIndex = (currentIndex + diff).coerceIn(values.indices)
|
||||
value = values[currentIndex]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user