fix: placing a switch also flips it up as soon as it's been placed

This commit is contained in:
minjaesong
2024-03-05 05:50:20 +09:00
parent 5b5534bcb9
commit bb1a45db27
4 changed files with 13 additions and 4 deletions

View File

@@ -76,8 +76,9 @@ open class Electric : FixtureBase {
// these are characteristic properties of the fixture (they have constant value) so must not be serialised
@Transient val wireEmitterTypes: HashMap<BlockBoxIndex, WireEmissionType> = HashMap()
@Transient val wireSinkTypes: HashMap<BlockBoxIndex, WireEmissionType> = HashMap()
@Transient val wireEmission: HashMap<BlockBoxIndex, Vector2> = HashMap()
@Transient val wireConsumption: HashMap<BlockBoxIndex, Vector2> = HashMap()
val wireEmission: HashMap<BlockBoxIndex, Vector2> = HashMap()
val wireConsumption: HashMap<BlockBoxIndex, Vector2> = HashMap()
// these are NOT constant so they ARE serialised. Type: Map<SinkType (String) -> Charge (Double>
// Use case: signal buffer (sinkType=digital_bit), battery (sinkType=electricity), etc.

View File

@@ -35,6 +35,10 @@ class FixtureLogicSignalEmitter : Electric {
setWireEmissionAt(0, 0, Vector2(1.0, 0.0))
}
override fun updateSignal() {
setWireEmissionAt(0, 0, Vector2(1.0, 0.0))
}
override fun dispose() { }
companion object {

View File

@@ -28,7 +28,9 @@ class FixtureMusicalTurntable : Electric, PlaysMusic {
constructor() : super(
BlockBox(BlockBox.NO_COLLISION, 1, 1),
nameFun = { Lang["ITEM_TURNTABLE"] }
)
) {
clickLatch.forceLatch()
}
@Transient var musicNowPlaying: MusicContainer? = null; private set

View File

@@ -21,7 +21,9 @@ class FixtureSignalSwitchManual : Electric {
constructor() : super(
BlockBox(BlockBox.NO_COLLISION, 1, 1),
nameFun = { Lang["ITEM_LOGIC_SIGNAL_SWITCH"] }
)
) {
clickLatch.forceLatch()
}
private val variant = (Math.random() * 8).toInt()
private var state = false // false = off