From ecba7f726f70b37126d852c38c7e3eec7b04d730 Mon Sep 17 00:00:00 2001
From: historia <[not public]>
Date: Thu, 9 Jul 2026 22:15:54 -0400
Subject: feat: old standalone trigger systems completely unified into
trigger->condition->action system
---
internal/admin/static/map.js | 229 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 229 insertions(+)
(limited to 'internal/admin/static/map.js')
diff --git a/internal/admin/static/map.js b/internal/admin/static/map.js
index 00230a4..ab20a86 100644
--- a/internal/admin/static/map.js
+++ b/internal/admin/static/map.js
@@ -575,6 +575,8 @@ function renderSidePanel(data) {
html += '';
html += '';
html += '';
+ html += '';
+ html += '';
html += '';
html += '
';
@@ -595,6 +597,8 @@ function renderSidePanel(data) {
html += renderCourseTab();
}
}
+ else if (currentPanelTab === 8) html += renderEnterExitTab(r);
+ else if (currentPanelTab === 9) html += renderTriggersTab(r);
html += '
';
panel.innerHTML = html;
@@ -1401,6 +1405,8 @@ function switchPanelTab(idx) {
html = renderCourseTab();
}
}
+ else if (idx === 8) html = renderEnterExitTab(r);
+ else if (idx === 9) html = renderTriggersTab(r);
var content = document.querySelector('.panel-tab-content');
if (content) content.innerHTML = html;
var tabs = document.querySelectorAll('.panel-tab');
@@ -2096,6 +2102,10 @@ async function doSavePanel() {
r.mobs = currentRoomData.room.mobs;
r.exits = currentRoomData.room.exits;
r.hazard = currentRoomData.room.hazard || '';
+ r.on_enter = currentRoomData.room.on_enter;
+ r.on_exit = currentRoomData.room.on_exit;
+ r.on_flag_change = currentRoomData.room.on_flag_change;
+ r.on_global_flag_change = currentRoomData.room.on_global_flag_change;
if (r.block_transport === undefined) r.block_transport = currentRoomData.room.block_transport;
}
@@ -3350,3 +3360,222 @@ document.addEventListener('DOMContentLoaded', function() { loadRoomDirs(function
window.addEventListener('keydown', function(e) { if (isCtrlKey(e)) { ctrlHeld = true; if (dragging) refreshDragMode(true); } });
window.addEventListener('keyup', function(e) { if (isCtrlKey(e)) { ctrlHeld = false; if (dragging) refreshDragMode(false); } });
});
+
+// ── Enter/Exit tab ──
+// Renders on_enter and on_exit trigger lists, wiring the shared ie_* helpers
+// from intereditor.js so the same condition/step/message editors used by the
+// object/mob editors are reused here. Edits mutate currentRoomData.room.*
+// and the debounced autoSave() persists them.
+
+function renderEnterExitTab(r) {
+ var onEnter = Array.isArray(r.on_enter) ? r.on_enter : [];
+ var onExit = Array.isArray(r.on_exit) ? r.on_exit : [];
+ window._editorData = { on_enter: onEnter, on_exit: onExit };
+
+ window._ieRenderCurrent = function() {
+ if (window._ieSyncAll) window._ieSyncAll(window._editorData, [
+ {id: 'on_enter', path: 'on_enter', isArray: true, interactionStyle: true, itemIDAllowed: false, label: 'Trigger'},
+ {id: 'on_exit', path: 'on_exit', isArray: true, interactionStyle: true, itemIDAllowed: false, label: 'Trigger'}
+ ]);
+ if (currentRoomData && currentRoomData.room) {
+ currentRoomData.room.on_enter = window._editorData.on_enter;
+ currentRoomData.room.on_exit = window._editorData.on_exit;
+ }
+ switchPanelTab(8);
+ autoSave();
+ };
+ window._ieRenderOnly = window._ieRenderCurrent;
+ window._ieSyncAll = ie_syncAllInteractions;
+
+ var h = '
On-Enter Triggers
';
+ h += '
Fires when a player enters this room. First matching entry wins.
';
+ h += renderTriggerListHTML(r.on_enter, 'on_enter', 'on_enter', false);
+ h += '
On-Exit Triggers
';
+ h += '
Fires when a player leaves this room. First matching entry wins.