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.
This commit is contained in:
Kelsi 2026-05-06 01:13:43 -07:00
parent 7fcc923d2e
commit f097763875

View file

@ -516,10 +516,16 @@ void EditorApp::processEvents() {
static_cast<float>(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;