From 47c9aa0e5947be9b845a1715c7c1a799330b9a3d Mon Sep 17 00:00:00 2001 From: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com> Date: Fri, 5 Jul 2024 07:37:58 -0700 Subject: [PATCH] fix: trims off effect layers, makes rendering a bit more sane (#295) * Adds a wider span for layers without mixup with planes The existing multiplier is lower then layer values encoraged by byond, so it breaks easy. Hopefully a larger value will help here. * let's lower that down to make INF less likely * fuckoff big number * offset strategy --- .../app/render/bucket/level/chunk/unit/unit.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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).