LuaRenderObject render layer depth
Posted: Fri Nov 28, 2025 10:17 pm
When two entities with the same render layer are drawn, their y-coordinate determines which is drawn on top: Lower y is drawn over higher y.
With multiple modding projects I've encountered the limitation that you can't recreate this behavior in LuaRenderObjects. Render objects that are created later are always drawn on top of those that are rendered earlier. And render objects are always drawn on top of entities within the same layer.
The main reason I want this is that with rendered animations you have more control in when to start and stop the animation than with animations that are tied to the fixed purposes the entities are meant to.
I hope it's possible to implement this since it can lead to a lot more custom animation scripting.
I'll end this post with two examples of projects where I encounter this problem:
1) Animated trains I'm drawing animations on top of train entities, but as you can see, the tree in front of the train is drawn under the animation.
2) Assembler where the animation is tied to an event I've created this wharf that receives fish from boats. When a boat arrives I want to loop the animation just once. Doing that precisely by scripting the insertion of intermediate items in the input slots and setting crafting duration to exactly match one animation loop ended up being very brittle and often led to off-by-one (frame) errors that are impossible to correct for.
Handling this with LuaRenderObjects was far easier, but again, the entities are bellow the render object.
With multiple modding projects I've encountered the limitation that you can't recreate this behavior in LuaRenderObjects. Render objects that are created later are always drawn on top of those that are rendered earlier. And render objects are always drawn on top of entities within the same layer.
The main reason I want this is that with rendered animations you have more control in when to start and stop the animation than with animations that are tied to the fixed purposes the entities are meant to.
I hope it's possible to implement this since it can lead to a lot more custom animation scripting.
I'll end this post with two examples of projects where I encounter this problem:
1) Animated trains I'm drawing animations on top of train entities, but as you can see, the tree in front of the train is drawn under the animation.
2) Assembler where the animation is tied to an event I've created this wharf that receives fish from boats. When a boat arrives I want to loop the animation just once. Doing that precisely by scripting the insertion of intermediate items in the input slots and setting crafting duration to exactly match one animation loop ended up being very brittle and often led to off-by-one (frame) errors that are impossible to correct for.
Handling this with LuaRenderObjects was far easier, but again, the entities are bellow the render object.