tpmkms_4wp 9.5.1 → 9.6.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/common/animals.instance.json +151 -61
- package/common/animals.js +3 -5
- package/common/asking.js +116 -106
- package/common/avatar.test.json +1001 -860
- package/common/can.instance.json +2194 -0
- package/common/can.js +251 -0
- package/common/can.test.json +51307 -0
- package/common/characters.js +5 -5
- package/common/colors.instance.json +152 -12
- package/common/colors.js +3 -6
- package/common/comparable.instance.json +33 -3
- package/common/comparable.js +3 -6
- package/common/concept.js +25 -27
- package/common/concept.test.json +180 -144
- package/common/conjunction.js +13 -5
- package/common/conjunction.test.json +32 -42
- package/common/crew.instance.json +433 -173
- package/common/crew.js +4 -7
- package/common/crew.test.json +4148 -3324
- package/common/currency.js +1 -1
- package/common/dateTimeSelectors.instance.json +2 -2
- package/common/dateTimeSelectors.js +6 -9
- package/common/dateTimeSelectors.test.json +76935 -35739
- package/common/dates.instance.json +53 -3
- package/common/dates.js +3 -6
- package/common/dates.test.json +284 -287
- package/common/dialogues.js +43 -122
- package/common/dialogues.test.json +1248 -1152
- package/common/dimension.instance.json +21493 -561
- package/common/dimension.js +150 -55
- package/common/dimension.test.json +10979 -4625
- package/common/drone.instance.json +24709 -0
- package/common/drone.js +662 -0
- package/common/drone.test.json +30522 -0
- package/common/drone_v1.instance.json +24703 -0
- package/common/drone_v1.js +596 -0
- package/common/drone_v1.test.json +115538 -0
- package/common/edible.instance.json +388 -32
- package/common/edible.js +3 -5
- package/common/emotions.instance.json +85 -76
- package/common/emotions.js +4 -7
- package/common/emotions.test.json +242 -174
- package/common/english_helpers.js +336 -0
- package/common/errors.js +6 -6
- package/common/evaluate.js +2 -2
- package/common/events.js +8 -8
- package/common/fastfood.instance.json +1071 -393
- package/common/fastfood.js +14 -16
- package/common/fastfood.test.json +6970 -6829
- package/common/formulas.instance.json +11 -1
- package/common/formulas.js +3 -2
- package/common/gdefaults.js +111 -17
- package/common/help.js +12 -12
- package/common/help.test.json +65 -11
- package/common/helpers/concept.js +1 -1
- package/common/helpers/conjunction.js +54 -44
- package/common/helpers/dateTimeSelectors.js +2 -2
- package/common/helpers/dialogues.js +10 -2
- package/common/helpers/formulas.js +13 -11
- package/common/helpers/menus.js +12 -12
- package/common/helpers/meta.js +9 -9
- package/common/helpers/properties.js +186 -64
- package/common/helpers.js +167 -48
- package/common/hierarchy.js +12 -10
- package/common/kirk.instance.json +11 -1
- package/common/kirk.js +4 -6
- package/common/kirk.test.json +600 -424
- package/common/latin.instance.json +12 -12
- package/common/latin.js +12 -14
- package/common/length.instance.json +34660 -3158
- package/common/length.js +11 -6
- package/common/length.test.json +54357 -2557
- package/common/math.instance.json +39 -29
- package/common/math.js +49 -47
- package/common/menus.instance.json +77 -10
- package/common/menus.js +4 -13
- package/common/meta.js +80 -65
- package/common/nameable.js +36 -22
- package/common/nameable.test.json +436 -0
- package/common/numbers.js +1 -1
- package/common/ordering.instance.json +107 -19
- package/common/ordering.js +4 -6
- package/common/ordering.test.json +835 -417
- package/common/people.instance.json +176 -348
- package/common/people.js +9 -9
- package/common/people.test.json +4135 -3606
- package/common/pipboy.instance.json +187 -17
- package/common/pipboy.js +4 -4
- package/common/pokemon.instance.json +143 -13
- package/common/pokemon.js +4 -6
- package/common/pressure.instance.json +3610 -1601
- package/common/pressure.js +3 -5
- package/common/pressure.test.json +433 -477
- package/common/properties.instance.json +16 -17
- package/common/properties.js +32 -13
- package/common/properties.test.json +9565 -6951
- package/common/rates.instance.json +59 -0
- package/common/rates.js +95 -0
- package/common/rates.test.json +27702 -0
- package/common/reminders.instance.json +4 -4
- package/common/reminders.js +8 -11
- package/common/reminders.test.json +64635 -25787
- package/common/reports.instance.json +23 -3
- package/common/reports.js +21 -21
- package/common/scorekeeper.js +9 -12
- package/common/sdefaults.js +22 -2
- package/common/spock.instance.json +11 -1
- package/common/spock.js +4 -7
- package/common/spock.test.json +606 -430
- package/common/stgame.js +1 -1
- package/common/stm.js +41 -24
- package/common/tell.js +1 -1
- package/common/temperature.instance.json +3163 -1154
- package/common/temperature.js +3 -5
- package/common/temperature.test.json +433 -477
- package/common/tester.js +3 -3
- package/common/time.instance.json +24852 -0
- package/common/time.js +138 -141
- package/common/time.test.json +31876 -3757
- package/common/tokenize.js +5 -2
- package/common/ui.instance.json +12 -5
- package/common/ui.js +4 -13
- package/common/weight.instance.json +10501 -4099
- package/common/weight.js +3 -5
- package/common/weight.test.json +2601 -2263
- package/common/words.instance.json +9 -0
- package/common/words.js +50 -0
- package/common/words.test.json +2 -0
- package/common/wp.instance.json +548 -8
- package/common/wp.js +10 -8
- package/common/wp.test.json +7385 -6906
- package/main.js +6 -2
- package/package.json +25 -6
- package/common/listener.js +0 -50
- package/common/listener.test.json +0 -142
package/common/asking.js
CHANGED
|
@@ -12,8 +12,8 @@ const config = {
|
|
|
12
12
|
name: 'asking',
|
|
13
13
|
operators: [
|
|
14
14
|
"([nevermind])",
|
|
15
|
-
{ pattern: "([nevermindTestSetup] (allowed))",
|
|
16
|
-
{ pattern: "([whichOnesTestSetup] (choices)*)",
|
|
15
|
+
{ pattern: "([nevermindTestSetup] (allowed))", scope: "testing" },
|
|
16
|
+
{ pattern: "([whichOnesTestSetup] (choices)*)", scope: "testing" },
|
|
17
17
|
],
|
|
18
18
|
bridges: [
|
|
19
19
|
{
|
|
@@ -22,32 +22,37 @@ const config = {
|
|
|
22
22
|
semantic: (args) => {
|
|
23
23
|
const {config, context} = args
|
|
24
24
|
// stop asking all questions
|
|
25
|
-
|
|
25
|
+
const remove = []
|
|
26
|
+
for (const semantic of config.semantics()) {
|
|
26
27
|
if (semantic.isQuestion) {
|
|
27
28
|
let doRemove = true
|
|
28
29
|
if (semantic.onNevermind && semantic.getWasAsked() && !semantic.getWasApplied()) {
|
|
29
30
|
doRemove = semantic.onNevermind(args)
|
|
30
31
|
}
|
|
31
32
|
if (doRemove) {
|
|
32
|
-
|
|
33
|
+
remove.push(semantic)
|
|
34
|
+
// config.removeSemantic(semantic)
|
|
33
35
|
}
|
|
34
36
|
}
|
|
35
37
|
}
|
|
38
|
+
for (const semantic of remove) {
|
|
39
|
+
config.removeSemantic(semantic)
|
|
40
|
+
}
|
|
36
41
|
}
|
|
37
42
|
},
|
|
38
43
|
|
|
39
44
|
{
|
|
40
45
|
id: "whichOnesTestSetup",
|
|
41
|
-
|
|
46
|
+
scope: "testing",
|
|
42
47
|
generatorp: async ({context, gs}) => `${context.marker} ${await gs(context.choices)}`,
|
|
43
48
|
bridge: "{ ...next(operator), choices: after[0] }",
|
|
44
49
|
semantic: ({askWhich, context}) => {
|
|
45
50
|
const choices = context.choices
|
|
46
|
-
|
|
51
|
+
function chosen({ choice, objects }) {
|
|
47
52
|
objects.choice = choice
|
|
48
53
|
}
|
|
49
54
|
|
|
50
|
-
|
|
55
|
+
async function question({choices, g, gs, wasAsked, state}) {
|
|
51
56
|
if (wasAsked) {
|
|
52
57
|
return `${await g(state.lastChoice)} is not a choice. The choices are: ${await gs(choices, ' ', ' or ')}`
|
|
53
58
|
} else {
|
|
@@ -55,7 +60,7 @@ const config = {
|
|
|
55
60
|
}
|
|
56
61
|
}
|
|
57
62
|
|
|
58
|
-
|
|
63
|
+
function isChoice({context, choices, state}) {
|
|
59
64
|
state.lastChoice = context
|
|
60
65
|
for (const choice of choices) {
|
|
61
66
|
if (choice.value == context.value) {
|
|
@@ -64,7 +69,7 @@ const config = {
|
|
|
64
69
|
}
|
|
65
70
|
}
|
|
66
71
|
|
|
67
|
-
|
|
72
|
+
function onNevermind({objects, context}) {
|
|
68
73
|
objects.onNevermindWasCalled = true
|
|
69
74
|
return true
|
|
70
75
|
}
|
|
@@ -75,7 +80,7 @@ const config = {
|
|
|
75
80
|
|
|
76
81
|
{
|
|
77
82
|
id: "nevermindTestSetup",
|
|
78
|
-
|
|
83
|
+
scope: "testing",
|
|
79
84
|
bridge: "{ ...next(operator), type: after[0], postModifiers: ['type'] }",
|
|
80
85
|
semantic: ({ask, context}) => {
|
|
81
86
|
const nevermindType = context.type.value
|
|
@@ -94,115 +99,120 @@ const config = {
|
|
|
94
99
|
],
|
|
95
100
|
};
|
|
96
101
|
|
|
97
|
-
|
|
98
|
-
return (
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
oneShot
|
|
103
|
-
|
|
102
|
+
function getAsk(config) {
|
|
103
|
+
return (uuid) => {
|
|
104
|
+
return (asks) => {
|
|
105
|
+
function ask(ask, s_ids) {
|
|
106
|
+
let oneShot = true // default
|
|
107
|
+
if (ask.oneShot === false) {
|
|
108
|
+
oneShot = false
|
|
109
|
+
}
|
|
104
110
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
111
|
+
const id_q = stableId('semantic')
|
|
112
|
+
s_ids.push(id_q)
|
|
113
|
+
const id_rs = []
|
|
114
|
+
let wasAsked = false
|
|
115
|
+
let wasApplied = false
|
|
116
|
+
function getWasAsked() {
|
|
117
|
+
return wasAsked
|
|
118
|
+
}
|
|
119
|
+
function setWasAsked(value) {
|
|
120
|
+
wasAsked = value
|
|
121
|
+
}
|
|
122
|
+
function getWasApplied() {
|
|
123
|
+
return wasApplied
|
|
124
|
+
}
|
|
125
|
+
function setWasApplied(value) {
|
|
126
|
+
wasApplied = value
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const semanticsr = ask.semanticsr || []
|
|
130
|
+
if (semanticsr.length == 0) {
|
|
131
|
+
semanticsr.push({ match: ask.matchr, apply: ask.applyr })
|
|
132
|
+
}
|
|
133
|
+
for (const semantic of semanticsr) {
|
|
134
|
+
const id_r = stableId('semantic')
|
|
135
|
+
id_rs.push(id_r)
|
|
136
|
+
s_ids.push(id_r)
|
|
137
|
+
config.addSemantic({
|
|
138
|
+
uuid,
|
|
139
|
+
id: id_r,
|
|
140
|
+
tied_ids: [id_q],
|
|
141
|
+
// tied_ids: s_ids,
|
|
142
|
+
onDelete: ask.onDelete,
|
|
143
|
+
oneShot,
|
|
144
|
+
where: semantic.where || ask.where || where(2),
|
|
145
|
+
source: 'response',
|
|
146
|
+
match: (args) => semantic.match(args),
|
|
147
|
+
apply: async (args) => {
|
|
148
|
+
setWasApplied(true)
|
|
149
|
+
await semantic.apply(args)
|
|
150
|
+
},
|
|
151
|
+
})
|
|
152
|
+
}
|
|
122
153
|
|
|
123
|
-
const semanticsr = ask.semanticsr || []
|
|
124
|
-
if (semanticsr.length == 0) {
|
|
125
|
-
semanticsr.push({ match: ask.matchr, apply: ask.applyr })
|
|
126
|
-
}
|
|
127
|
-
for (const semantic of semanticsr) {
|
|
128
|
-
const id_r = stableId('semantic')
|
|
129
|
-
id_rs.push(id_r)
|
|
130
|
-
s_ids.push(id_r)
|
|
131
|
-
// debugger
|
|
132
154
|
config.addSemantic({
|
|
133
155
|
uuid,
|
|
134
|
-
|
|
135
|
-
|
|
156
|
+
oneShot,
|
|
157
|
+
id: id_q,
|
|
158
|
+
tied_ids: id_rs,
|
|
136
159
|
// tied_ids: s_ids,
|
|
160
|
+
where: ask.where,
|
|
161
|
+
isQuestion: true, // do one question at a time
|
|
162
|
+
getWasAsked,
|
|
163
|
+
getWasApplied,
|
|
137
164
|
onDelete: ask.onDelete,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
match: (args) => semantic.match(args),
|
|
165
|
+
onNevermind: ask.onNevermind,
|
|
166
|
+
source: 'question',
|
|
167
|
+
match: ({ context }) => context.marker == 'controlEnd' || context.marker == 'controlBetween',
|
|
142
168
|
apply: async (args) => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
id: id_q,
|
|
153
|
-
tied_ids: id_rs,
|
|
154
|
-
// tied_ids: s_ids,
|
|
155
|
-
where: ask.where,
|
|
156
|
-
isQuestion: true, // do one question at a time
|
|
157
|
-
getWasAsked,
|
|
158
|
-
getWasApplied,
|
|
159
|
-
onDelete: ask.onDelete,
|
|
160
|
-
onNevermind: ask.onNevermind,
|
|
161
|
-
source: 'question',
|
|
162
|
-
match: ({ context }) => context.marker == 'controlEnd' || context.marker == 'controlBetween',
|
|
163
|
-
apply: async (args) => {
|
|
164
|
-
let matchq = ask.matchq
|
|
165
|
-
let applyq = ask.applyq
|
|
166
|
-
if (!matchq) {
|
|
167
|
-
let wasAsked = false
|
|
168
|
-
matchq = () => !wasAsked,
|
|
169
|
-
applyq = (args) => {
|
|
170
|
-
wasAsked = true
|
|
171
|
-
return ask.applyq(args)
|
|
169
|
+
let matchq = ask.matchq
|
|
170
|
+
let applyq = ask.applyq
|
|
171
|
+
if (!matchq) {
|
|
172
|
+
let wasAsked = false
|
|
173
|
+
matchq = () => !wasAsked,
|
|
174
|
+
applyq = (args) => {
|
|
175
|
+
wasAsked = true
|
|
176
|
+
return ask.applyq(args)
|
|
177
|
+
}
|
|
172
178
|
}
|
|
179
|
+
if (await matchq(args)) {
|
|
180
|
+
setWasApplied(false)
|
|
181
|
+
// args.context.motivationKeep = true
|
|
182
|
+
const query = await applyq({ ...args, wasAsked: getWasAsked() })
|
|
183
|
+
if (typeof query != 'string') {
|
|
184
|
+
throw new Error(`ask expects the value return from applyq to be a string. ${ask.where}`)
|
|
185
|
+
}
|
|
186
|
+
args.verbatim(query)
|
|
187
|
+
setWasAsked(true)
|
|
188
|
+
args.context.controlKeepMotivation = true
|
|
189
|
+
} else {
|
|
190
|
+
args._continue()
|
|
191
|
+
}
|
|
192
|
+
args.context.cascade = true
|
|
173
193
|
}
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
args.context.controlKeepMotivation = true
|
|
180
|
-
} else {
|
|
181
|
-
args._continue()
|
|
182
|
-
}
|
|
183
|
-
args.context.cascade = true
|
|
184
|
-
}
|
|
185
|
-
})
|
|
186
|
-
}
|
|
187
|
-
if (!Array.isArray(asks)) {
|
|
188
|
-
asks = [asks]
|
|
189
|
-
}
|
|
194
|
+
})
|
|
195
|
+
}
|
|
196
|
+
if (!Array.isArray(asks)) {
|
|
197
|
+
asks = [asks]
|
|
198
|
+
}
|
|
190
199
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
200
|
+
const s_ids = []
|
|
201
|
+
for (const a of [...asks].reverse()) {
|
|
202
|
+
// debugger
|
|
203
|
+
ask(a, s_ids)
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function cleanUp() {
|
|
207
|
+
config.removeSemantic(s_ids)
|
|
208
|
+
}
|
|
209
|
+
return cleanUp
|
|
199
210
|
}
|
|
200
|
-
return cleanUp
|
|
201
211
|
}
|
|
202
212
|
}
|
|
203
213
|
|
|
204
214
|
|
|
205
|
-
|
|
215
|
+
function initializer({objects, config, isModule}) {
|
|
206
216
|
config.addArgs(({config, api, isA}) => ({
|
|
207
217
|
getUUIDScoped: (uuid) => {
|
|
208
218
|
const ask = getAsk(config)(uuid)
|
|
@@ -221,7 +231,7 @@ const initializer = ({objects, config, isModule}) => {
|
|
|
221
231
|
}
|
|
222
232
|
|
|
223
233
|
if (!question) {
|
|
224
|
-
|
|
234
|
+
async function question({choices, g, gs, wasAsked, state}) {
|
|
225
235
|
if (wasAsked) {
|
|
226
236
|
return `${await g(state.lastChoice)} is not a choice. The choices are: ${await gs(choices, ' ', ' or ')}`
|
|
227
237
|
} else {
|
|
@@ -231,7 +241,7 @@ const initializer = ({objects, config, isModule}) => {
|
|
|
231
241
|
}
|
|
232
242
|
|
|
233
243
|
if (!isChoice) {
|
|
234
|
-
|
|
244
|
+
function isChoice({context, choices, state}) {
|
|
235
245
|
state.lastChoice = context
|
|
236
246
|
for (const choice of choices) {
|
|
237
247
|
if (choice.value == context.value) {
|