tpmkms_4wp 7.4.3-beta.9 → 7.5.0
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.
Potentially problematic release.
This version of tpmkms_4wp might be problematic. Click here for more details.
- package/common/dialogues.js +4 -0
- package/common/pipboy.js +61 -64
- package/common/pipboy.test.json +729 -406
- package/common/ui.instance.json +2 -0
- package/common/ui.js +105 -0
- package/common/ui.test.json +780 -0
- package/main.js +2 -0
- package/package.json +6 -3
package/common/dialogues.js
CHANGED
@@ -182,6 +182,8 @@ let config = {
|
|
182
182
|
"([unknown])",
|
183
183
|
"([not] ([notAble|]))",
|
184
184
|
|
185
|
+
"([preposition])",
|
186
|
+
|
185
187
|
"([be] ([briefOrWordy|]))",
|
186
188
|
|
187
189
|
"([([canBeQuestion])])",
|
@@ -227,6 +229,7 @@ let config = {
|
|
227
229
|
]
|
228
230
|
},
|
229
231
|
bridges: [
|
232
|
+
{ id: "preposition", level: 0, bridge: "{ ...next(operator) }" },
|
230
233
|
{ id: "by", level: 0, bridge: "{ ...next(operator), object: after[0] }", optional: { 'isEder': "{ marker: 'unknown', implicit: true, concept: true }", }, },
|
231
234
|
|
232
235
|
{ id: "pronoun", level: 0, bridge: "{ ...next(operator) }" },
|
@@ -333,6 +336,7 @@ let config = {
|
|
333
336
|
[['is', 0], ['isEdAble', 0]],
|
334
337
|
[['is', 1], ['isEdAble', 0]],
|
335
338
|
[['verby', 0], ['pronoun', 0]],
|
339
|
+
[['verby', 0], ['preposition', 0]],
|
336
340
|
[['verby', 0], ['articlePOS', 0]],
|
337
341
|
],
|
338
342
|
hierarchy: [
|
package/common/pipboy.js
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
const { Config, knowledgeModule, where, Digraph } = require('./runtime').theprogrammablemind
|
2
|
-
const
|
2
|
+
const dialogues = require('./dialogues')
|
3
3
|
const pipboy_tests = require('./pipboy.test.json')
|
4
4
|
|
5
5
|
class API {
|
6
6
|
// id in stats, inv, data, map, radio
|
7
7
|
// under stats: status, special, perks
|
8
|
-
// under inventory: weapons,
|
8
|
+
// under inventory: weapons, apparel, aid
|
9
9
|
setDisplay(id) {
|
10
10
|
this.objects.display = id
|
11
11
|
}
|
@@ -20,17 +20,56 @@ class API {
|
|
20
20
|
apply(item) {
|
21
21
|
this.objects.apply = item
|
22
22
|
}
|
23
|
+
|
24
|
+
// 'weapon', 'apparel'
|
25
|
+
// TODO to: x (the pistol/a pistol/<specific pistol by id?>
|
26
|
+
change(item) {
|
27
|
+
this.objects.change = item
|
28
|
+
}
|
23
29
|
}
|
24
30
|
const api = new API()
|
25
31
|
|
26
32
|
let config = {
|
27
33
|
name: 'pipboy',
|
34
|
+
// TODO mark default as local scope
|
28
35
|
operators: [
|
29
|
-
"([show] ([showable
|
36
|
+
"([show] ([showable]))",
|
30
37
|
"(([content]) [tab])",
|
31
38
|
"([apply] ([stimpack]))",
|
39
|
+
"([go] ([to2|to] ([showable|])))",
|
40
|
+
"([change] ([changeable]))",
|
41
|
+
"([weapon])",
|
42
|
+
"([apparel])",
|
32
43
|
],
|
33
44
|
bridges: [
|
45
|
+
{
|
46
|
+
id: "change",
|
47
|
+
isA: ['verby'],
|
48
|
+
level: 0,
|
49
|
+
bridge: "{ ...next(operator), item: after[0] }",
|
50
|
+
generatorp: ({context, g}) => `change ${g(context.item)}`,
|
51
|
+
semantic: ({api, context}) => {
|
52
|
+
api.change(context.item.marker)
|
53
|
+
}
|
54
|
+
},
|
55
|
+
{
|
56
|
+
id: "changeable",
|
57
|
+
level: 0,
|
58
|
+
bridge: "{ ...next(operator) }"
|
59
|
+
},
|
60
|
+
{
|
61
|
+
id: "apparel",
|
62
|
+
level: 0,
|
63
|
+
isA: ['changeable'],
|
64
|
+
bridge: "{ ...next(operator) }"
|
65
|
+
},
|
66
|
+
{
|
67
|
+
id: "weapon",
|
68
|
+
level: 0,
|
69
|
+
words: ['weapons'],
|
70
|
+
isA: ['changeable'],
|
71
|
+
bridge: "{ ...next(operator) }"
|
72
|
+
},
|
34
73
|
{
|
35
74
|
id: "apply",
|
36
75
|
isA: ['verby'],
|
@@ -42,6 +81,23 @@ let config = {
|
|
42
81
|
api.apply({ item: 'stimpack', quantity: 1 })
|
43
82
|
}
|
44
83
|
},
|
84
|
+
{
|
85
|
+
id: "go",
|
86
|
+
isA: ['verby'],
|
87
|
+
level: 0,
|
88
|
+
bridge: "{ ...next(operator), showable: after[0].showable }",
|
89
|
+
generatorp: ({context, g}) => `go to ${g(context.showable)}`,
|
90
|
+
semantic: ({api, context}) => {
|
91
|
+
api.setDisplay(context.showable.value)
|
92
|
+
}
|
93
|
+
},
|
94
|
+
{
|
95
|
+
id: "to2",
|
96
|
+
isA: ['preposition'],
|
97
|
+
level: 0,
|
98
|
+
bridge: "{ ...next(operator), showable: after[0] }",
|
99
|
+
generatorp: ({context, g}) => `to ${g(context.showable)}`,
|
100
|
+
},
|
45
101
|
{
|
46
102
|
id: "show",
|
47
103
|
isA: ['verby'],
|
@@ -87,76 +143,17 @@ let config = {
|
|
87
143
|
['special', 'special'],
|
88
144
|
['perks', 'perks'],
|
89
145
|
['weapons', 'weapons'],
|
90
|
-
['
|
146
|
+
['apparel', 'apparel'],
|
91
147
|
['aid', 'aid'],
|
92
148
|
].map(
|
93
149
|
([word, value]) => { return { word, value } })
|
94
150
|
},
|
95
151
|
],
|
96
|
-
|
97
|
-
generators: [
|
98
|
-
{
|
99
|
-
where: where(),
|
100
|
-
match: ({context}) => context.marker == 'currency' && !context.isAbstract,
|
101
|
-
apply: ({context, g}) => {
|
102
|
-
word = Object.assign({}, context.amount)
|
103
|
-
word.isAbstract = true
|
104
|
-
word.marker = 'currency'
|
105
|
-
word.units = context.units
|
106
|
-
word.value = context.amount.value
|
107
|
-
// generator = [({context}) => context.marker == 'currency' && context.units == words.units && context.value > 1 && context.isAbstract, ({context, g}) => words.many ]
|
108
|
-
return `${g(context.amount.value)} ${g(word)}`
|
109
|
-
}
|
110
|
-
},
|
111
|
-
],
|
112
|
-
|
113
|
-
semantics: [
|
114
|
-
{
|
115
|
-
match: ({objects, context}) => context.marker == 'in',
|
116
|
-
where: where(),
|
117
|
-
apply: ({objects, api, context}) => {
|
118
|
-
const from = context.from
|
119
|
-
const to = context.to
|
120
|
-
const value = api.convertTo(from.amount.value, from.units, to.units)
|
121
|
-
context.marker = 'currency'
|
122
|
-
context.isAbstract = false
|
123
|
-
context.amount = { value }
|
124
|
-
context.units = to.units
|
125
|
-
context.isResponse = true
|
126
|
-
}
|
127
|
-
}
|
128
|
-
],
|
129
152
|
};
|
130
153
|
|
131
154
|
config = new Config(config, module)
|
132
|
-
config.add(
|
155
|
+
config.add(dialogues)
|
133
156
|
config.api = api
|
134
|
-
config.initializer( ({config, objects, api, uuid}) => {
|
135
|
-
/*
|
136
|
-
units = api.getUnits()
|
137
|
-
for (word in units) {
|
138
|
-
words = config.get('words')
|
139
|
-
def = {"id": "currency", "initial": { units: units[word] }, uuid}
|
140
|
-
if (words[word]) {
|
141
|
-
words[word].push(def)
|
142
|
-
} else {
|
143
|
-
words[word] = [def]
|
144
|
-
}
|
145
|
-
}
|
146
|
-
|
147
|
-
unitWords = api.getUnitWords();
|
148
|
-
for (let words of unitWords) {
|
149
|
-
config.addGenerator(
|
150
|
-
({context}) => context.marker == 'currency' && context.units == words.units && context.value == 1 && context.isAbstract,
|
151
|
-
({context, g}) => words.one, uuid
|
152
|
-
);
|
153
|
-
config.addGenerator(
|
154
|
-
({context}) => context.marker == 'currency' && context.units == words.units && !isNaN(context.value) && (context.value != 1) && context.isAbstract,
|
155
|
-
({context, g}) => words.many, uuid
|
156
|
-
)
|
157
|
-
}
|
158
|
-
*/
|
159
|
-
})
|
160
157
|
|
161
158
|
knowledgeModule({
|
162
159
|
module,
|