tpmkms_4wp 7.4.3 → 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.instance.json +2 -0
- package/common/pipboy.js +166 -0
- package/common/pipboy.test.json +1998 -0
- package/common/ui.instance.json +2 -0
- package/common/ui.js +105 -0
- package/common/ui.test.json +780 -0
- package/main.js +4 -0
- package/package.json +9 -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
    ADDED
    
    | @@ -0,0 +1,166 @@ | |
| 1 | 
            +
            const { Config, knowledgeModule, where, Digraph } = require('./runtime').theprogrammablemind
         | 
| 2 | 
            +
            const dialogues = require('./dialogues')
         | 
| 3 | 
            +
            const pipboy_tests = require('./pipboy.test.json')
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            class API {
         | 
| 6 | 
            +
              // id in stats, inv, data, map, radio
         | 
| 7 | 
            +
              //      under stats: status, special, perks
         | 
| 8 | 
            +
              //      under inventory: weapons, apparel, aid
         | 
| 9 | 
            +
              setDisplay(id) {
         | 
| 10 | 
            +
                this.objects.display = id
         | 
| 11 | 
            +
              }
         | 
| 12 | 
            +
             | 
| 13 | 
            +
              setWeapon(id) {
         | 
| 14 | 
            +
              }
         | 
| 15 | 
            +
             | 
| 16 | 
            +
              getWeapons() {
         | 
| 17 | 
            +
              }
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              // { item: 'stimpack', quantity: <number>, to?: [ { part: ['arm', 'leg', 'torso', head'], side?: ['left', 'right'] } ] }
         | 
| 20 | 
            +
              apply(item) {
         | 
| 21 | 
            +
                this.objects.apply = item
         | 
| 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 | 
            +
              }
         | 
| 29 | 
            +
            }
         | 
| 30 | 
            +
            const api = new API()
         | 
| 31 | 
            +
             | 
| 32 | 
            +
            let config = {
         | 
| 33 | 
            +
              name: 'pipboy',
         | 
| 34 | 
            +
              // TODO mark default as local scope
         | 
| 35 | 
            +
              operators: [
         | 
| 36 | 
            +
                "([show] ([showable]))",
         | 
| 37 | 
            +
                "(([content]) [tab])",
         | 
| 38 | 
            +
                "([apply] ([stimpack]))",
         | 
| 39 | 
            +
                "([go] ([to2|to] ([showable|])))",
         | 
| 40 | 
            +
                "([change] ([changeable]))",
         | 
| 41 | 
            +
                "([weapon])",
         | 
| 42 | 
            +
                "([apparel])",
         | 
| 43 | 
            +
              ],
         | 
| 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 | 
            +
                },
         | 
| 73 | 
            +
                { 
         | 
| 74 | 
            +
                   id: "apply", 
         | 
| 75 | 
            +
                   isA: ['verby'],
         | 
| 76 | 
            +
                   level: 0, 
         | 
| 77 | 
            +
                   bridge: "{ ...next(operator), item: after[0] }",
         | 
| 78 | 
            +
                   generatorp: ({context, g}) => `apply ${g(context.item)}`,
         | 
| 79 | 
            +
                   semantic: ({api, context}) => {
         | 
| 80 | 
            +
                      // { item: 'stimpack', quantity: <number>, to?: [ { part: ['arm', 'leg', 'torso', head'], side?: ['left', 'right'] } ] }
         | 
| 81 | 
            +
                     api.apply({ item: 'stimpack', quantity: 1 })
         | 
| 82 | 
            +
                   }
         | 
| 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 | 
            +
                },
         | 
| 101 | 
            +
                { 
         | 
| 102 | 
            +
                   id: "show", 
         | 
| 103 | 
            +
                   isA: ['verby'],
         | 
| 104 | 
            +
                   level: 0, 
         | 
| 105 | 
            +
                   bridge: "{ ...next(operator), showable: after[0] }",
         | 
| 106 | 
            +
                   generatorp: ({context, g}) => `show ${g(context.showable)}`,
         | 
| 107 | 
            +
                   semantic: ({api, context}) => {
         | 
| 108 | 
            +
                     api.setDisplay(context.showable.value)
         | 
| 109 | 
            +
                   }
         | 
| 110 | 
            +
                },
         | 
| 111 | 
            +
                { 
         | 
| 112 | 
            +
                   id: "stimpack", 
         | 
| 113 | 
            +
                   level: 0, 
         | 
| 114 | 
            +
                   isA: ['theAble'],
         | 
| 115 | 
            +
                   bridge: "{ ...next(operator) }" 
         | 
| 116 | 
            +
                },
         | 
| 117 | 
            +
                { 
         | 
| 118 | 
            +
                   id: "tab", 
         | 
| 119 | 
            +
                   level: 0, 
         | 
| 120 | 
            +
                   isA: ['showable'],
         | 
| 121 | 
            +
                   bridge: "{ ...next(operator), showable: before[0], modifiers: ['showable'] }" 
         | 
| 122 | 
            +
                },
         | 
| 123 | 
            +
                { 
         | 
| 124 | 
            +
                   id: "showable", 
         | 
| 125 | 
            +
                   level: 0, 
         | 
| 126 | 
            +
                   isA: ['theAble'],
         | 
| 127 | 
            +
                   bridge: "{ ...next(operator) }" ,
         | 
| 128 | 
            +
                },
         | 
| 129 | 
            +
                { 
         | 
| 130 | 
            +
                   id: "content", 
         | 
| 131 | 
            +
                   level: 0, 
         | 
| 132 | 
            +
                   isA: ['showable'],
         | 
| 133 | 
            +
                   bridge: "{ ...next(operator) }" ,
         | 
| 134 | 
            +
                   words: [
         | 
| 135 | 
            +
                            ['stat', 'stat'], 
         | 
| 136 | 
            +
                            ['stats', 'stat'], 
         | 
| 137 | 
            +
                            ['statistics', 'stat'], 
         | 
| 138 | 
            +
                            ['inventory', 'inv'], 
         | 
| 139 | 
            +
                            ['data', 'data'], 
         | 
| 140 | 
            +
                            ['map', 'map'], 
         | 
| 141 | 
            +
                            ['radio', 'radio'],
         | 
| 142 | 
            +
                            ['status', 'status'],
         | 
| 143 | 
            +
                            ['special', 'special'],
         | 
| 144 | 
            +
                            ['perks', 'perks'],
         | 
| 145 | 
            +
                            ['weapons', 'weapons'],
         | 
| 146 | 
            +
                            ['apparel', 'apparel'],
         | 
| 147 | 
            +
                            ['aid', 'aid'],
         | 
| 148 | 
            +
                          ].map(
         | 
| 149 | 
            +
                        ([word, value]) => { return { word, value } })
         | 
| 150 | 
            +
                },
         | 
| 151 | 
            +
              ],
         | 
| 152 | 
            +
            };
         | 
| 153 | 
            +
             | 
| 154 | 
            +
            config = new Config(config, module)
         | 
| 155 | 
            +
            config.add(dialogues)
         | 
| 156 | 
            +
            config.api = api
         | 
| 157 | 
            +
             | 
| 158 | 
            +
            knowledgeModule({ 
         | 
| 159 | 
            +
              module,
         | 
| 160 | 
            +
              description: 'Control a pipboy with speech',
         | 
| 161 | 
            +
              config,
         | 
| 162 | 
            +
              test: {
         | 
| 163 | 
            +
                name: './pipboy.test.json',
         | 
| 164 | 
            +
                contents: pipboy_tests
         | 
| 165 | 
            +
              },
         | 
| 166 | 
            +
            })
         |