tpmkms_4wp 7.12.4-beta.2 → 7.12.4-beta.4
Sign up to get free protection for your applications and to get access to all the features.
- package/common/animals.instance.json +44 -0
- package/common/crew.instance.json +384 -252
- package/common/dialogues.js +41 -0
- package/common/dialogues.test.json +780 -0
- package/common/edible.instance.json +1380 -0
- package/common/fastfood.instance.json +26896 -395
- package/common/fastfood.js +103 -1
- package/common/fastfood.test.json +30998 -0
- package/common/help.test.json +26 -8
- package/common/helpers/concept.js +10 -1
- package/common/hierarchy.js +1 -1
- package/common/kirk.instance.json +16 -0
- package/common/length.instance.json +180 -0
- package/common/mathTemplate.instance.json +60 -0
- package/common/ordering.instance.json +52 -0
- package/common/people.instance.json +96 -0
- package/common/pokemon.instance.json +260 -0
- package/common/pressure.instance.json +32 -0
- package/common/reports.instance.json +17 -1
- package/common/scorekeeper.test.json +299 -124
- package/common/spock.instance.json +16 -0
- package/common/temperature.instance.json +92 -0
- package/common/ui.instance.json +8 -0
- package/common/weight.instance.json +252 -0
- package/package.json +2 -2
package/common/fastfood.js
CHANGED
@@ -30,6 +30,8 @@ const fastfood_instance = require('./fastfood.instance.json')
|
|
30
30
|
double hamburger
|
31
31
|
number 1 and 2
|
32
32
|
number 1 2 and 3
|
33
|
+
combo 1 through 5
|
34
|
+
|
33
35
|
*/
|
34
36
|
|
35
37
|
const template = {
|
@@ -348,6 +350,18 @@ const template = {
|
|
348
350
|
{
|
349
351
|
where: where(),
|
350
352
|
oneShot: false,
|
353
|
+
onNevermind: ({verbatim, ...args}) => {
|
354
|
+
// this is cross km boundaries from the dialogues km to this one so the api if for dialogs.
|
355
|
+
// i need to get the one for fastfood here.
|
356
|
+
const api = args.kms.fastfood.api
|
357
|
+
const needsDrink = askAbout({ args, api })
|
358
|
+
if (needsDrink.length > 1) {
|
359
|
+
verbatim("The drinks must be specified")
|
360
|
+
} else {
|
361
|
+
verbatim("The drink must be specified")
|
362
|
+
}
|
363
|
+
return false
|
364
|
+
},
|
351
365
|
matchq: (args) => askAbout(args).length > 0 && args.context.marker == 'controlEnd',
|
352
366
|
applyq: (args) => {
|
353
367
|
args.context.cascade = true
|
@@ -693,6 +707,27 @@ class API {
|
|
693
707
|
}
|
694
708
|
return map[number]
|
695
709
|
}
|
710
|
+
|
711
|
+
canBeCombo(id) {
|
712
|
+
return this.getComboNumber(id) > 0
|
713
|
+
}
|
714
|
+
|
715
|
+
getComboNumber(id) {
|
716
|
+
const combos = [
|
717
|
+
'single',
|
718
|
+
'double',
|
719
|
+
'triple',
|
720
|
+
'baconator',
|
721
|
+
'bacon_deluxe',
|
722
|
+
'spicy',
|
723
|
+
'homestyle',
|
724
|
+
'asiago_range_chicken_club',
|
725
|
+
'ultimate_chicken_grill',
|
726
|
+
'chicken_nugget',
|
727
|
+
'premium_cod',
|
728
|
+
]
|
729
|
+
return combos.findIndex((e) => e == id) + 1
|
730
|
+
}
|
696
731
|
}
|
697
732
|
|
698
733
|
const api = new API()
|
@@ -813,7 +848,74 @@ class State {
|
|
813
848
|
for (let i = 0; i < quantity; ++i) {
|
814
849
|
const item = addSize(food, { id, combo, modifications, pieces, food })
|
815
850
|
if (!this.api.isAvailable(item)) {
|
816
|
-
|
851
|
+
const available = []
|
852
|
+
for (const descendant of this.api.args.hierarchy.descendants(food.marker)) {
|
853
|
+
if (this.api.isAvailable({ id: descendant })) {
|
854
|
+
available.push(descendant)
|
855
|
+
}
|
856
|
+
}
|
857
|
+
|
858
|
+
// this sentence runs but it doesnt setup the hierarchy: 'combo 1, 2, 3, 4, 5, 6, 7, 9, 10, and 11 are combos'
|
859
|
+
// i made a wrong design choice when i setup the phrase 'combo 1 etc'. I should have mapped that to the 'single_combo'
|
860
|
+
// but instead had it be a combo with a comboNumber property. That means the language layer doesnt know about the mapping
|
861
|
+
// so that phrase doesnt work. if I set it up the other way that phrase would work. This is just a demo and I have other
|
862
|
+
// demoes to write so i am not fixin that and instead will do || is a combo
|
863
|
+
|
864
|
+
if (available.length > 0 || food.marker == 'combo') {
|
865
|
+
this.api.args.ask([
|
866
|
+
{
|
867
|
+
where: where(),
|
868
|
+
oneShot: true,
|
869
|
+
matchq: ({context}) => context.marker == 'controlEnd',
|
870
|
+
applyq: () => {
|
871
|
+
// args.context.cascade = true
|
872
|
+
const word = food.word
|
873
|
+
return `What kind of ${word}?`
|
874
|
+
},
|
875
|
+
semanticsr: [
|
876
|
+
// stuipid hack one because i didnt put combo fully into the NLI layer
|
877
|
+
{
|
878
|
+
where: where(),
|
879
|
+
match: ({context, callId, isA, api}) => {
|
880
|
+
return api.canBeCombo(context.marker)
|
881
|
+
},
|
882
|
+
apply: ({context}) => {
|
883
|
+
const comboNumber = {
|
884
|
+
value: api.getComboNumber(context.marker)
|
885
|
+
}
|
886
|
+
food.comboNumber = comboNumber
|
887
|
+
this.add(food)
|
888
|
+
}
|
889
|
+
},
|
890
|
+
{
|
891
|
+
where: where(),
|
892
|
+
match: ({context, isA}) => isA(context.marker, 'number') && !context.evaluate,
|
893
|
+
apply: ({context, e}) => {
|
894
|
+
food.comboNumber = { value: e(context).value }
|
895
|
+
this.add(Object.assign(food, context))
|
896
|
+
}
|
897
|
+
},
|
898
|
+
{
|
899
|
+
where: where(),
|
900
|
+
match: ({context, isA}) => isA(context.marker, food.marker),
|
901
|
+
apply: ({context}) => {
|
902
|
+
this.add(Object.assign(food, context))
|
903
|
+
}
|
904
|
+
},
|
905
|
+
{
|
906
|
+
where: where(),
|
907
|
+
match: ({context, isA}) => isA(context.marker, `${food.marker}_modifier`),
|
908
|
+
apply: ({context}) => {
|
909
|
+
const value = `${context.value}_${food.value}`
|
910
|
+
this.add(Object.assign(food, { value }))
|
911
|
+
}
|
912
|
+
},
|
913
|
+
]
|
914
|
+
},
|
915
|
+
])
|
916
|
+
} else {
|
917
|
+
this.api.addAskedForButNotAvailable(food)
|
918
|
+
}
|
817
919
|
return
|
818
920
|
}
|
819
921
|
|