diff options
| author | historia <[not public]> | 2026-09-19 03:15:59 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-19 03:15:59 -0400 |
| commit | 0e60567a7a0addb9421769ee7be7853bfa8788cb (patch) | |
| tree | 7645112db0e4eae95b8a83c1e4f9aab38bede655 /internal/admin/static | |
| parent | cc33072eced3d5460512c09c42ec4531c807d7af (diff) | |
| download | thehouseoficarus-0e60567a7a0addb9421769ee7be7853bfa8788cb.tar.gz | |
refactor: simplifcation, change how rooms are stored in player yaml, remove legacy code
Diffstat (limited to 'internal/admin/static')
| -rw-r--r-- | internal/admin/static/map.js | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/internal/admin/static/map.js b/internal/admin/static/map.js index f8cee51..4c0cae4 100644 --- a/internal/admin/static/map.js +++ b/internal/admin/static/map.js @@ -2056,7 +2056,26 @@ async function doSavePanel() { var el = $('#roomName'); if (el) r.name = el.value; el = $('#roomColor'); if (el) r.color = el.value; - el = $('#roomDesc'); if (el && el.value) r.description = [{text: el.value}]; + // Only rewrite description when the textarea actually changed. The + // textarea is populated by joining every variant, so unconditionally + // assigning a single variant here destroyed conditional descriptions on + // any unrelated panel save (rename, block_transport toggle, ...). + el = $('#roomDesc'); + if (el) { + var origDesc = ''; + if (Array.isArray(r.description)) { + origDesc = r.description.map(function(d) { return d.text || ''; }).join('\n\n'); + } else if (typeof r.description === 'string') { + origDesc = r.description; + } + if (el.value !== origDesc) { + var hasConditional = Array.isArray(r.description) && r.description.some(function(d) { return d.condition; }); + if (hasConditional && !confirm('This room has conditional descriptions. Saving the edited text will replace them all with one description. Continue?')) { + return; + } + r.description = el.value ? [{text: el.value}] : []; + } + } el = $('#roomBlockTransport'); if (el) r.block_transport = el.checked; if (currentRoomData && currentRoomData.room) { |
