Add dynamic render option without relying on doesTick (#38)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Woriveandgithub-actions[bot] authored and GitHub committed 2025-12-08 10:50:16 +01:00
1 parent 238b041f12
commit a36120fc91
2 files changed
+8 -1

No files matched your search

@@ -316,6 +316,12 @@ abstract class TMultiPart {
*/
def doesTick = true
/** Return whether this part needs to be included in the dynamic render loop
* (renderDynamic). Default is false. Override this to true for parts like
* lights that need per-frame rendering but no logic updates.
*/
def shouldRenderDynamic = false
/** Called once per world tick. This will be called even if doesTick returns
* false if another part in the space needs ticks.
*/
@@ -480,7 +480,8 @@ trait TileMultipartClient extends TileMultipart {
def updateRenderCache() {
if (partList != null) {
val (dynamic, static) = partList.partition(_.doesTick)
val (dynamic, static) =
partList.partition(p => p.doesTick || p.shouldRenderDynamic)
val sArr = static.toArray
val dArr = dynamic.toArray