mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-12 11:34:05 +09:00
save/load kinda mostly working but fixtures are not getting their sprites back
This commit is contained in:
@@ -26,6 +26,8 @@ interface Electric {
|
||||
}
|
||||
|
||||
/**
|
||||
* Protip: do not make child classes take any argument, especially no function (function "classes" have no zero-arg constructor)
|
||||
*
|
||||
* Created by minjaesong on 2016-06-17.
|
||||
*/
|
||||
open class FixtureBase : ActorWithBody, CuedByTerrainChange {
|
||||
@@ -37,7 +39,7 @@ open class FixtureBase : ActorWithBody, CuedByTerrainChange {
|
||||
var mainUI: UICanvas? = null
|
||||
var inventory: FixtureInventory? = null
|
||||
|
||||
protected constructor()
|
||||
protected constructor() : super(RenderOrder.BEHIND, PhysProperties.IMMOBILE, null)
|
||||
|
||||
constructor(blockBox0: BlockBox,
|
||||
blockBoxProps: BlockBoxProps = BlockBoxProps(0),
|
||||
@@ -45,7 +47,8 @@ open class FixtureBase : ActorWithBody, CuedByTerrainChange {
|
||||
nameFun: () -> String,
|
||||
mainUI: UICanvas? = null,
|
||||
inventory: FixtureInventory? = null,
|
||||
id: ActorID? = null) : super(renderOrder, PhysProperties.IMMOBILE, id) {
|
||||
id: ActorID? = null
|
||||
) : super(renderOrder, PhysProperties.IMMOBILE, id) {
|
||||
blockBox = blockBox0
|
||||
this.blockBoxProps = blockBoxProps
|
||||
this.renderOrder = renderOrder
|
||||
@@ -223,7 +226,10 @@ inline class BlockBoxProps(val flags: Int) {
|
||||
* @param width Width of the block box, tile-wise
|
||||
* @param height Height of the block box, tile-wise
|
||||
*/
|
||||
data class BlockBox(val collisionType: ItemID, val width: Int, val height: Int) {
|
||||
data class BlockBox(
|
||||
val collisionType: ItemID = NO_COLLISION,
|
||||
val width: Int = 0,
|
||||
val height: Int = 0) {
|
||||
|
||||
/*fun redefine(collisionType: Int, width: Int, height: Int) {
|
||||
redefine(collisionType)
|
||||
@@ -246,6 +252,6 @@ data class BlockBox(val collisionType: ItemID, val width: Int, val height: Int)
|
||||
const val NO_PASS_RIGHT = Block.ACTORBLOCK_NO_PASS_RIGHT
|
||||
const val NO_PASS_LEFT = Block.ACTORBLOCK_NO_PASS_LEFT
|
||||
|
||||
val NULL = BlockBox(NO_COLLISION, 0, 0)
|
||||
val NULL = BlockBox()
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.TerrarumAppConfiguration.TILE_SIZE
|
||||
import net.torvald.terrarum.blockproperties.WireCodex
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
import org.dyn4j.geometry.Vector2
|
||||
|
||||
@@ -13,13 +14,15 @@ class FixtureLogicSignalEmitter : FixtureBase, Electric {
|
||||
override val wireEmission: HashMap<BlockBoxIndex, Vector2> = HashMap()
|
||||
override val wireConsumption: HashMap<BlockBoxIndex, Vector2> = HashMap()
|
||||
|
||||
protected constructor()
|
||||
|
||||
constructor(nameFun: () -> String) : super(
|
||||
constructor() : super(
|
||||
BlockBox(BlockBox.NO_COLLISION, 1, 1),
|
||||
nameFun = nameFun)
|
||||
nameFun = { Lang["ITEM_LOGIC_SIGNAL_EMITTER"] }
|
||||
)
|
||||
|
||||
init {
|
||||
println("INIT AGAIN FixtureLogicSignalEmitter")
|
||||
|
||||
density = 1400.0
|
||||
setHitboxDimension(TILE_SIZE, TILE_SIZE, 0, -1)
|
||||
|
||||
|
||||
@@ -32,13 +32,11 @@ import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
*/
|
||||
internal class FixtureStorageChest : FixtureBase {
|
||||
|
||||
private constructor()
|
||||
|
||||
constructor(nameFun: () -> String) : super(
|
||||
constructor() : super(
|
||||
BlockBox(BlockBox.ALLOW_MOVE_DOWN, 1, 1),
|
||||
mainUI = UIStorageChest(),
|
||||
inventory = FixtureInventory(40, CAPACITY_MODE_COUNT),
|
||||
nameFun = nameFun
|
||||
nameFun = { Lang["ITEM_STORAGE_CHEST"] }
|
||||
) {
|
||||
|
||||
(mainUI as UIStorageChest).chestInventory = this.inventory!!
|
||||
|
||||
@@ -12,6 +12,7 @@ import net.torvald.terrarum.gameactors.Hitbox
|
||||
import net.torvald.terrarum.gameactors.Luminous
|
||||
import net.torvald.terrarum.gameparticles.ParticleVanishingSprite
|
||||
import net.torvald.terrarum.gameparticles.ParticleVanishingText
|
||||
import net.torvald.terrarum.langpack.Lang
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
import java.util.*
|
||||
@@ -34,11 +35,9 @@ internal class FixtureTikiTorch : FixtureBase, Luminous {
|
||||
|
||||
override val lightBoxList: ArrayList<Hitbox> = ArrayList(1)
|
||||
|
||||
private constructor()
|
||||
|
||||
constructor(nameFun: () -> String) : super(
|
||||
constructor() : super(
|
||||
BlockBox(BlockBox.NO_COLLISION, 1, 2),
|
||||
nameFun = nameFun
|
||||
nameFun = { Lang["ITEM_TIKI_TORCH"] }
|
||||
) {
|
||||
|
||||
// loading textures
|
||||
|
||||
@@ -19,7 +19,7 @@ class TapestryObject : FixtureBase {
|
||||
var artName = ""; private set
|
||||
var artAuthor = ""; private set
|
||||
|
||||
private constructor()
|
||||
private constructor() : super()
|
||||
|
||||
constructor(pixmap: Pixmap, artName: String, artAuthor: String, nameFun: () -> String) : super() {
|
||||
this.artName = artName
|
||||
|
||||
Reference in New Issue
Block a user