mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 18:44:05 +09:00
fix: two clashing signal switches confusing the wire sim
This commit is contained in:
@@ -524,9 +524,17 @@ open class GameWorld(
|
|||||||
if (wiringGraph[blockAddr]!![itemID] == null)
|
if (wiringGraph[blockAddr]!![itemID] == null)
|
||||||
wiringGraph[blockAddr]!![itemID] = WiringSimCell(0, vector)
|
wiringGraph[blockAddr]!![itemID] = WiringSimCell(0, vector)
|
||||||
|
|
||||||
wiringGraph[blockAddr]!![itemID]!!.emt.set(vector)
|
// out = max(old, new)
|
||||||
|
val old = wiringGraph[blockAddr]!![itemID]!!.emt
|
||||||
|
|
||||||
|
wiringGraph[blockAddr]!![itemID]!!.emt.set(old max vector)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private infix fun Vector2.max(other: Vector2) = Vector2(
|
||||||
|
maxOf(this.x, other.x),
|
||||||
|
maxOf(this.y, other.y)
|
||||||
|
)
|
||||||
|
|
||||||
fun addWireRecvStateOf(x: Int, y: Int, itemID: ItemID, state: WireReceptionState) {
|
fun addWireRecvStateOf(x: Int, y: Int, itemID: ItemID, state: WireReceptionState) {
|
||||||
val (x, y) = coerceXY(x, y)
|
val (x, y) = coerceXY(x, y)
|
||||||
val blockAddr = LandUtil.getBlockAddr(this, x, y)
|
val blockAddr = LandUtil.getBlockAddr(this, x, y)
|
||||||
|
|||||||
Reference in New Issue
Block a user