mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-07 20:31:51 +09:00
basegame: added an Interface that marks the actor as 'not to be serialised when saving the world'
This commit is contained in:
@@ -13,7 +13,7 @@ import kotlin.math.floor
|
||||
/**
|
||||
* Used as construction markers and fixture ghost images
|
||||
*/
|
||||
class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = PhysProperties.MOBILE_OBJECT) {
|
||||
class BlockMarkerActor : ActorWithBody(Actor.RenderOrder.OVERLAY, physProp = PhysProperties.MOBILE_OBJECT), NoSerialise {
|
||||
|
||||
private val defaultSize = 16.0
|
||||
|
||||
|
||||
6
src/net/torvald/terrarum/gameactors/NoSerialise.kt
Normal file
6
src/net/torvald/terrarum/gameactors/NoSerialise.kt
Normal file
@@ -0,0 +1,6 @@
|
||||
package net.torvald.terrarum.gameactors
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2022-09-02.
|
||||
*/
|
||||
interface NoSerialise
|
||||
@@ -11,7 +11,7 @@ import net.torvald.terrarum.gameitems.ItemID
|
||||
*
|
||||
* Created by minjaesong on 2021-07-30.
|
||||
*/
|
||||
class WireActor : ActorWithBody {
|
||||
class WireActor : ActorWithBody, NoSerialise {
|
||||
|
||||
companion object {
|
||||
val WIRE_NEARBY = arrayOf(
|
||||
|
||||
@@ -1,23 +1,16 @@
|
||||
package net.torvald.terrarum.modulebasegame.gameactors
|
||||
|
||||
import com.badlogic.gdx.Gdx
|
||||
import com.badlogic.gdx.graphics.Texture
|
||||
import com.badlogic.gdx.graphics.g2d.TextureRegion
|
||||
import net.torvald.spriteanimation.HasAssembledSprite
|
||||
import net.torvald.spriteanimation.SpriteAnimation
|
||||
import net.torvald.terrarum.spriteassembler.ADProperties
|
||||
import net.torvald.terrarum.spriteassembler.AssembleSheetPixmap
|
||||
import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.Terrarum
|
||||
import net.torvald.terrarum.gameactors.AVKey
|
||||
import net.torvald.terrarum.gameitems.GameItem
|
||||
import net.torvald.terrarum.gameitems.ItemID
|
||||
import net.torvald.terrarum.gameactors.NoSerialise
|
||||
import net.torvald.terrarum.itemproperties.ItemRemapTable
|
||||
import net.torvald.terrarum.itemproperties.ItemTable
|
||||
import net.torvald.terrarum.savegame.DiskSkimmer
|
||||
import net.torvald.terrarum.savegame.SimpleFileSystem
|
||||
import net.torvald.terrarum.spriteassembler.ADProperties
|
||||
import net.torvald.terrarum.utils.PlayerLastStatus
|
||||
import net.torvald.terrarumsansbitmap.gdx.TextureRegionPack
|
||||
import java.util.*
|
||||
|
||||
|
||||
@@ -27,7 +20,7 @@ import java.util.*
|
||||
* Created by minjaesong on 2015-12-31.
|
||||
*/
|
||||
|
||||
class IngamePlayer : ActorHumanoid, HasAssembledSprite {
|
||||
class IngamePlayer : ActorHumanoid, HasAssembledSprite, NoSerialise {
|
||||
|
||||
val creationTime = App.getTIME_T()
|
||||
var lastPlayTime = App.getTIME_T() // cumulative value for the savegame
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
package net.torvald.terrarum.serialise
|
||||
|
||||
import net.torvald.terrarum.CommonResourcePool
|
||||
import net.torvald.terrarum.ItemCodex
|
||||
import net.torvald.terrarum.ReferencingRanges
|
||||
import net.torvald.terrarum.gameactors.Actor
|
||||
import net.torvald.terrarum.gameactors.BlockMarkerActor
|
||||
import net.torvald.terrarum.gameactors.NoSerialise
|
||||
import net.torvald.terrarum.gameworld.BlockLayer
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.gameworld.GameWorldTitleScreen
|
||||
@@ -25,10 +23,7 @@ import java.io.Reader
|
||||
object WriteWorld {
|
||||
|
||||
fun actorAcceptable(actor: Actor): Boolean {
|
||||
return actor.referenceID !in ReferencingRanges.ACTORS_WIRES &&
|
||||
actor.referenceID !in ReferencingRanges.ACTORS_WIRES_HELPER &&
|
||||
actor != (CommonResourcePool.get("blockmarking_actor") as BlockMarkerActor) &&
|
||||
actor !is IngamePlayer // IngamePlayers must not be saved with the world
|
||||
return actor !is NoSerialise // IngamePlayers is also NoSerialised because they must not be saved with the world
|
||||
}
|
||||
|
||||
private fun preWrite(ingame: TerrarumIngame, time_t: Long, actorsList: List<Actor>, playersList: List<IngamePlayer>): GameWorld {
|
||||
|
||||
Reference in New Issue
Block a user