mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-10 02:24:05 +09:00
quicksave (part of the autosaving) is working
This commit is contained in:
@@ -11,6 +11,7 @@ import net.torvald.terrarum.tvda.VDUtil
|
||||
import net.torvald.terrarum.serialise.*
|
||||
import java.io.File
|
||||
import java.io.IOException
|
||||
import java.util.logging.Level
|
||||
|
||||
/**
|
||||
* Created by minjaesong on 2021-08-30.
|
||||
@@ -24,7 +25,7 @@ object Load : ConsoleCommand {
|
||||
|
||||
val charset = Common.CHARSET
|
||||
val file = File(App.defaultDir + "/Exports/${args[1]}")
|
||||
val disk = VDUtil.readDiskArchive(file, charset = charset)
|
||||
val disk = VDUtil.readDiskArchive(file, Level.INFO)
|
||||
|
||||
LoadSavegame(disk)
|
||||
}
|
||||
|
||||
@@ -22,18 +22,6 @@ import java.io.IOException
|
||||
*/
|
||||
object Save : ConsoleCommand {
|
||||
|
||||
private fun acceptable(actor: Actor): Boolean {
|
||||
return actor.referenceID !in ReferencingRanges.ACTORS_WIRES &&
|
||||
actor.referenceID !in ReferencingRanges.ACTORS_WIRES_HELPER &&
|
||||
actor != (CommonResourcePool.get("blockmarking_actor") as BlockMarkerActor)
|
||||
}
|
||||
|
||||
private fun addFile(disk: VirtualDisk, file: DiskEntry) {
|
||||
VDUtil.getAsDirectory(disk, 0).add(file.entryID)
|
||||
disk.entries[file.entryID] = file
|
||||
file.parentEntryID = 0
|
||||
}
|
||||
|
||||
override fun execute(args: Array<String>) {
|
||||
if (args.size == 2) {
|
||||
try {
|
||||
@@ -59,4 +47,18 @@ object Save : ConsoleCommand {
|
||||
Echo("Usage: save <new-savegame-name>")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
object Quicksave : ConsoleCommand {
|
||||
override fun execute(args: Array<String>) {
|
||||
val ingame = Terrarum.ingame!! as TerrarumIngame
|
||||
|
||||
WriteSavegame.quick(ingame.savegameArchive, ingame.getSaveFileMain(), ingame) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
override fun printUsage() {
|
||||
Echo("Usage: quicksave")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user