From 45f971d9d0f65da6ae288ec10a7ad80106d485ef Mon Sep 17 00:00:00 2001 From: Fen Dweller Date: Wed, 22 Jun 2022 15:44:51 -0400 Subject: [PATCH] Correctly position entities when spawning a filtered set --- macrovision.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/macrovision.js b/macrovision.js index 9444a776..f8dae504 100644 --- a/macrovision.js +++ b/macrovision.js @@ -5699,13 +5699,26 @@ function spawnAll() { const category = document.querySelector("#category-picker").value; const maker = availableEntities[category][element.value]; const entity = maker.constructor(); + + + if (config.lockYAxis) { + yOffset = getVerticalOffset(); + } else { + // Snap to the ground if it's visible. + if (config.groundSnap && pos2pix({x: 0, y: 0}).y < canvasHeight + 50) { + yOffset = -config.y; + } else { + yOffset = config.height.toNumber("meters") / 2; + } + } + displayEntity( entity, entity.view, -worldWidth * 0.45 + config.x + (worldWidth * 0.9 * index) / (count - 1), - config.y + config.y + yOffset ); index += 1; return entityIndex - 1;