mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-09 18:14:06 +09:00
seven seg display
This commit is contained in:
@@ -43,6 +43,12 @@
|
|||||||
[1, 15, "$ROCK", 10, "item@basegame:25", 15, "item@basegame:113"] /* 1 smelter = 15 rocks, 10 clay balls, 15 iron ingot */
|
[1, 15, "$ROCK", 10, "item@basegame:25", 15, "item@basegame:113"] /* 1 smelter = 15 rocks, 10 clay balls, 15 iron ingot */
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"item@basegame:51": { /* electric workbench */
|
||||||
|
"workbench": "basiccrafting",
|
||||||
|
"ingredients": [
|
||||||
|
[1, 12, "$WOOD", 5, "item@basegame:113"] /* 12 wood, 5 iron */
|
||||||
|
]
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -67,39 +67,45 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
"item@basegame:35": { /* copper bulb */
|
"item@basegame:35": { /* copper bulb */
|
||||||
"workbench": "basiccrafting",
|
"workbench": "soldering",
|
||||||
"ingredients": [
|
"ingredients": [
|
||||||
[2, 1, "item@basegame:112", 1, "item@basegame:113"] /* 1 copper, 1 iron */
|
[2, 1, "item@basegame:112", 1, "item@basegame:113", 1, "item@basegame:50"] /* 1 copper, 1 iron, 1 soldering wire (temporary) */
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"item@basegame:44": { /* signal blocker */
|
"item@basegame:44": { /* signal blocker */
|
||||||
"workbench": "basiccrafting",
|
"workbench": "soldering",
|
||||||
"ingredients": [
|
"ingredients": [
|
||||||
[1, 2, "$ROCK", 1, "item@basegame:116", 1, "item@basegame:112"] /* 2 rocks, 1 tin, 1 copper */
|
[1, 2, "$ROCK", 1, "$SEMICONDUCTOR", 1, "item@basegame:112", 1, "item@basegame:50"] /* 2 rocks, 1 tin, 1 copper, 1 soldering wire (temporary) */
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"item@basegame:45": { /* signal latch */
|
"item@basegame:45": { /* signal latch */
|
||||||
"workbench": "basiccrafting",
|
"workbench": "soldering",
|
||||||
"ingredients": [
|
"ingredients": [
|
||||||
[1, 3, "$ROCK", 1, "item@basegame:116", 2, "item@basegame:112"] /* 3 rocks, 3 tin, 3 copper */
|
[1, 3, "$ROCK", 1, "$SEMICONDUCTOR", 2, "item@basegame:112", 1, "item@basegame:50"] /* 3 rocks, 3 tin, 3 copper, 1 soldering wire (temporary) */
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"item@basegame:8": { /* signal emitter */
|
"item@basegame:8": { /* signal emitter */
|
||||||
"workbench": "basiccrafting",
|
"workbench": "soldering",
|
||||||
"ingredients": [
|
"ingredients": [
|
||||||
[2, 1, "$ROCK", 1, "item@basegame:116"] /* 1 rocks, 1 tin, 1 copper */
|
[2, 1, "$ROCK", 1, "$SEMICONDUCTOR", 1, "item@basegame:50"] /* 1 rocks, 1 tin, 1 copper, 1 soldering wire (temporary) */
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"item@basegame:46": { /* signal repeater */
|
"item@basegame:46": { /* signal repeater */
|
||||||
"workbench": "basiccrafting",
|
"workbench": "soldering",
|
||||||
"ingredients": [
|
"ingredients": [
|
||||||
[1, 1, "$ROCK", 1, "item@basegame:116"] /* 1 rocks, 1 tin, 1 copper */
|
[1, 1, "$ROCK", 1, "$SEMICONDUCTOR", 1, "item@basegame:50"] /* 1 rocks, 1 tin, 1 copper, 1 soldering wire (temporary) */
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"item@basegame:49": { /* signal adder */
|
"item@basegame:49": { /* signal adder */
|
||||||
"workbench": "basiccrafting",
|
"workbench": "soldering",
|
||||||
"ingredients": [
|
"ingredients": [
|
||||||
[1, 1, "$ROCK", 1, "item@basegame:116"] /* 2 rocks, 2 tin, 2 copper */
|
[1, 1, "$ROCK", 1, "$SEMICONDUCTOR", 1, "item@basegame:50"] /* 2 rocks, 2 tin, 2 copper, 1 soldering wire (temporary) */
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"item@basegame:52": { /* seven seg disp */
|
||||||
|
"workbench": "soldering",
|
||||||
|
"ingredients": [
|
||||||
|
[1, 4, "$ROCK", 7, "item@basegame:35", 5, "$SEMICONDUCTOR", 2, "item@basegame:112", 1, "item@basegame:50"] /* 4 rocks, 7 copper bulbs, 5 tin, 2 copper, 1 soldering wire (temporary) */
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -50,13 +50,14 @@ id;classname;tags
|
|||||||
49;net.torvald.terrarum.modulebasegame.gameitems.ItemLogicSignalAdder;FIXTURE,SIGNAL
|
49;net.torvald.terrarum.modulebasegame.gameitems.ItemLogicSignalAdder;FIXTURE,SIGNAL
|
||||||
50;net.torvald.terrarum.modulebasegame.gameitems.ItemSolderingWire;
|
50;net.torvald.terrarum.modulebasegame.gameitems.ItemSolderingWire;
|
||||||
51;net.torvald.terrarum.modulebasegame.gameitems.ItemElectricWorkbench;FIXTURE,CRAFTING
|
51;net.torvald.terrarum.modulebasegame.gameitems.ItemElectricWorkbench;FIXTURE,CRAFTING
|
||||||
|
52;net.torvald.terrarum.modulebasegame.gameitems.ItemLogicSignalSevenSeg;FIXTURE,SIGNAL
|
||||||
|
|
||||||
# ingots
|
# ingots
|
||||||
112;net.torvald.terrarum.modulebasegame.gameitems.IngotCopper;INGOT
|
112;net.torvald.terrarum.modulebasegame.gameitems.IngotCopper;INGOT
|
||||||
113;net.torvald.terrarum.modulebasegame.gameitems.IngotIron;INGOT
|
113;net.torvald.terrarum.modulebasegame.gameitems.IngotIron;INGOT
|
||||||
114;net.torvald.terrarum.modulebasegame.gameitems.ItemCoalCoke;COMBUSTIBLE
|
114;net.torvald.terrarum.modulebasegame.gameitems.ItemCoalCoke;COMBUSTIBLE
|
||||||
115;net.torvald.terrarum.modulebasegame.gameitems.IngotZinc;INGOT
|
115;net.torvald.terrarum.modulebasegame.gameitems.IngotZinc;INGOT
|
||||||
116;net.torvald.terrarum.modulebasegame.gameitems.IngotTin;INGOT
|
116;net.torvald.terrarum.modulebasegame.gameitems.IngotTin;INGOT,SEMICONDUCTOR
|
||||||
117;net.torvald.terrarum.modulebasegame.gameitems.IngotGold;INGOT
|
117;net.torvald.terrarum.modulebasegame.gameitems.IngotGold;INGOT
|
||||||
118;net.torvald.terrarum.modulebasegame.gameitems.IngotSilver;INGOT
|
118;net.torvald.terrarum.modulebasegame.gameitems.IngotSilver;INGOT
|
||||||
119;net.torvald.terrarum.modulebasegame.gameitems.IngotLead;INGOT
|
119;net.torvald.terrarum.modulebasegame.gameitems.IngotLead;INGOT
|
||||||
@@ -124,12 +125,12 @@ id;classname;tags
|
|||||||
|
|
||||||
# fluids on storage
|
# fluids on storage
|
||||||
# preferably autogenerated
|
# preferably autogenerated
|
||||||
# 10000h..100FFh : Fluid type 0 (water) x container type 0..255
|
# 100000h..1000FFh : Fluid type 0 (water) x container type 0..255
|
||||||
# 10100h..101FFh : Fluid type 1 (lava) x container type 0..255
|
# 100100h..1001FFh : Fluid type 1 (lava) x container type 0..255
|
||||||
# 10200h..102FFh : Fluid type 2 (crude oil) x container type 0..255
|
# 100200h..1002FFh : Fluid type 2 (crude oil) x container type 0..255
|
||||||
# 10300h..103FFh : Fluid type 3 (petroleum) x container type 0..255
|
# 100300h..1003FFh : Fluid type 3 (petroleum) x container type 0..255
|
||||||
# 10400h..104FFh : Fluid type 4 (compressed air) x container type 0..255
|
# 100400h..1004FFh : Fluid type 4 (compressed air) x container type 0..255
|
||||||
# 10500h..105FFh : Fluid type 5 (steam) x container type 0..255
|
# 100500h..1005FFh : Fluid type 5 (steam) x container type 0..255
|
||||||
# ...
|
# ...
|
||||||
# 1FF00h..1FFFFh : Fluid type 255 (???) x container type 0..255
|
# 10FF00h..10FFFFh : Fluid type 255 (???) x container type 0..255
|
||||||
|
|
||||||
|
|||||||
|
Binary file not shown.
@@ -43,6 +43,7 @@
|
|||||||
"ITEM_LOGIC_SIGNAL_BLOCKER": "Logic Signal Blocker",
|
"ITEM_LOGIC_SIGNAL_BLOCKER": "Logic Signal Blocker",
|
||||||
"ITEM_LOGIC_SIGNAL_EMITTER": "Logic Signal Emitter",
|
"ITEM_LOGIC_SIGNAL_EMITTER": "Logic Signal Emitter",
|
||||||
"ITEM_LOGIC_SIGNAL_LATCH": "Logic Signal Latch",
|
"ITEM_LOGIC_SIGNAL_LATCH": "Logic Signal Latch",
|
||||||
|
"ITEM_LOGIC_SIGNAL_NUMERIC_DISPLAY": "Logic Signal Numeric Display",
|
||||||
"ITEM_LOGIC_SIGNAL_REPEATER": "Logic Signal Repeater",
|
"ITEM_LOGIC_SIGNAL_REPEATER": "Logic Signal Repeater",
|
||||||
"ITEM_LOGIC_SIGNAL_SWITCH": "Logic Signal Switch",
|
"ITEM_LOGIC_SIGNAL_SWITCH": "Logic Signal Switch",
|
||||||
"ITEM_LOGS_BIRCH": "Birch Logs",
|
"ITEM_LOGS_BIRCH": "Birch Logs",
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
"ITEM_LOGIC_SIGNAL_BLOCKER": "신호 차단기",
|
"ITEM_LOGIC_SIGNAL_BLOCKER": "신호 차단기",
|
||||||
"ITEM_LOGIC_SIGNAL_EMITTER": "신호발생기",
|
"ITEM_LOGIC_SIGNAL_EMITTER": "신호발생기",
|
||||||
"ITEM_LOGIC_SIGNAL_LATCH": "신호 걸쇠",
|
"ITEM_LOGIC_SIGNAL_LATCH": "신호 걸쇠",
|
||||||
|
"ITEM_LOGIC_SIGNAL_NUMERIC_DISPLAY": "신호 숫자 표시기",
|
||||||
"ITEM_LOGIC_SIGNAL_REPEATER": "신호 리피터",
|
"ITEM_LOGIC_SIGNAL_REPEATER": "신호 리피터",
|
||||||
"ITEM_LOGIC_SIGNAL_SWITCH": "신호 스위치",
|
"ITEM_LOGIC_SIGNAL_SWITCH": "신호 스위치",
|
||||||
"ITEM_LOGS_BIRCH": "백단 통나무",
|
"ITEM_LOGS_BIRCH": "백단 통나무",
|
||||||
|
|||||||
BIN
assets/mods/basegame/sprites/fixtures/sevenseg.tga
LFS
Normal file
BIN
assets/mods/basegame/sprites/fixtures/sevenseg.tga
LFS
Normal file
Binary file not shown.
@@ -0,0 +1,87 @@
|
|||||||
|
package net.torvald.terrarum.modulebasegame.gameactors
|
||||||
|
|
||||||
|
import net.torvald.spriteanimation.SheetSpriteAnimation
|
||||||
|
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||||
|
import net.torvald.terrarum.blockproperties.Block
|
||||||
|
import net.torvald.terrarum.langpack.Lang
|
||||||
|
import net.torvald.terrarum.modulebasegame.gameitems.FixtureItemBase
|
||||||
|
import net.torvald.terrarum.toInt
|
||||||
|
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 2024-03-16.
|
||||||
|
*/
|
||||||
|
class FixtureLogicSignalSevenSeg : Electric {
|
||||||
|
|
||||||
|
@Transient override val spawnNeedsFloor = true
|
||||||
|
@Transient override val spawnNeedsWall = true
|
||||||
|
|
||||||
|
constructor() : super(
|
||||||
|
BlockBox(BlockBox.NO_COLLISION, 4, 4),
|
||||||
|
nameFun = { Lang["ITEM_LOGIC_SIGNAL_DISPLAY"] }
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@Transient private val actorBlocks = arrayOf(
|
||||||
|
arrayOf(null, Block.ACTORBLOCK_NO_COLLISION, Block.ACTORBLOCK_NO_COLLISION, null),
|
||||||
|
arrayOf(null, Block.ACTORBLOCK_NO_COLLISION, Block.ACTORBLOCK_NO_COLLISION, null),
|
||||||
|
arrayOf(null, Block.ACTORBLOCK_NO_COLLISION, Block.ACTORBLOCK_NO_COLLISION, null),
|
||||||
|
arrayOf(Block.ACTORBLOCK_NO_COLLISION, Block.ACTORBLOCK_NO_COLLISION, Block.ACTORBLOCK_NO_COLLISION, Block.ACTORBLOCK_NO_COLLISION),
|
||||||
|
)
|
||||||
|
override fun placeActorBlocks() {
|
||||||
|
forEachBlockbox { x, y, ox, oy ->
|
||||||
|
val tile = actorBlocks[oy][ox]
|
||||||
|
if (tile != null) {
|
||||||
|
world!!.setTileTerrain(x, y, tile, true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
val itemImage = FixtureItemBase.getItemImageFromSingleImage("basegame", "sprites/fixtures/sevenseg.tga")
|
||||||
|
val itemImage2 = FixtureItemBase.getItemImageFromSingleImage("basegame", "sprites/fixtures/sevenseg.tga")
|
||||||
|
|
||||||
|
density = 1400.0
|
||||||
|
setHitboxDimension(4*TILE_SIZE, 4*TILE_SIZE, 0, 1)
|
||||||
|
|
||||||
|
makeNewSprite(TextureRegionPack(itemImage.texture, 4*TILE_SIZE, 4*TILE_SIZE)).let {
|
||||||
|
it.setRowsAndFrames(2,16)
|
||||||
|
it.delays = FloatArray(16) { Float.POSITIVE_INFINITY }
|
||||||
|
}
|
||||||
|
makeNewSpriteEmissive(TextureRegionPack(itemImage2.texture, 4*TILE_SIZE, 4*TILE_SIZE)).let {
|
||||||
|
it.setRowsAndFrames(2,416)
|
||||||
|
it.delays = FloatArray(16) { Float.POSITIVE_INFINITY }
|
||||||
|
}
|
||||||
|
|
||||||
|
(sprite as SheetSpriteAnimation).currentRow = 0
|
||||||
|
(spriteEmissive as SheetSpriteAnimation).currentRow = 1
|
||||||
|
|
||||||
|
setWireSinkAt(0, 3, "digital_bit")
|
||||||
|
setWireSinkAt(1, 3, "digital_bit")
|
||||||
|
setWireSinkAt(2, 3, "digital_bit")
|
||||||
|
setWireSinkAt(3, 3, "digital_bit")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun reload() {
|
||||||
|
super.reload()
|
||||||
|
setWireSinkAt(0, 3, "digital_bit")
|
||||||
|
setWireSinkAt(1, 3, "digital_bit")
|
||||||
|
setWireSinkAt(2, 3, "digital_bit")
|
||||||
|
setWireSinkAt(3, 3, "digital_bit")
|
||||||
|
updateK()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun updateSignal() {
|
||||||
|
updateK()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun updateK() {
|
||||||
|
val state = isSignalHigh(0, 3).toInt(0) or
|
||||||
|
isSignalHigh(1, 3).toInt(1) or
|
||||||
|
isSignalHigh(2, 3).toInt(2) or
|
||||||
|
isSignalHigh(3, 3).toInt(3)
|
||||||
|
|
||||||
|
(sprite as SheetSpriteAnimation).currentFrame = state
|
||||||
|
(spriteEmissive as SheetSpriteAnimation).currentFrame = state
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package net.torvald.terrarum.modulebasegame.gameitems
|
||||||
|
|
||||||
|
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||||
|
import net.torvald.terrarum.CommonResourcePool
|
||||||
|
import net.torvald.terrarum.Terrarum
|
||||||
|
import net.torvald.terrarum.gameactors.ActorWithBody
|
||||||
|
import net.torvald.terrarum.gameitems.ItemID
|
||||||
|
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||||
|
import net.torvald.terrarum.modulebasegame.gameactors.FixtureLogicSignalEmitter
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by minjaesong on 2024-03-16.
|
||||||
|
*/
|
||||||
|
class ItemLogicSignalSevenSeg(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulebasegame.gameactors.FixtureLogicSignalSevenSeg") {
|
||||||
|
|
||||||
|
override var dynamicID: ItemID = originalID
|
||||||
|
override var baseMass = FixtureLogicSignalEmitter.MASS
|
||||||
|
override val canBeDynamic = false
|
||||||
|
override val materialId = ""
|
||||||
|
override val itemImage: TextureRegion
|
||||||
|
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(15, 3)
|
||||||
|
override val itemImageEmissive: TextureRegion
|
||||||
|
get() = CommonResourcePool.getAsItemSheet("basegame.items").get(15, 4)
|
||||||
|
|
||||||
|
override var baseToolSize: Double? = baseMass
|
||||||
|
override var originalName = "ITEM_LOGIC_SIGNAL_NUMERIC_DISPLAY"
|
||||||
|
|
||||||
|
override fun effectWhileEquipped(actor: ActorWithBody, delta: Float) {
|
||||||
|
super.effectWhileEquipped(actor, delta)
|
||||||
|
(Terrarum.ingame!! as TerrarumIngame).selectedWireRenderClass = "signal"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun effectOnUnequip(actor: ActorWithBody) {
|
||||||
|
super.effectOnUnequip(actor)
|
||||||
|
(Terrarum.ingame!! as TerrarumIngame).selectedWireRenderClass = ""
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user