mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 12:21:52 +09:00
copper bulbs
This commit is contained in:
@@ -18,5 +18,12 @@
|
||||
[10, 1, "item@basegame:112"], /* 1 copper */
|
||||
[1, 1, "$SIGNALWIRE"] /* 1 other signal wire */
|
||||
]
|
||||
},
|
||||
|
||||
"item@basegame:35": { /* copper bulb */
|
||||
"workbench": "basiccrafting",
|
||||
"ingredients": [
|
||||
[2, 1, "item@basegame:112", 1, "item@basegame:113"] /* 1 copper, 1 iron */
|
||||
]
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@ id;classname;tags
|
||||
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
|
||||
|
||||
# ingots
|
||||
26;net.torvald.terrarum.modulebasegame.gameitems.IngotSteel;INGOT
|
||||
|
||||
|
Binary file not shown.
@@ -3,6 +3,7 @@
|
||||
"ITEM_CHARCOAL": "Charcoal",
|
||||
"ITEM_CHERRY_BOMB": "Bomb",
|
||||
"ITEM_COAL_COKE": "Coal Coke",
|
||||
"ITEM_COPPER_BULB": "Copper Bulb",
|
||||
"ITEM_DOOR_OAK": "Oak Door",
|
||||
"ITEM_DOOR_EBONY": "Ebony Door",
|
||||
"ITEM_DOOR_BIRCH": "Birch Door",
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
"ITEM_CHARCOAL": "목탄",
|
||||
"ITEM_CHERRY_BOMB": "폭탄",
|
||||
"ITEM_COAL_COKE": "코크스",
|
||||
"ITEM_COPPER_BULB": "구리 전구",
|
||||
"ITEM_DOOR_OAK": "나무 문",
|
||||
"ITEM_DOOR_EBONY": "흑단 문",
|
||||
"ITEM_DOOR_BIRCH": "백단 문",
|
||||
|
||||
BIN
assets/mods/basegame/sprites/fixtures/copper_bulb.tga
LFS
Normal file
BIN
assets/mods/basegame/sprites/fixtures/copper_bulb.tga
LFS
Normal file
Binary file not shown.
BIN
assets/mods/basegame/sprites/fixtures/copper_bulb_emissive.tga
LFS
Normal file
BIN
assets/mods/basegame/sprites/fixtures/copper_bulb_emissive.tga
LFS
Normal file
Binary file not shown.
@@ -0,0 +1,58 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.spriteanimation.SheetSpriteAnimation
|
||||
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.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2024-03-01.
|
||||
*/
|
||||
class FixtureSignalBulb : Electric {
|
||||
|
||||
@Transient override val spawnNeedsFloor = false
|
||||
|
||||
constructor() : super(
|
||||
BlockBox(BlockBox.NO_COLLISION, 1, 1),
|
||||
nameFun = { Lang["ITEM_COPPER_BULB"] }
|
||||
)
|
||||
|
||||
init {
|
||||
val itemImage = FixtureItemBase.getItemImageFromSingleImage("basegame", "sprites/fixtures/copper_bulb.tga")
|
||||
val itemImage2 = FixtureItemBase.getItemImageFromSingleImage("basegame", "sprites/fixtures/copper_bulb_emissive.tga")
|
||||
|
||||
density = 1400.0
|
||||
setHitboxDimension(TerrarumAppConfiguration.TILE_SIZE, TerrarumAppConfiguration.TILE_SIZE, 0, 1)
|
||||
|
||||
makeNewSprite(TextureRegionPack(itemImage.texture, TerrarumAppConfiguration.TILE_SIZE, TerrarumAppConfiguration.TILE_SIZE)).let {
|
||||
it.setRowsAndFrames(2,1)
|
||||
it.delays = floatArrayOf(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY)
|
||||
}
|
||||
|
||||
makeNewSpriteEmissive(TextureRegionPack(itemImage2.texture, TerrarumAppConfiguration.TILE_SIZE, TerrarumAppConfiguration.TILE_SIZE)).let {
|
||||
it.setRowsAndFrames(2,1)
|
||||
it.delays = floatArrayOf(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY)
|
||||
}
|
||||
|
||||
actorValue[AVKey.BASEMASS] = FixtureLogicSignalEmitter.MASS
|
||||
|
||||
|
||||
setWireSinkAt(0, 0, "digital_bit")
|
||||
}
|
||||
|
||||
private fun light(state: Boolean) {
|
||||
(sprite as SheetSpriteAnimation).currentRow = state.toInt()
|
||||
(spriteEmissive as SheetSpriteAnimation).currentRow = state.toInt()
|
||||
}
|
||||
|
||||
override fun onSignalHigh(readFrom: BlockBoxIndex) {
|
||||
light(true)
|
||||
}
|
||||
|
||||
override fun onSignalLow(readFrom: BlockBoxIndex) {
|
||||
light(false)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
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-01.
|
||||
*/
|
||||
class ItemSignalBulb(originalID: ItemID) : FixtureItemBase(originalID, "net.torvald.terrarum.modulebasegame.gameactors.FixtureSignalBulb") {
|
||||
|
||||
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(9, 3)
|
||||
|
||||
override var baseToolSize: Double? = baseMass
|
||||
override var originalName = "ITEM_COPPER_BULB"
|
||||
|
||||
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 = ""
|
||||
}
|
||||
|
||||
}
|
||||
@@ -22,7 +22,6 @@ class ItemSignalSwitchManual(originalID: ItemID) : FixtureItemBase(originalID, "
|
||||
|
||||
override var baseToolSize: Double? = baseMass
|
||||
override var originalName = "ITEM_LOGIC_SIGNAL_SWITCH"
|
||||
override var inventoryCategory = Category.MISC
|
||||
|
||||
override fun effectWhileEquipped(actor: ActorWithBody, delta: Float) {
|
||||
super.effectWhileEquipped(actor, delta)
|
||||
|
||||
Binary file not shown.
BIN
work_files/graphics/sprites/fixtures/copper_bulb.kra
LFS
Normal file
BIN
work_files/graphics/sprites/fixtures/copper_bulb.kra
LFS
Normal file
Binary file not shown.
Reference in New Issue
Block a user