wire ports view

This commit is contained in:
minjaesong
2024-03-07 23:46:30 +09:00
parent 0d09a21028
commit bfaa50aea4
26 changed files with 210 additions and 72 deletions

View File

@@ -73,6 +73,13 @@ open class Electric : FixtureBase {
fun setWireEmissionAt(x: Int, y: Int, emission: Vector2) { wireEmission[pointToBlockBoxIndex(x, y)] = emission }
fun setWireConsumptionAt(x: Int, y: Int, consumption: Vector2) { wireConsumption[pointToBlockBoxIndex(x, y)] = consumption }
fun clearStatus() {
wireSinkTypes.clear()
wireEmitterTypes.clear()
wireEmission.clear()
wireConsumption.clear()
}
// 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()

View File

@@ -31,7 +31,7 @@ interface Reorientable {
/**
* Created by minjaesong on 2024-03-04.
*/
class FixtureSignalBlocker : Electric, Reorientable {
class FixtureLogicSignalBlocker : Electric, Reorientable {
@Transient override val spawnNeedsWall = false
@Transient override val spawnNeedsFloor = false
@@ -44,6 +44,7 @@ class FixtureSignalBlocker : Electric, Reorientable {
override var orientation = 0 // 0 1 2 3
private fun setEmitterAndSink() {
clearStatus()
when (orientation) {
0 -> {
setWireSinkAt(0, 0, "digital_bit")

View File

@@ -11,7 +11,7 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
/**
* Created by minjaesong on 2024-03-01.
*/
class FixtureSignalBulb : Electric {
class FixtureLogicSignalBulb : Electric {
@Transient override val spawnNeedsFloor = false

View File

@@ -13,7 +13,7 @@ import org.dyn4j.geometry.Vector2
*
* Created by minjaesong on 2024-03-05.
*/
class FixtureSignalLatch : Electric, Reorientable {
class FixtureLogicSignalLatch : Electric, Reorientable {
@Transient override val spawnNeedsWall = false
@Transient override val spawnNeedsFloor = false
@@ -26,6 +26,7 @@ class FixtureSignalLatch : Electric, Reorientable {
override var orientation = 0 // 0 2, where 2 is a mirror-image rather than rotation
private fun setEmitterAndSink() {
clearStatus()
when (orientation) {
0 -> {
setWireSinkAt(0, 0, "digital_bit") // D

View File

@@ -1,20 +1,18 @@
package net.torvald.terrarum.modulebasegame.gameactors
import net.torvald.spriteanimation.SheetSpriteAnimation
import net.torvald.terrarum.App
import net.torvald.terrarum.TerrarumAppConfiguration
import net.torvald.terrarum.gameactors.AVKey
import net.torvald.terrarum.langpack.Lang
import net.torvald.terrarum.modulebasegame.gameitems.FixtureItemBase
import net.torvald.terrarum.toInt
import net.torvald.terrarum.ui.MouseLatch
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
import org.dyn4j.geometry.Vector2
/**
* Created by minjaesong on 2024-03-01.
*/
class FixtureSignalSwitchManual : Electric {
class FixtureLogicSignalSwitchManual : Electric {
@Transient override val spawnNeedsFloor = false