mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-03-02 10:57:45 +01:00
Prefer const variables
This commit is contained in:
parent
0ec79427ff
commit
3918192dee
@ -1006,7 +1006,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i
|
||||
}
|
||||
}
|
||||
|
||||
let chattyMembers = [];
|
||||
const chattyMembers = [];
|
||||
// activation by talkativeness (in shuffled order, except banned)
|
||||
const shuffledMembers = shuffle([...members]);
|
||||
for (let member of shuffledMembers) {
|
||||
@ -1017,10 +1017,9 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i
|
||||
}
|
||||
|
||||
const rollValue = Math.random();
|
||||
let talkativeness = Number(character.talkativeness);
|
||||
talkativeness = Number.isNaN(talkativeness)
|
||||
const talkativeness = isNaN(character.talkativeness)
|
||||
? talkativeness_default
|
||||
: talkativeness;
|
||||
: Number(character.talkativeness);
|
||||
if (talkativeness >= rollValue) {
|
||||
activatedMembers.push(member);
|
||||
}
|
||||
@ -1032,7 +1031,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i
|
||||
// pick 1 at random if no one was activated
|
||||
let retries = 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) {
|
||||
const randomIndex = Math.floor(Math.random() * randomPool.length);
|
||||
const character = characters.find((x) => x.avatar === randomPool[randomIndex]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user