diff --git a/nexus/components/spatial-memory.js b/nexus/components/spatial-memory.js index 9d656988..213e3553 100644 --- a/nexus/components/spatial-memory.js +++ b/nexus/components/spatial-memory.js @@ -32,6 +32,9 @@ const SpatialMemory = (() => { + // ─── CALLBACKS ──────────────────────────────────────── + let _onMemoryPlacedCallback = null; + // ─── REGION DEFINITIONS ─────────────────────────────── const REGIONS = { engineering: { @@ -301,6 +304,12 @@ const SpatialMemory = (() => { _dirty = true; saveToStorage(); console.info('[Mnemosyne] Spatial memory placed:', mem.id, 'in', region.label); + + // Fire particle burst callback + if (_onMemoryPlacedCallback) { + _onMemoryPlacedCallback(crystal.position.clone(), mem.category || 'working'); + } + return crystal; } @@ -897,6 +906,10 @@ const SpatialMemory = (() => { return obj ? obj.mesh.position.clone() : null; } + function setOnMemoryPlaced(callback) { + _onMemoryPlacedCallback = callback; + } + return { init, placeMemory, removeMemory, update, updateMemoryVisual, getMemoryAtPosition, getRegionAtPosition, getMemoriesInRegion, getAllMemories, @@ -904,7 +917,8 @@ const SpatialMemory = (() => { exportIndex, importIndex, exportToFile, importFromFile, searchNearby, REGIONS, saveToStorage, loadFromStorage, clearStorage, runGravityLayout, - searchContent, highlightSearchResults, clearSearch, getSearchMatchPosition + searchContent, highlightSearchResults, clearSearch, getSearchMatchPosition, + setOnMemoryPlaced }; })();