mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-11 11:04:05 +09:00
actors with chunk anchoring wip
This commit is contained in:
@@ -140,7 +140,7 @@ class MusicContainer(
|
|||||||
gdxMusic.forceInvoke<Int>("read", arrayOf(readBuf))!!.toLong() // its return value will be useless for looping=true
|
gdxMusic.forceInvoke<Int>("read", arrayOf(readBuf))!!.toLong() // its return value will be useless for looping=true
|
||||||
val read = minOf(readSize.toLong(), (totalSizeInBytes - readCount))
|
val read = minOf(readSize.toLong(), (totalSizeInBytes - readCount))
|
||||||
|
|
||||||
UnsafeHelper.memcpyRaw(readBuf, UnsafeHelper.getArrayOffset(readBuf), null, soundBuf!!.ptr + readCount, read)
|
UnsafeHelper.memcpyFromArrToPtr(readBuf, 0, soundBuf!!.ptr + readCount, read)
|
||||||
|
|
||||||
readCount += read
|
readCount += read
|
||||||
|
|
||||||
|
|||||||
@@ -401,6 +401,22 @@ open class ActorWithBody : Actor {
|
|||||||
private var stairPenaltyCounter = 0 // unit: update count. 1 second is roughly 64 updates.
|
private var stairPenaltyCounter = 0 // unit: update count. 1 second is roughly 64 updates.
|
||||||
private var stairPenaltyVector = 1.0
|
private var stairPenaltyVector = 1.0
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 0: None
|
||||||
|
* 1: 1x1
|
||||||
|
* 2: 3x3
|
||||||
|
* 3: 5x5
|
||||||
|
* ...
|
||||||
|
* n: (2n-1)x(2n-1)
|
||||||
|
*/
|
||||||
|
@Transient val chunkAnchorRange: Int = 0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should nearby chunks be kept in the chunk pool even if the player is far away.
|
||||||
|
*/
|
||||||
|
@Transient var chunkAnchoring = false
|
||||||
|
|
||||||
init {
|
init {
|
||||||
// some initialiser goes here...
|
// some initialiser goes here...
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -378,6 +378,8 @@ class FixtureAlloyingFurnace : FixtureBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inOperation = (temperature > 0.001f)
|
||||||
|
chunkAnchoring = inOperation // update immediately instead of waiting for the next update
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transient private val filterIndex = 0
|
@Transient private val filterIndex = 0
|
||||||
|
|||||||
@@ -47,6 +47,8 @@ open class FixtureBase : ActorWithBody, CuedByTerrainChange {
|
|||||||
@Transient var mainUI: UICanvas? = null
|
@Transient var mainUI: UICanvas? = null
|
||||||
var inventory: FixtureInventory? = null
|
var inventory: FixtureInventory? = null
|
||||||
|
|
||||||
|
@Transient var inOperation = false
|
||||||
|
|
||||||
// @Transient var mainUIopenFun: ((UICanvas) -> Unit)? = null
|
// @Transient var mainUIopenFun: ((UICanvas) -> Unit)? = null
|
||||||
|
|
||||||
internal var actorThatInstalledThisFixture: UUID? = null
|
internal var actorThatInstalledThisFixture: UUID? = null
|
||||||
@@ -424,6 +426,7 @@ open class FixtureBase : ActorWithBody, CuedByTerrainChange {
|
|||||||
*/
|
*/
|
||||||
override fun updateImpl(delta: Float) {
|
override fun updateImpl(delta: Float) {
|
||||||
super.updateImpl(delta)
|
super.updateImpl(delta)
|
||||||
|
chunkAnchoring = inOperation
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ class FixtureJukebox : Electric, PlaysMusic {
|
|||||||
get() = discInventory.isEmpty()
|
get() = discInventory.isEmpty()
|
||||||
|
|
||||||
override fun updateImpl(delta: Float) {
|
override fun updateImpl(delta: Float) {
|
||||||
|
inOperation = musicIsPlaying
|
||||||
super.updateImpl(delta)
|
super.updateImpl(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,7 @@ class FixtureMusicalTurntable : Electric, PlaysMusic {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun updateImpl(delta: Float) {
|
override fun updateImpl(delta: Float) {
|
||||||
|
inOperation = musicIsPlaying
|
||||||
super.updateImpl(delta)
|
super.updateImpl(delta)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -365,6 +365,8 @@ class FixtureSmelterBasic : FixtureBase {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inOperation = (temperature > 0.001f)
|
||||||
|
chunkAnchoring = inOperation // update immediately instead of waiting for the next update
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transient private val filterIndex = 0
|
@Transient private val filterIndex = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user