From f0977638754e37ecde5108810a835fe2ca86e029 Mon Sep 17 00:00:00 2001 From: Kelsi Date: Wed, 6 May 2026 01:13:43 -0700 Subject: [PATCH] feat(editor): click on existing NPC marker selects it instead of placing duplicate Plain left-click within 4u of an existing NPC now selects that NPC rather than dropping a new spawn on top. Shift+click forces placement at the cursor even if it overlaps an existing NPC, preserving the rapid-placement workflow. --- tools/editor/editor_app.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/tools/editor/editor_app.cpp b/tools/editor/editor_app.cpp index 04db347d..1a50f33e 100644 --- a/tools/editor/editor_app.cpp +++ b/tools/editor/editor_app.cpp @@ -516,10 +516,16 @@ void EditorApp::processEvents() { static_cast(ext.height)); glm::vec3 hitPos; if (terrainEditor_.raycastTerrain(ray, hitPos)) { - auto& tmpl = npcSpawner_.getTemplate(); - tmpl.position = hitPos; - npcSpawner_.placeCreature(tmpl); - objectsDirty_ = true; + // Plain left-click near an existing NPC selects it instead of + // placing a duplicate. Shift+click forces placement. + bool forcePlace = (event.key.keysym.mod & KMOD_SHIFT) != 0; + int hit = forcePlace ? -1 : npcSpawner_.selectAt(hitPos, 4.0f); + if (hit < 0) { + auto& tmpl = npcSpawner_.getTemplate(); + tmpl.position = hitPos; + npcSpawner_.placeCreature(tmpl); + objectsDirty_ = true; + } } } else if (mode_ == EditorMode::Water) { painting_ = true;