mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-03-09 13:21:51 +09:00
PlayerLastStatus on world save
This commit is contained in:
@@ -10,7 +10,7 @@ class ActorValue : KVHashMap {
|
||||
@Transient lateinit var actor: Actor
|
||||
internal set
|
||||
|
||||
private constructor()
|
||||
constructor()
|
||||
|
||||
constructor(actor: Actor) : this() {
|
||||
this.actor = actor
|
||||
|
||||
@@ -16,9 +16,6 @@ import net.torvald.terrarum.utils.*
|
||||
import net.torvald.util.SortedArrayList
|
||||
import org.dyn4j.geometry.Vector2
|
||||
import java.util.*
|
||||
import kotlin.NoSuchElementException
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.collections.HashMap
|
||||
import kotlin.math.absoluteValue
|
||||
|
||||
typealias BlockAddress = Long
|
||||
@@ -51,7 +48,7 @@ open class GameWorld() : Disposable {
|
||||
var width: Int = 999; private set
|
||||
var height: Int = 999; private set
|
||||
|
||||
var playersLastStatus = PlayersLastPhysics() // only gets used when the game saves and loads
|
||||
var playersLastStatus = PlayersLastStatus() // only gets used when the game saves and loads
|
||||
|
||||
/** Creation time for this world, NOT the entire savegame */
|
||||
internal var creationTime: Long = App.getTIME_T()
|
||||
|
||||
@@ -5,13 +5,13 @@ import net.torvald.terrarum.App
|
||||
import net.torvald.terrarum.ccG
|
||||
import net.torvald.terrarum.ccW
|
||||
import net.torvald.terrarum.console.Echo
|
||||
import net.torvald.terrarum.gameworld.PhysicalStatus
|
||||
import net.torvald.terrarum.modulebasegame.IngameRenderer
|
||||
import net.torvald.terrarum.modulebasegame.TerrarumIngame
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer
|
||||
import net.torvald.terrarum.realestate.LandUtil
|
||||
import net.torvald.terrarum.toInt
|
||||
import net.torvald.terrarum.tvda.*
|
||||
import net.torvald.terrarum.utils.PlayerLastStatus
|
||||
import java.io.File
|
||||
import java.util.zip.GZIPOutputStream
|
||||
|
||||
@@ -124,7 +124,7 @@ class WorldSavingThread(val disk: VirtualDisk, val outFile: File, val ingame: Te
|
||||
// Write World //
|
||||
// record all player's last position
|
||||
playersList.forEach {
|
||||
ingame.world.playersLastStatus[it.uuid] = PhysicalStatus(it)
|
||||
ingame.world.playersLastStatus[it.uuid] = PlayerLastStatus(it)
|
||||
}
|
||||
val worldMeta = EntryFile(WriteWorld.encodeToByteArray64(ingame, time_t))
|
||||
val world = DiskEntry(-1L, 0, creation_t, time_t, worldMeta)
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
package net.torvald.terrarum.utils
|
||||
|
||||
|
||||
import com.badlogic.gdx.utils.Json
|
||||
import com.badlogic.gdx.utils.JsonValue
|
||||
import net.torvald.terrarum.gameactors.ActorValue
|
||||
import net.torvald.terrarum.gameitem.ItemID
|
||||
import net.torvald.terrarum.gameworld.BlockAddress
|
||||
import net.torvald.terrarum.gameworld.FluidType
|
||||
import net.torvald.terrarum.gameworld.GameWorld
|
||||
import net.torvald.terrarum.gameworld.PhysicalStatus
|
||||
import net.torvald.terrarum.tvda.ByteArray64Reader
|
||||
import net.torvald.terrarum.serialise.Common
|
||||
import java.io.StringReader
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.ActorInventory
|
||||
import net.torvald.terrarum.modulebasegame.gameactors.IngamePlayer
|
||||
import java.util.*
|
||||
import kotlin.collections.HashMap
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2021-08-26.
|
||||
@@ -25,7 +22,18 @@ class HashedFluidType: HashMap<BlockAddress, FluidType>()
|
||||
class HashedWirings: HashMap<BlockAddress, GameWorld.WiringNode>()
|
||||
class HashedWiringGraph: HashMap<BlockAddress, WiringGraphMap>()
|
||||
class MetaModuleCSVPair: HashMap<String, ZipCodedStr>()
|
||||
class PlayersLastPhysics: HashMap<UUID, PhysicalStatus>()
|
||||
class PlayersLastStatus: HashMap<UUID, PlayerLastStatus>()
|
||||
class PlayerLastStatus() {
|
||||
var physics = PhysicalStatus(); private set
|
||||
var inventory = ActorInventory(); private set
|
||||
var actorValue = ActorValue(); private set
|
||||
|
||||
constructor(player: IngamePlayer) : this() {
|
||||
physics = PhysicalStatus(player)
|
||||
inventory = player.inventory
|
||||
actorValue = player.actorValue
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @param doc plaintext
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user