diff --git a/public/css/world-info.css b/public/css/world-info.css
index 3da519c02..e7e03ad41 100644
--- a/public/css/world-info.css
+++ b/public/css/world-info.css
@@ -274,3 +274,7 @@ select.keyselect+span.select2-container .select2-selection--multiple {
align-self: center;
width: 100%;
}
+
+.world_entry:has(input[name="delay_until_recursion"]:not(:checked)) .world_entry_form_control:has(input[name="delayUntilRecursionLevel"]) {
+ display: none;
+}
diff --git a/public/index.html b/public/index.html
index 9d2b136e2..b7477dc6c 100644
--- a/public/index.html
+++ b/public/index.html
@@ -5489,6 +5489,13 @@
Automation ID
+
diff --git a/public/scripts/world-info.js b/public/scripts/world-info.js
index 5ff2b1556..09d6cd856 100644
--- a/public/scripts/world-info.js
+++ b/public/scripts/world-info.js
@@ -2953,13 +2953,35 @@ async function getWorldEntry(name, data, entry) {
delayUntilRecursionInput.data('uid', entry.uid);
delayUntilRecursionInput.on('input', async function () {
const uid = $(this).data('uid');
- const value = $(this).prop('checked');
+ const toggled = $(this).prop('checked');
+
+ // If the value contains a number, we'll take that one (set by the level input), otherwise we can use true/false switch
+ const value = toggled ? data.entries[uid].delayUntilRecursion || true : false;
+
data.entries[uid].delayUntilRecursion = value;
setWIOriginalDataValue(data, uid, 'extensions.delay_until_recursion', data.entries[uid].delayUntilRecursion);
await saveWorldInfo(name, data);
});
delayUntilRecursionInput.prop('checked', entry.delayUntilRecursion).trigger('input');
+ // delay until recursion level
+ const delayUntilRecursionLevelInput = template.find('input[name="delayUntilRecursionLevel"]');
+ delayUntilRecursionLevelInput.data('uid', entry.uid);
+ delayUntilRecursionLevelInput.on('input', async function () {
+ const uid = $(this).data('uid');
+ const content = $(this).val();
+ const value = content === '' ? (typeof data.entries[uid].delayUntilRecursion === 'boolean' ? data.entries[uid].delayUntilRecursion : true)
+ : content === 1 ? true
+ : !isNaN(Number(content)) ? Number(content)
+ : false;
+
+ data.entries[uid].delayUntilRecursion = value;
+ setWIOriginalDataValue(data, uid, 'extensions.delay_until_recursion', data.entries[uid].delayUntilRecursion);
+ await saveWorldInfo(name, data);
+ });
+ // No need to retrigger inpout event, we'll just set the curret current value. It was edited/saved above already
+ delayUntilRecursionLevelInput.val(['number', 'string'].includes(typeof entry.delayUntilRecursion) ? entry.delayUntilRecursion : '').trigger('input');
+
// duplicate button
const duplicateButton = template.find('.duplicate_entry_button');
duplicateButton.data('uid', entry.uid);
@@ -3257,7 +3279,7 @@ export const newWorldInfoEntryDefinition = {
disable: { default: false, type: 'boolean' },
excludeRecursion: { default: false, type: 'boolean' },
preventRecursion: { default: false, type: 'boolean' },
- delayUntilRecursion: { default: false, type: 'boolean' },
+ delayUntilRecursion: { default: 0, type: 'number' },
probability: { default: 100, type: 'number' },
useProbability: { default: true, type: 'boolean' },
depth: { default: DEFAULT_DEPTH, type: 'number' },