diff --git a/internal/app/render/bucket/level/chunk/unit/unit.go b/internal/app/render/bucket/level/chunk/unit/unit.go index 0d223c9a..6e6c125f 100644 --- a/internal/app/render/bucket/level/chunk/unit/unit.go +++ b/internal/app/render/bucket/level/chunk/unit/unit.go @@ -91,6 +91,21 @@ func countLayer(p *dmmprefab.Prefab) float32 { plane, _ := p.Vars().Float("plane") layer, _ := p.Vars().Float("layer") + // Layers can have essentially effect values added onto them + // We should clip them off to reduce the max possible layer to like 4999 (likely far lower) + const BACKGROUND_LAYER = 20_000 + const TOPDOWN_LAYER = 10_000 + const EFFECTS_LAYER = 5000 + if layer > BACKGROUND_LAYER { + layer -= BACKGROUND_LAYER + } + if layer > TOPDOWN_LAYER { + layer -= TOPDOWN_LAYER + } + if layer > EFFECTS_LAYER { + layer -= EFFECTS_LAYER + } + layer = plane*10_000 + layer*1000 // When mobs are on the same Layer with object they are always rendered above them (BYOND specific stuff).