worldportal ui fix

This commit is contained in:
minjaesong
2024-10-31 10:53:11 +09:00
parent 4cc74a85d1
commit fa3a129991
4 changed files with 7 additions and 8 deletions

View File

@@ -1,6 +1,7 @@
package net.torvald.terrarum.modulebasegame.gameactors
import net.torvald.terrarum.*
import net.torvald.terrarum.App.printdbg
import net.torvald.terrarum.gameactors.ActorID
import net.torvald.terrarum.gameactors.PhysProperties
import net.torvald.terrarum.ui.UICanvas
@@ -167,15 +168,9 @@ open class Electric : FixtureBase {
for (x in 0 until blockBox.width) {
// get indices of "rising edges"
// get indices of "falling edges"
val wx = x + worldBlockPos!!.x
val wy = y + worldBlockPos!!.y
val new = WireCodex.getAllWiresThatAccepts(getWireSinkAt(x, y) ?: "").fold(Vector2()) { acc, (id, _) ->
INGAME.world.getWireEmitStateOf(wx, wy, id).let {
Vector2(acc.x + (it?.x ?: 0.0), acc.y + (it?.y ?: 0.0))
}
}
val index = pointToBlockBoxIndex(x, y)
val type = getWireSinkAt(index) ?: ""
val new = getWireStateAt(x, y, type)
if (new.x - oldSinkStatus[index].x >= ELECTRIC_THRESHOLD_EDGE_DELTA && new.x >= ELECTRIC_THRESHOLD_HIGH)
risingEdgeIndices.add(index)

View File

@@ -62,6 +62,8 @@ class FixtureWorldPortal : Electric {
}
override fun onRisingEdge(readFrom: BlockBoxIndex) {
printdbg(this, "readFrom=$readFrom; getWireSinkAt(readFrom)=${getWireSinkAt(readFrom)}")
if (getWireSinkAt(readFrom) != "digital_bit") return

View File

@@ -136,6 +136,7 @@ class UIWorldPortalSearch(val full: UIWorldPortal) : UICanvas() {
override fun show() {
clearTooltip()
uiItems.forEach { it.show() }
seedInput.clearText()
seedInput.refreshPlaceholder()

View File

@@ -136,6 +136,7 @@ abstract class UICanvas(
/** A function that is run ONCE when the UI is requested to be opened; will work identical to [endOpening] if [openCloseTime] is zero */
open fun show() {
clearTooltip()
openingClickLatched = true
uiItems.forEach { it.show() }
handler.subUIs.forEach { it.show() }