loading process will try to unstuck the player if the player appears to stuck in the terrain

This commit is contained in:
minjaesong
2023-05-21 16:57:28 +09:00
parent 5d78df9e99
commit 974ad2ec50
5 changed files with 52 additions and 15 deletions

View File

@@ -15,16 +15,16 @@ import java.io.Reader
object ReadSimpleWorld {
operator fun invoke(worldDataStream: Reader, origin: File?): GameWorld =
fillInDetails(Common.jsoner.fromJson(SimpleGameWorld::class.java, worldDataStream), origin)
Common.jsoner.fromJson(SimpleGameWorld::class.java, worldDataStream).also {
fillInDetails(origin, it)
}
private fun fillInDetails(world: GameWorld, origin: File?): GameWorld {
private fun fillInDetails(origin: File?, world: GameWorld) {
world.tileNumberToNameMap.forEach { l, s ->
world.tileNameToNumberMap[s] = l.toInt()
}
ItemCodex.loadFromSave(origin, world.dynamicToStaticTable, world.dynamicItemInventory)
return world
}
fun readWorldAndSetNewWorld(ingame: IngameInstance, worldDataStream: Reader, origin: File?): GameWorld {