mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
fix: placing a switch also flips it up as soon as it's been placed
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user