mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-17 14:04:05 +09:00
signal emitter is now a fixture
This commit is contained in:
@@ -12,6 +12,7 @@ import net.torvald.terrarum.gameactors.PhysProperties
|
||||
import net.torvald.terrarum.gameitem.ItemID
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.ui.UICanvas
|
||||
import org.dyn4j.geometry.Vector2
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2016-06-17.
|
||||
@@ -29,6 +30,9 @@ open class FixtureBase(
|
||||
var blockBox: BlockBox = blockBox0
|
||||
protected set // something like TapestryObject will want to redefine this
|
||||
|
||||
open val wireEmitterType = ""
|
||||
open val wireEmission = Vector2()
|
||||
open val wireConsumption = Vector2()
|
||||
|
||||
/**
|
||||
* Block-wise position of this fixture when it's placed on the world. Null if it's not on the world
|
||||
@@ -103,13 +107,6 @@ open class FixtureBase(
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Update code that runs once for every frame
|
||||
*/
|
||||
open fun updateSelf() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes this instance of the fixture from the world
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.ModMgr
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
import org.dyn4j.geometry.Vector2
|
||||
|
||||
class FixtureLogicSignalEmitter(nameFun: () -> String) : FixtureBase(BlockBox(BlockBox.NO_COLLISION, 1, 1), nameFun = nameFun) {
|
||||
|
||||
override val wireEmitterType = "digital_bit"
|
||||
override val wireEmission = Vector2(1.0, 0.0)
|
||||
|
||||
init {
|
||||
density = 1400.0
|
||||
setHitboxDimension(TILE_SIZE, TILE_SIZE, 0, -1)
|
||||
|
||||
makeNewSprite(TextureRegionPack(CommonResourcePool.getAsTextureRegion("basegame-sprites-fixtures-signal_source.tga").texture, TILE_SIZE, TILE_SIZE))
|
||||
sprite!!.setRowsAndFrames(1, 1)
|
||||
|
||||
actorValue[AVKey.BASEMASS] = MASS
|
||||
}
|
||||
|
||||
override fun dispose() { }
|
||||
|
||||
companion object {
|
||||
const val MASS = 1.0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,6 +96,7 @@ object PlayerBuilderSigrid {
|
||||
inventory.add("item@basegame:5", 385930603) // test tiki torch
|
||||
inventory.add("item@basegame:6", 95) // storage chest
|
||||
inventory.add("item@basegame:7", 1) // wire debugger
|
||||
inventory.add("item@basegame:8", 9995) // power source
|
||||
|
||||
WireCodex.getAll().forEach {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user