mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Prefer const variables
This commit is contained in:
@@ -1006,7 +1006,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let chattyMembers = [];
|
const chattyMembers = [];
|
||||||
// activation by talkativeness (in shuffled order, except banned)
|
// activation by talkativeness (in shuffled order, except banned)
|
||||||
const shuffledMembers = shuffle([...members]);
|
const shuffledMembers = shuffle([...members]);
|
||||||
for (let member of shuffledMembers) {
|
for (let member of shuffledMembers) {
|
||||||
@@ -1017,10 +1017,9 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i
|
|||||||
}
|
}
|
||||||
|
|
||||||
const rollValue = Math.random();
|
const rollValue = Math.random();
|
||||||
let talkativeness = Number(character.talkativeness);
|
const talkativeness = isNaN(character.talkativeness)
|
||||||
talkativeness = Number.isNaN(talkativeness)
|
|
||||||
? talkativeness_default
|
? talkativeness_default
|
||||||
: talkativeness;
|
: Number(character.talkativeness);
|
||||||
if (talkativeness >= rollValue) {
|
if (talkativeness >= rollValue) {
|
||||||
activatedMembers.push(member);
|
activatedMembers.push(member);
|
||||||
}
|
}
|
||||||
@@ -1032,7 +1031,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i
|
|||||||
// pick 1 at random if no one was activated
|
// pick 1 at random if no one was activated
|
||||||
let retries = 0;
|
let retries = 0;
|
||||||
// try to limit the selected random character to those with talkativeness > 0
|
// try to limit the selected random character to those with talkativeness > 0
|
||||||
let randomPool = chattyMembers.length > 0? chattyMembers : members;
|
const randomPool = chattyMembers.length > 0 ? chattyMembers : members;
|
||||||
while (activatedMembers.length === 0 && ++retries <= randomPool.length) {
|
while (activatedMembers.length === 0 && ++retries <= randomPool.length) {
|
||||||
const randomIndex = Math.floor(Math.random() * randomPool.length);
|
const randomIndex = Math.floor(Math.random() * randomPool.length);
|
||||||
const character = characters.find((x) => x.avatar === randomPool[randomIndex]);
|
const character = characters.find((x) => x.avatar === randomPool[randomIndex]);
|
||||||
|
Reference in New Issue
Block a user