Prefer const variables
| @@ -1006,7 +1006,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i | ||
| 1006 | 1006 | } |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | 1009 | letconst chattyMembers = []; |
| 1010 | 1010 | // activation by talkativeness (in shuffled order, except banned) |
| 1011 | 1011 | const shuffledMembers = shuffle([...members]); |
| 1012 | 1012 | for (let member of shuffledMembers) { |
| @@ -1017,10 +1017,9 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i | ||
| 1017 | 1017 | } |
| 1018 | 1018 | |
| 1019 | 1019 | const rollValue = Math.random(); |
| 1020 | 1020 | letconst talkativeness = NumberisNaN(character.talkativeness); |
| 1021 | - talkativeness = Number.isNaN(talkativeness) | |
| 1022 | 1021 | ? talkativeness_default |
| 1023 | 1022 | : Number(character.talkativeness); |
| 1024 | 1023 | if (talkativeness >= rollValue) { |
| 1025 | 1024 | activatedMembers.push(member); |
| 1026 | 1025 | } |
| @@ -1032,7 +1031,7 @@ function activateNaturalOrder(members, input, lastMessage, allowSelfResponses, i | ||
| 1032 | 1031 | // pick 1 at random if no one was activated |
| 1033 | 1032 | let retries = 0; |
| 1034 | 1033 | // try to limit the selected random character to those with talkativeness > 0 |
| 1035 | 1034 | letconst randomPool = chattyMembers.length > 0 ? chattyMembers : members; |
| 1036 | 1035 | while (activatedMembers.length === 0 && ++retries <= randomPool.length) { |
| 1037 | 1036 | const randomIndex = Math.floor(Math.random() * randomPool.length); |
| 1038 | 1037 | const character = characters.find((x) => x.avatar === randomPool[randomIndex]); |