mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
wire ports view
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -32,8 +32,8 @@ id;classname;tags
|
||||
31;net.torvald.terrarum.modulebasegame.gameitems.ItemGunpowder;POWDER,EXPLOSIVE
|
||||
32;net.torvald.terrarum.modulebasegame.gameitems.ItemCherryBomb;EXPLOSIVE,THROWABLE
|
||||
33;net.torvald.terrarum.modulebasegame.gameitems.ItemTorch;FIXTURE,LIGHT
|
||||
34;net.torvald.terrarum.modulebasegame.gameitems.ItemSignalSwitchManual;FIXTURE,SIGNAL
|
||||
35;net.torvald.terrarum.modulebasegame.gameitems.ItemSignalBulb;FIXTURE,SIGNAL
|
||||
34;net.torvald.terrarum.modulebasegame.gameitems.ItemLogicSignalSwitchManual;FIXTURE,SIGNAL
|
||||
35;net.torvald.terrarum.modulebasegame.gameitems.ItemLogicSignalBulb;FIXTURE,SIGNAL
|
||||
36;net.torvald.terrarum.modulebasegame.gameitems.ItemWireRollingMill;FIXTURE,CRAFTING
|
||||
37;net.torvald.terrarum.modulebasegame.gameitems.ItemStorageChestEbony;FIXTURE,STORAGE
|
||||
38;net.torvald.terrarum.modulebasegame.gameitems.ItemStorageChestBirch;FIXTURE,STORAGE
|
||||
@@ -42,8 +42,8 @@ id;classname;tags
|
||||
41;net.torvald.terrarum.modulebasegame.gameitems.ItemTableEbony;FIXTURE,SURFACE
|
||||
42;net.torvald.terrarum.modulebasegame.gameitems.ItemTableBirch;FIXTURE,SURFACE
|
||||
43;net.torvald.terrarum.modulebasegame.gameitems.ItemTableRosewood;FIXTURE,SURFACE
|
||||
44;net.torvald.terrarum.modulebasegame.gameitems.ItemSignalBlocker;FIXTURE,SIGNAL
|
||||
45;net.torvald.terrarum.modulebasegame.gameitems.ItemSignalLatch;FIXTURE,SIGNAL
|
||||
44;net.torvald.terrarum.modulebasegame.gameitems.ItemLogicSignalBlocker;FIXTURE,SIGNAL
|
||||
45;net.torvald.terrarum.modulebasegame.gameitems.ItemLogicSignalLatch;FIXTURE,SIGNAL
|
||||
|
||||
# ingots
|
||||
26;net.torvald.terrarum.modulebasegame.gameitems.IngotSteel;INGOT
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
5
assets/mods/basegame/wires/wireports.csv
Normal file
5
assets/mods/basegame/wires/wireports.csv
Normal file
@@ -0,0 +1,5 @@
|
||||
"accepts";"fileModule";"file";"xpos";"ypos"
|
||||
"digital_bit";"basegame";"wires/ports.tga";0;0
|
||||
"power_low";"basegame";"wires/ports.tga";1;0
|
||||
"power_high";"basegame";"wires/ports.tga";2;0
|
||||
"10base2";"basegame";"wires/ports.tga";2;0
|
||||
|
@@ -565,6 +565,7 @@ object ModMgr {
|
||||
Terrarum.wireCodex.fromModule(module, "wires/") { wire ->
|
||||
|
||||
}
|
||||
Terrarum.wireCodex.portsFromModule(module, "wires/")
|
||||
}
|
||||
|
||||
private fun makeNewItemObj(tile: BlockProp, isWall: Boolean) = object : GameItem(
|
||||
|
||||
@@ -12,13 +12,13 @@ object ReferencingRanges {
|
||||
val ITEMS_DYNAMIC = 0x10_0000..0x0FFF_FFFF // 267 386 880 pseudo-items
|
||||
val ACTORS = 0x1000_0000..0x7FFE_FFFF
|
||||
|
||||
// there is a gap between 0x7FFF_0000..0x7FFF_BFFF
|
||||
// there is a gap between 0x7FFF_0000..0x7FFF_7FFF
|
||||
|
||||
// IDs doesn't effect the render order at all, but we're kinda enforcing these ID ranging.
|
||||
// However, these two wire-related actor will break the rule. But as we want them to render on top of others
|
||||
// in the same render orders, we're giveng them relatively high IDs for them.
|
||||
val ACTORS_WIRES = 0x7FFF_C000..0x7FFF_EFFF // Rendered front--wires
|
||||
val ACTORS_WIRES_HELPER = 0x7FFF_F000..0x7FFF_FEFF // Rendered overlay--wiring port icons and logic gates
|
||||
val ACTORS_WIRE_PORTS = 0x7FFF_8000..0x7FFF_BEFF // Rendered front--wires
|
||||
val ACTORS_WIRES = 0x7FFF_BF00..0x7FFF_FEFF // Rendered overlay--wiring port icons
|
||||
|
||||
val ACTORS_INTERNAL_USE = 0x7FFF_FF00..0x7FFF_FFFF // Actor ID 0x7FFF_FFFF is pre-assigned to the block cursor!
|
||||
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
package net.torvald.terrarum.blockproperties
|
||||
|
||||
import com.badlogic.gdx.files.FileHandle
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.gameitems.GameItem
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.WireEmissionType
|
||||
import net.torvald.terrarum.utils.CSVFetcher
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
import org.apache.commons.csv.CSVRecord
|
||||
@@ -17,9 +19,10 @@ import java.io.IOException
|
||||
class WireCodex {
|
||||
|
||||
@Transient val wireProps = HashMap<ItemID, WireProp>()
|
||||
|
||||
@Transient private val nullProp = WireProp()
|
||||
|
||||
@Transient val wirePorts = HashMap<WireEmissionType, Triple<TextureRegionPack, Int, Int>>()
|
||||
|
||||
fun clear() {
|
||||
wireProps.clear()
|
||||
}
|
||||
@@ -81,6 +84,45 @@ class WireCodex {
|
||||
|
||||
}
|
||||
|
||||
fun portsFromModule(module: String, path: String) {
|
||||
printdbg(this, "Building wire ports table for module $module")
|
||||
try {
|
||||
registerPorts(module, path, CSVFetcher.readFromModule(module, path + "wireports.csv"))
|
||||
}
|
||||
catch (e: IOException) { e.printStackTrace() }
|
||||
}
|
||||
|
||||
private fun registerPorts(module: String, path: String, records: List<CSVRecord>) {
|
||||
val spriteSheetFiles = ArrayList<Pair<FileHandle, String>>()
|
||||
val tempRecords = HashMap<WireEmissionType, Triple<String, Int, Int>>()
|
||||
|
||||
records.forEach {
|
||||
val type = it.get("accepts")
|
||||
val fileModule = it.get("fileModule")
|
||||
val filePath = it.get("file")
|
||||
val x = it.get("xpos").toInt()
|
||||
val y = it.get("ypos").toInt()
|
||||
|
||||
val file = ModMgr.getGdxFile(fileModule, filePath)
|
||||
val fileID = "wireport:$fileModule.${filePath.replace('\\','/')}"
|
||||
|
||||
spriteSheetFiles.add(file to fileID)
|
||||
|
||||
tempRecords[type] = Triple(fileID, x, y)
|
||||
}
|
||||
|
||||
spriteSheetFiles.forEach { (file, id) ->
|
||||
CommonResourcePool.addToLoadingList(id) {
|
||||
TextureRegionPack(file, TILE_SIZE, TILE_SIZE)
|
||||
}
|
||||
}
|
||||
CommonResourcePool.loadAll()
|
||||
|
||||
tempRecords.forEach { type, (fileID, x, y) ->
|
||||
wirePorts[type] = Triple(CommonResourcePool.getAsTextureRegionPack(fileID), x, y)
|
||||
}
|
||||
}
|
||||
|
||||
fun getAll() = wireProps.values
|
||||
|
||||
/*fun get(index: Int): WireProp {
|
||||
@@ -159,4 +201,8 @@ class WireCodex {
|
||||
fun getAllWiresThatAccepts(accept: String): List<Pair<ItemID, WireProp>> {
|
||||
return wireProps.filter { it.value.accepts == accept }.toList()
|
||||
}
|
||||
|
||||
fun getWirePortSpritesheet(emissionType: WireEmissionType): Triple<TextureRegionPack, Int, Int>? {
|
||||
return wirePorts[emissionType]
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,15 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
import com.badlogic.gdx.graphics.Color
|
||||
import com.badlogic.gdx.graphics.g2d.SpriteBatch
|
||||
import net.torvald.spriteanimation.SheetSpriteAnimation
|
||||
import net.torvald.terrarum.*
|
||||
import net.torvald.terrarum.App.printdbg
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.WireEmissionType
|
||||
import net.torvald.terrarum.ui.Toolkit
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2024-03-05.
|
||||
@@ -18,15 +23,6 @@ interface InternalActor {
|
||||
*/
|
||||
class WireActor : ActorWithBody, NoSerialise, InternalActor {
|
||||
|
||||
companion object {
|
||||
val WIRE_NEARBY = arrayOf(
|
||||
(+1 to 0), // tileR
|
||||
(0 to +1), // tileB
|
||||
(-1 to 0), // tileL
|
||||
(0 to -1) // tileT
|
||||
)
|
||||
}
|
||||
|
||||
private constructor()
|
||||
|
||||
constructor(id: ActorID) : super(RenderOrder.OVERLAY, PhysProperties.IMMOBILE(), id)
|
||||
@@ -39,7 +35,6 @@ class WireActor : ActorWithBody, NoSerialise, InternalActor {
|
||||
private var worldX = 0
|
||||
private var worldY = 0
|
||||
|
||||
|
||||
/**
|
||||
* @param itemID must start with "wire@"
|
||||
*/
|
||||
@@ -65,34 +60,77 @@ class WireActor : ActorWithBody, NoSerialise, InternalActor {
|
||||
(sprite as SheetSpriteAnimation).currentFrame = cnx
|
||||
}
|
||||
|
||||
private fun getNearbyTilesPos(x: Int, y: Int): Array<Point2i> {
|
||||
return arrayOf(
|
||||
Point2i(x + 1, y),
|
||||
Point2i(x, y + 1),
|
||||
Point2i(x - 1, y),
|
||||
Point2i(x, y - 1)
|
||||
)
|
||||
override fun updateImpl(delta: Float) {
|
||||
}
|
||||
|
||||
override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
|
||||
if (isVisible && sprite != null) {
|
||||
(sprite as SheetSpriteAnimation).currentRow = (world?.getWireEmitStateOf(worldX, worldY, wireID)?.isNotZero == true).toInt()
|
||||
BlendMode.resolve(drawMode, batch)
|
||||
drawSpriteInGoodPosition(frameDelta, sprite!!, batch)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2024-03-07.
|
||||
*/
|
||||
class WirePortActor : ActorWithBody, NoSerialise, InternalActor {
|
||||
|
||||
|
||||
private constructor()
|
||||
|
||||
constructor(id: ActorID) : super(RenderOrder.OVERLAY, PhysProperties.IMMOBILE(), id)
|
||||
|
||||
init {
|
||||
setHitboxDimension(TILE_SIZE, TILE_SIZE, 0, 0)
|
||||
renderOrder = RenderOrder.OVERLAY
|
||||
}
|
||||
|
||||
private var portID: WireEmissionType = ""
|
||||
private var worldX = 0
|
||||
private var worldY = 0
|
||||
|
||||
/**
|
||||
*/
|
||||
fun setPort(emissionType: WireEmissionType, worldX: Int, worldY: Int) {
|
||||
setHitboxDimension(TILE_SIZE, TILE_SIZE, 0, 0)
|
||||
|
||||
if (portID != emissionType) {
|
||||
WireCodex.getWirePortSpritesheet(emissionType)?.let { (sheet, x, y) ->
|
||||
if (sprite == null) {
|
||||
makeNewSprite(sheet).let {
|
||||
it.delays = floatArrayOf(Float.POSITIVE_INFINITY,Float.POSITIVE_INFINITY,Float.POSITIVE_INFINITY,Float.POSITIVE_INFINITY)
|
||||
it.setRowsAndFrames(1, 16)
|
||||
}
|
||||
}
|
||||
else {
|
||||
(sprite as SheetSpriteAnimation).let {
|
||||
it.setSpriteImage(sheet)
|
||||
}
|
||||
}
|
||||
|
||||
(sprite as SheetSpriteAnimation).let {
|
||||
it.currentFrame = x
|
||||
it.currentRow = y
|
||||
}
|
||||
|
||||
portID = emissionType
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
this.worldX = worldX
|
||||
this.worldY = worldY
|
||||
|
||||
setPosition((worldX + 0.5) * TILE_SIZE, (worldY + 1.0) * TILE_SIZE - 1.0) // what the fuck?
|
||||
}
|
||||
|
||||
override fun updateImpl(delta: Float) {
|
||||
}
|
||||
|
||||
override fun drawBody(frameDelta: Float, batch: SpriteBatch) {
|
||||
if (isVisible && sprite != null) {
|
||||
if (WireCodex[wireID].accepts == "digital_3bits") {
|
||||
// "digital_3bits" must come right after three wires it bundles
|
||||
val rootID = wireID.substringBefore(':') + ":"
|
||||
var row = 0
|
||||
(WireCodex[wireID].numericID - 3 .. WireCodex[wireID].numericID - 1).forEachIndexed { index, it ->
|
||||
val itemID = rootID + it
|
||||
row = row or ((world?.getWireEmitStateOf(worldX, worldY, itemID)?.isNotZero == true).toInt() shl index)
|
||||
}
|
||||
(sprite as SheetSpriteAnimation).currentRow = row
|
||||
}
|
||||
else {
|
||||
(sprite as SheetSpriteAnimation).currentRow = (world?.getWireEmitStateOf(worldX, worldY, wireID)?.isNotZero == true).toInt()
|
||||
}
|
||||
|
||||
if (isVisible && sprite != null && (Terrarum.ingame!! as TerrarumIngame).selectedWireRenderClass.isNotBlank()) {
|
||||
BlendMode.resolve(drawMode, batch)
|
||||
drawSpriteInGoodPosition(frameDelta, sprite!!, batch)
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@ import net.torvald.terrarum.ui.UICanvas
|
||||
import net.torvald.terrarum.weather.WeatherMixer
|
||||
import net.torvald.terrarum.worlddrawer.BlocksDrawer
|
||||
import net.torvald.terrarum.worlddrawer.FeaturesDrawer
|
||||
import net.torvald.terrarum.worlddrawer.LightmapRenderer.LIGHTMAP_OVERRENDER
|
||||
import net.torvald.terrarum.worlddrawer.WorldCamera
|
||||
import net.torvald.unicode.EMDASH
|
||||
import net.torvald.util.CircularArray
|
||||
@@ -710,7 +709,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
var uiOpened = false
|
||||
val fixtureUnderMouse0: List<FixtureBase> = getActorsUnderMouse(Terrarum.mouseX, Terrarum.mouseY).filterIsInstance<FixtureBase>()
|
||||
if (fixtureUnderMouse0.size > 1) {
|
||||
App.printdbgerr(this, "Multiple fixtures at world coord ${Terrarum.mouseX}, ${Terrarum.mouseY}")
|
||||
App.printdbgerr(this, "Multiple fixtures at tile coord ${Terrarum.mouseX / TILE_SIZED}, ${Terrarum.mouseY / TILE_SIZED}: [${fixtureUnderMouse0.map { it.javaClass.simpleName }.joinToString()}]")
|
||||
}
|
||||
val fixtureUnderMouse = fixtureUnderMouse0.firstOrNull()
|
||||
|
||||
@@ -956,6 +955,12 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
fillUpWiresBuffer()
|
||||
}
|
||||
}
|
||||
measureDebugTime("Ingame.FillUpWirePortsView*") {
|
||||
if (WORLD_UPDATE_TIMER % 2 == 0) {
|
||||
val fixtures = INGAME.actorContainerActive.filterIsInstance<Electric>()
|
||||
fillUpWirePortsView(fixtures)
|
||||
}
|
||||
}
|
||||
oldCamX = WorldCamera.x
|
||||
oldPlayerX = actorNowPlaying?.hitbox?.canonicalX ?: 0.0
|
||||
|
||||
@@ -1227,17 +1232,22 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
}
|
||||
|
||||
private val maxRenderableWires = ReferencingRanges.ACTORS_WIRES.last - ReferencingRanges.ACTORS_WIRES.first + 1
|
||||
private val maxRenderablePorts = ReferencingRanges.ACTORS_WIRE_PORTS.last - ReferencingRanges.ACTORS_WIRE_PORTS.first + 1
|
||||
private val wireActorsContainer = Array(maxRenderableWires) { WireActor(ReferencingRanges.ACTORS_WIRES.first + it).let {
|
||||
forceAddActor(it)
|
||||
/*^let*/ it
|
||||
} }
|
||||
private val wirePortActorsContainer = Array(maxRenderablePorts) { WirePortActor(ReferencingRanges.ACTORS_WIRE_PORTS.first + it).let {
|
||||
forceAddActor(it)
|
||||
/*^let*/ it
|
||||
} }
|
||||
|
||||
private fun fillUpWiresBuffer() {
|
||||
val for_y_start = (WorldCamera.y.toFloat() / TILE_SIZE).floorToInt() - LIGHTMAP_OVERRENDER
|
||||
val for_y_end = for_y_start + BlocksDrawer.tilesInVertical + 2*LIGHTMAP_OVERRENDER
|
||||
val for_y_start = (WorldCamera.y.toFloat() / TILE_SIZE).floorToInt() - 1
|
||||
val for_y_end = for_y_start + BlocksDrawer.tilesInVertical + 2*1
|
||||
|
||||
val for_x_start = (WorldCamera.x.toFloat() / TILE_SIZE).floorToInt() - LIGHTMAP_OVERRENDER
|
||||
val for_x_end = for_x_start + BlocksDrawer.tilesInHorizontal + 2*LIGHTMAP_OVERRENDER
|
||||
val for_x_start = (WorldCamera.x.toFloat() / TILE_SIZE).floorToInt() - 1
|
||||
val for_x_end = for_x_start + BlocksDrawer.tilesInHorizontal + 2*1
|
||||
|
||||
var wiringCounter = 0
|
||||
for (y in for_y_start..for_y_end) {
|
||||
@@ -1269,9 +1279,39 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
}
|
||||
|
||||
for (i in wiringCounter until maxRenderableWires) {
|
||||
wireActorsContainer[i].isUpdate = false
|
||||
wireActorsContainer[i].isVisible = false
|
||||
wireActorsContainer[i].forceDormant = true
|
||||
val wireActor = wireActorsContainer[i]
|
||||
wireActor.isUpdate = false
|
||||
wireActor.isVisible = false
|
||||
wireActor.forceDormant = true
|
||||
}
|
||||
}
|
||||
|
||||
private fun fillUpWirePortsView(fixtures: List<Electric>) {
|
||||
var portsCounter = 0
|
||||
|
||||
fixtures.forEach {
|
||||
(it.wireSinkTypes.toList() + it.wireEmitterTypes.toList()).forEach { (boxIndex, type) ->
|
||||
if (portsCounter < wirePortActorsContainer.size) {
|
||||
val wireActor = wirePortActorsContainer[portsCounter]
|
||||
val (wx, wy) = it.worldBlockPos!! + it.blockBoxIndexToPoint2i(boxIndex)
|
||||
|
||||
wireActor.setPort(type, wx, wy)
|
||||
wireActor.isUpdate = true
|
||||
wireActor.isVisible = true
|
||||
wireActor.forceDormant = false
|
||||
|
||||
portsCounter += 1
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (i in portsCounter until maxRenderablePorts) {
|
||||
val wireActor = wirePortActorsContainer[i]
|
||||
wireActor.isUpdate = false
|
||||
wireActor.isVisible = false
|
||||
wireActor.forceDormant = true
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1641,8 +1681,6 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
}
|
||||
|
||||
fun pickupFixture(actor: ActorWithBody, delta: Float, mwx: Double, mwy: Double, mtx: Int, mty: Int, assignToQuickslot: Boolean = true) {
|
||||
printdbg(this, "Pickup fixture fired")
|
||||
|
||||
val actorsUnderMouse = getActorsUnderMouse(mwx, mwy)
|
||||
|
||||
val fixture = actorsUnderMouse.firstOrNull {
|
||||
|
||||
@@ -501,7 +501,7 @@ object WorldSimulator {
|
||||
wiresimGetSourceBlocks().let { sources ->
|
||||
// signal-emitting fixtures must set emitState of its own tiles via update()
|
||||
sources.forEach {
|
||||
it.wireEmitterTypes.forEach { bbi, wireType ->
|
||||
it.wireEmitterTypes.forEach { (bbi, wireType) ->
|
||||
|
||||
val startingPoint = it.worldBlockPos!! + it.blockBoxIndexToPoint2i(bbi)
|
||||
val signal = it.wireEmission[bbi] ?: Vector2(0.0, 0.0)
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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")
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -11,7 +11,7 @@ import net.torvald.terrarum.modulebasegame.gameactors.FixtureLogicSignalEmitter
|
||||
/**
|
||||
* Created by minjaesong on 2024-03-04.
|
||||
*/
|
||||
class ItemSignalBlocker(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulebasegame.gameactors.FixtureSignalBlocker") {
|
||||
class ItemLogicSignalBlocker(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulebasegame.gameactors.FixtureLogicSignalBlocker") {
|
||||
|
||||
override var dynamicID: ItemID = originalID
|
||||
override var baseMass = FixtureLogicSignalEmitter.MASS
|
||||
@@ -38,7 +38,7 @@ class ItemSignalBlocker(originalID: ItemID) : FixtureItemBase(originalID, "net.t
|
||||
/**
|
||||
* Created by minjaesong on 2024-03-05.
|
||||
*/
|
||||
class ItemSignalLatch(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulebasegame.gameactors.FixtureSignalLatch") {
|
||||
class ItemLogicSignalLatch(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulebasegame.gameactors.FixtureLogicSignalLatch") {
|
||||
|
||||
override var dynamicID: ItemID = originalID
|
||||
override var baseMass = FixtureLogicSignalEmitter.MASS
|
||||
@@ -11,7 +11,7 @@ import net.torvald.terrarum.modulebasegame.gameactors.FixtureLogicSignalEmitter
|
||||
/**
|
||||
* Created by minjaesong on 2024-03-01.
|
||||
*/
|
||||
class ItemSignalBulb(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulebasegame.gameactors.FixtureSignalBulb") {
|
||||
class ItemLogicSignalBulb(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulebasegame.gameactors.FixtureLogicSignalBulb") {
|
||||
|
||||
override var dynamicID: ItemID = originalID
|
||||
override var baseMass = FixtureLogicSignalEmitter.MASS
|
||||
@@ -11,7 +11,7 @@ import net.torvald.terrarum.modulebasegame.gameactors.FixtureLogicSignalEmitter
|
||||
/**
|
||||
* Created by minjaesong on 2024-03-01.
|
||||
*/
|
||||
class ItemSignalSwitchManual(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulebasegame.gameactors.FixtureSignalSwitchManual") {
|
||||
class ItemLogicSignalSwitchManual(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulebasegame.gameactors.FixtureLogicSignalSwitchManual") {
|
||||
|
||||
override var dynamicID: ItemID = originalID
|
||||
override var baseMass = FixtureLogicSignalEmitter.MASS
|
||||
BIN
work_files/graphics/wires/ports.kra
LFS
Normal file
BIN
work_files/graphics/wires/ports.kra
LFS
Normal file
Binary file not shown.
Reference in New Issue
Block a user