mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 12:34:05 +09:00
cut-down version of crafting ui wip
This commit is contained in:
@@ -11,6 +11,7 @@ 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.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
@@ -23,7 +24,8 @@ class FixtureFurnaceAndAnvil : FixtureBase, CraftingStation {
|
||||
|
||||
constructor() : super(
|
||||
BlockBox(BlockBox.NO_COLLISION, 3, 2), // temporary value, will be overwritten by spawn()
|
||||
nameFun = { Lang["ITEM_FURNACE_AND_ANVIL"] }
|
||||
nameFun = { Lang["ITEM_FURNACE_AND_ANVIL"] },
|
||||
mainUI = UICrafting(null)
|
||||
) {
|
||||
CommonResourcePool.addToLoadingList("particles-tiki_smoke.tga") {
|
||||
TextureRegionPack(ModMgr.getGdxFile("basegame", "particles/bigger_smoke.tga"), 16, 16)
|
||||
@@ -45,10 +47,6 @@ class FixtureFurnaceAndAnvil : FixtureBase, CraftingStation {
|
||||
}
|
||||
|
||||
actorValue[AVKey.BASEMASS] = 100.0
|
||||
|
||||
mainUIopenFun = { ui ->
|
||||
(mainUI as? UIInventoryFull)?.openCrafting(mainUI!!.handler)
|
||||
}
|
||||
}
|
||||
|
||||
@Transient override var lightBoxList = arrayListOf(Lightbox(Hitbox(0.0, 0.0, TerrarumAppConfiguration.TILE_SIZED * 2, TerrarumAppConfiguration.TILE_SIZED * 2), Cvec(0.5f, 0.18f, 0f, 0f)))
|
||||
@@ -70,16 +68,7 @@ class FixtureFurnaceAndAnvil : FixtureBase, CraftingStation {
|
||||
private var nextDelay = 0.25f
|
||||
private var spawnTimer = 0f
|
||||
|
||||
@Transient private var mainUIhookHackInstalled = false
|
||||
override fun update(delta: Float) {
|
||||
// adding UI to the fixture as players may right-click on the workbenches instead of pressing a keyboard key
|
||||
(INGAME as? TerrarumIngame)?.let { ingame ->
|
||||
if (!mainUIhookHackInstalled && ingame.uiInventoryPlayerReady) {
|
||||
mainUIhookHackInstalled = true
|
||||
this.mainUI = ingame.uiInventoryPlayer // this field is initialised only after a full load so this hack is necessary
|
||||
}
|
||||
}
|
||||
|
||||
super.update(delta)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user