mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-14 12:34:05 +09:00
actor update control by chunkAnchoring flag
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user