From a26cb67277a5018d6e8d34b2ad04aa036ef65d36 Mon Sep 17 00:00:00 2001 From: 1jamie Date: Mon, 21 Sep 2026 18:19:17 -0500 Subject: [PATCH] use Collision instance for elevation lookups --- src/core/game3/objects.lua | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/core/game3/objects.lua b/src/core/game3/objects.lua index 82cc0ec0..2cddd0ac 100644 --- a/src/core/game3/objects.lua +++ b/src/core/game3/objects.lua @@ -146,6 +146,9 @@ local function newEventObject(def) if not sprite and resolvedGfx then sprite = GfxIds.spriteFor(resolvedGfx) end + local Coll = Collision() + local elev = (def.elevation and def.elevation ~= 0 and def.elevation) + or (Coll and Coll.elevationAt and Coll.elevationAt(x, y)) or 0 return { localId = lid, def = def, @@ -158,8 +161,7 @@ local function newEventObject(def) facing = facingFromDef(def), sprite = sprite or "SPRITE_YOUNGSTER", graphicsId = resolvedGfx, - elevation = (def.elevation and def.elevation ~= 0 and def.elevation) - or (Collision.elevationAt and Collision.elevationAt(x, y)) or 0, + elevation = elev, movementType = mt, movement = movement, range = range, @@ -556,7 +558,8 @@ local function finishStep(eo) if eo.def then eo.def.x, eo.def.y = eo.cellX, eo.cellY end - local curElev = Collision.elevationAt and Collision.elevationAt(eo.cellX, eo.cellY) + local Coll = Collision() + local curElev = Coll and Coll.elevationAt and Coll.elevationAt(eo.cellX, eo.cellY) if curElev and curElev ~= 0 and curElev ~= 15 then eo.elevation = curElev end