save/load kinda mostly working but fixtures are not getting their sprites back

This commit is contained in:
minjaesong
2021-09-06 17:31:37 +09:00
parent ec08f8d07e
commit 1accf985e7
29 changed files with 230 additions and 126 deletions

View File

@@ -18,7 +18,7 @@ object ImportWorld : ConsoleCommand {
if (args.size == 2) {
try {
val reader = java.io.FileReader(AppLoader.defaultDir + "/Exports/${args[1]}.json")
ReadWorld(Terrarum.ingame!! as TerrarumIngame, reader)
ReadWorld.readWorldAndSetNewWorld(Terrarum.ingame!! as TerrarumIngame, reader)
Echo("Importworld: imported a world from ${args[1]}.json")
}
catch (e: IOException) {
@@ -41,7 +41,7 @@ object ImportActor : ConsoleCommand {
if (args.size == 2) {
try {
val reader = java.io.FileReader(AppLoader.defaultDir + "/Exports/${args[1]}.json")
ReadActor(Terrarum.ingame!! as TerrarumIngame, reader)
ReadActor.readActorAndAddToWorld(Terrarum.ingame!! as TerrarumIngame, reader)
Echo("Importactor: imported an actor from ${args[1]}.json")
}
catch (e: IOException) {

View File

@@ -1,6 +1,10 @@
package net.torvald.terrarum.modulebasegame.console
import net.torvald.ELLIPSIS
import net.torvald.terrarum.AppLoader
import net.torvald.terrarum.ccC
import net.torvald.terrarum.ccG
import net.torvald.terrarum.ccR
import net.torvald.terrarum.console.ConsoleCommand
import net.torvald.terrarum.console.Echo
import net.torvald.terrarum.modulecomputers.virtualcomputer.tvd.ByteArray64Reader
@@ -20,12 +24,13 @@ object Load : ConsoleCommand {
override fun execute(args: Array<String>) {
if (args.size == 2) {
try {
Echo("${ccC}Changing context, ${ccR}do not touch the controller$ccC and ${ccG}wait$ccC$ELLIPSIS")
val charset = Common.CHARSET
val file = File(AppLoader.defaultDir + "/Exports/${args[1]}")
val disk = VDUtil.readDiskArchive(file, charset = charset)
val meta = ReadMeta(disk)
println(meta.loadorder.joinToString())
LoadSavegame(disk)
}
catch (e: IOException) {
Echo("Load: IOException raised.")

View File

@@ -13,7 +13,7 @@ import net.torvald.terrarum.modulebasegame.gameactors.FixtureTikiTorch
@ConsoleNoExport
internal object SpawnTikiTorch : ConsoleCommand {
override fun execute(args: Array<String>) {
val torch = FixtureTikiTorch { "Tiki Torch" }
val torch = FixtureTikiTorch()
torch.setPosition(Terrarum.mouseX, Terrarum.mouseY)
Terrarum.ingame!!.addNewActor(torch)