changed lightboxes so that (de)serialiser won't complain; world/actor json will will write game version it saved

This commit is contained in:
minjaesong
2022-02-25 11:42:22 +09:00
parent 428cdefb80
commit b2aece0176
10 changed files with 50 additions and 22 deletions

View File

@@ -99,11 +99,11 @@ open class ActorHumanoid : ActorWithBody, Controllable, Pocketed, Factionable, L
* (Use ArrayList for normal circumstances)
*/
override val lightBoxList: List<Lightbox>
get() = arrayOf(Lightbox(Hitbox(2.0, 2.0, hitbox.width - 3, hitbox.height - 3)) { actorValueColour }).toList() // things are asymmetric!!
get() = arrayOf(Lightbox(Hitbox(2.0, 2.0, hitbox.width - 3, hitbox.height - 3), actorValueColour)).toList() // things are asymmetric!!
// use getter; dimension of the player may change by time.
override val shadeBoxList: List<Lightbox>
get() = arrayOf(Lightbox(Hitbox(2.0, 2.0, hitbox.width - 3, hitbox.height - 3)) { actorValueShade }).toList() // things are asymmetric!!
get() = arrayOf(Lightbox(Hitbox(2.0, 2.0, hitbox.width - 3, hitbox.height - 3), actorValueShade)).toList() // things are asymmetric!!
// use getter; dimension of the player may change by time.
@Transient val BASE_DENSITY = 980.0

View File

@@ -27,13 +27,13 @@ internal class FixtureTikiTorch : FixtureBase, Luminous {
private val rndHash2 = rng.nextInt()
private var color: Cvec
get() = BlockCodex[Block.TORCH].getLumCol(rndHash1, rndHash2)
get() = try { BlockCodex[Block.TORCH].getLumCol(rndHash1, rndHash2) } catch (e: NullPointerException) { Cvec() }
set(value) {
throw UnsupportedOperationException()
}
override val lightBoxList: ArrayList<Lightbox> = ArrayList(1)
override val shadeBoxList: ArrayList<Lightbox> = ArrayList(1)
@Transient override val lightBoxList: ArrayList<Lightbox> = ArrayList(1)
@Transient override val shadeBoxList: ArrayList<Lightbox> = ArrayList(1)
constructor() : super(
BlockBox(BlockBox.NO_COLLISION, 1, 2),
@@ -53,7 +53,7 @@ internal class FixtureTikiTorch : FixtureBase, Luminous {
setHitboxDimension(16, 32, 0, 0)
lightBoxList.add(Lightbox(Hitbox(6.0, 5.0, 4.0, 3.0)) { color })
lightBoxList.add(Lightbox(Hitbox(6.0, 5.0, 4.0, 3.0), color))
makeNewSprite(CommonResourcePool.getAsTextureRegionPack("sprites-fixtures-tiki_torch.tga"))
sprite!!.setRowsAndFrames(1, 2)

View File

@@ -7,7 +7,7 @@ import net.torvald.terrarum.gameitems.ItemID
/**
* Created by minjaesong on 2016-04-26.
*/
class WeaponSwung : ActorWithBody, Luminous {
class ItemCarrying : ActorWithBody, Luminous {
var itemID: ItemID = ""; private set

View File

@@ -38,8 +38,8 @@ open class ProjectileSimple : ActorWithBody, Luminous, Projectile {
* Hitbox(x-offset, y-offset, width, height)
* (Use ArrayList for normal circumstances)
*/
override val lightBoxList = ArrayList<Lightbox>()
override val shadeBoxList = ArrayList<Lightbox>()
@Transient override val lightBoxList = ArrayList<Lightbox>()
@Transient override val shadeBoxList = ArrayList<Lightbox>()
private val lifetimeMax = 2500
private var lifetimeCounter = 0f
@@ -58,7 +58,7 @@ open class ProjectileSimple : ActorWithBody, Luminous, Projectile {
setPosition(fromPoint.x, fromPoint.y)
posPre = Point2d(fromPoint.x, fromPoint.y)
// lightbox sized 8x8 centered to the bullet
lightBoxList.add(Lightbox(Hitbox(-4.0, -4.0, 8.0, 8.0)) { color })
lightBoxList.add(Lightbox(Hitbox(-4.0, -4.0, 8.0, 8.0), color))
//this.externalV.set(velocity)
damage = bulletDatabase[type][OFFSET_DAMAGE] as Int