mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 03:54:06 +09:00
worldportal ui fix
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
package net.torvald.terrarum.modulebasegame.gameactors
|
package net.torvald.terrarum.modulebasegame.gameactors
|
||||||
|
|
||||||
import net.torvald.terrarum.*
|
import net.torvald.terrarum.*
|
||||||
|
import net.torvald.terrarum.App.printdbg
|
||||||
import net.torvald.terrarum.gameactors.ActorID
|
import net.torvald.terrarum.gameactors.ActorID
|
||||||
import net.torvald.terrarum.gameactors.PhysProperties
|
import net.torvald.terrarum.gameactors.PhysProperties
|
||||||
import net.torvald.terrarum.ui.UICanvas
|
import net.torvald.terrarum.ui.UICanvas
|
||||||
@@ -167,15 +168,9 @@ open class Electric : FixtureBase {
|
|||||||
for (x in 0 until blockBox.width) {
|
for (x in 0 until blockBox.width) {
|
||||||
// get indices of "rising edges"
|
// get indices of "rising edges"
|
||||||
// get indices of "falling 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 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)
|
if (new.x - oldSinkStatus[index].x >= ELECTRIC_THRESHOLD_EDGE_DELTA && new.x >= ELECTRIC_THRESHOLD_HIGH)
|
||||||
risingEdgeIndices.add(index)
|
risingEdgeIndices.add(index)
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ class FixtureWorldPortal : Electric {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onRisingEdge(readFrom: BlockBoxIndex) {
|
override fun onRisingEdge(readFrom: BlockBoxIndex) {
|
||||||
|
printdbg(this, "readFrom=$readFrom; getWireSinkAt(readFrom)=${getWireSinkAt(readFrom)}")
|
||||||
|
|
||||||
if (getWireSinkAt(readFrom) != "digital_bit") return
|
if (getWireSinkAt(readFrom) != "digital_bit") return
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -136,6 +136,7 @@ class UIWorldPortalSearch(val full: UIWorldPortal) : UICanvas() {
|
|||||||
|
|
||||||
|
|
||||||
override fun show() {
|
override fun show() {
|
||||||
|
clearTooltip()
|
||||||
uiItems.forEach { it.show() }
|
uiItems.forEach { it.show() }
|
||||||
seedInput.clearText()
|
seedInput.clearText()
|
||||||
seedInput.refreshPlaceholder()
|
seedInput.refreshPlaceholder()
|
||||||
|
|||||||
@@ -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 */
|
/** 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() {
|
open fun show() {
|
||||||
|
clearTooltip()
|
||||||
openingClickLatched = true
|
openingClickLatched = true
|
||||||
uiItems.forEach { it.show() }
|
uiItems.forEach { it.show() }
|
||||||
handler.subUIs.forEach { it.show() }
|
handler.subUIs.forEach { it.show() }
|
||||||
|
|||||||
Reference in New Issue
Block a user