mirror of
https://github.com/curioustorvald/Terrarum.git
synced 2026-06-13 03:54:06 +09:00
actor update control by chunkAnchoring flag
This commit is contained in:
@@ -1365,7 +1365,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
var i = 0
|
||||
while (i < actorContainerSize) { // loop through actorContainerInactive
|
||||
val actor = actorContainerInactive[i]
|
||||
if (actor is ActorWithBody && actor.inUpdateRange(world) && !actor.forceDormant) {
|
||||
if (actor is ActorWithBody && (actor.chunkAnchoring || actor.inUpdateRange(world)) && !actor.forceDormant) {
|
||||
activateDormantActor(actor) // duplicates are checked here
|
||||
actorContainerSize -= 1
|
||||
i-- // array removed 1 elem, so we also decrement counter by 1
|
||||
@@ -1392,7 +1392,7 @@ open class TerrarumIngame(batch: FlippingSpriteBatch) : IngameInstance(batch) {
|
||||
i-- // array removed 1 elem, so we also decrement counter by 1
|
||||
}
|
||||
// inactivate distant actors
|
||||
else if (actor is ActorWithBody && (!actor.inUpdateRange(world) || actor.forceDormant)) {
|
||||
else if (actor is ActorWithBody && (!actor.chunkAnchoring && !actor.inUpdateRange(world) || actor.forceDormant)) {
|
||||
if (actor !is Projectile) { // if it's a projectile, don't inactivate it; just kill it.
|
||||
actorContainerInactive.add(actor) // naïve add; duplicates are checked when the actor is re-activated
|
||||
}
|
||||
|
||||
@@ -42,6 +42,8 @@ class IngamePlayer : ActorHumanoid, HasAssembledSprite, NoSerialise {
|
||||
/** ADL for glow sprite. Optional. */
|
||||
@Transient override var animDescEmissive: ADProperties? = null
|
||||
|
||||
@Transient override val chunkAnchorRange = 3
|
||||
@Transient override var chunkAnchoring = true
|
||||
|
||||
private constructor()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user