actor update control by chunkAnchoring flag

This commit is contained in:
minjaesong
2024-09-07 19:01:03 +09:00
parent ab31986cf2
commit 11cdcbe2fc
5 changed files with 45 additions and 6 deletions

View File

@@ -111,4 +111,36 @@ open class ChunkPool(
return numIn
}
companion object {
fun getRenameFunTerrain(world: GameWorld): (Int) -> Int {
// word size: 2
return { oldTileNum ->
val oldOreName = world.oldTileNumberToNameMap[oldTileNum.toLong()]
world.tileNameToNumberMap[oldOreName]!!
}
}
fun getRenameFunOres(world: GameWorld): (Int) -> Int {
// word size: 3
return { oldTileNumRaw ->
val oldOreNum = oldTileNumRaw and 0x0000FFFF
val oldOrePlacement = oldTileNumRaw and 0xFFFF0000.toInt()
val oldOreName = world.oldTileNumberToNameMap[oldOreNum.toLong()]!!
world.tileNameToNumberMap[oldOreName]!! or oldOrePlacement
}
}
fun getRenameFunFluids(world: GameWorld): (Int) -> Int {
// word size: 4
return { oldTileNumRaw ->
val oldFluidNum = oldTileNumRaw and 0x0000FFFF
val oldFluidFill = oldTileNumRaw and 0xFFFF0000.toInt()
val oldFluidName = world.oldTileNumberToNameMap[oldFluidNum.toLong()]
world.tileNameToNumberMap[oldFluidName]!! or oldFluidFill
}
}
}
}

View File

@@ -163,6 +163,7 @@ open class GameWorld(
it[1] = Block.UPDATE
it[65535] = Block.NOT_GENERATED // unlike Block.NULL, this one is solid
}
@Transient internal lateinit var oldTileNumberToNameMap: Map<Long, ItemID> // this is a caching variable, refreshed on every (initial) load
/*val fluidNumberToNameMap = HashArray<ItemID>().also {
it[0] = Fluid.NULL
it[65535] = Fluid.NULL // 65535 denotes "not generated"
@@ -275,7 +276,7 @@ open class GameWorld(
tileNumberToNameMap[1] = Block.UPDATE
tileNumberToNameMap[65535] = Block.NOT_GENERATED
// before the renaming, update the name maps
val oldTileNumberToNameMap: Map<Long, ItemID> = tileNumberToNameMap.toMap()
oldTileNumberToNameMap = tileNumberToNameMap.toMap()
tileNumberToNameMap.forEach { l, s ->
printdbg(this, " afterload oldMapping tileNumber $l <-> $s")