|
| 1 | +const fs = require('fs'); |
| 2 | +let content = fs.readFileSync('src/js/config.js', 'utf8'); |
| 3 | + |
| 4 | +// Update n_self to in: 1, out: 0 |
| 5 | +content = content.replace( |
| 6 | + /\{ id: 'n_self', type: 'ENTITY', name: '自身', desc: '实体锚点。发出实体的上下文,或作为目标赋予实体新逻辑。', in: 1, out: 1 \},/, |
| 7 | + "{ id: 'n_self', type: 'ENTITY', name: '自身', desc: '实体锚点。赋予连接至此的效果实体属性。', in: 1, out: 0 }," |
| 8 | +); |
| 9 | + |
| 10 | +// Update all TRIGGERs to in: 0, out: 1 |
| 11 | +content = content.replace( |
| 12 | + /\{ id: '(t_\w+)', type: 'TRIGGER', name: '([^']+)', desc: '([^']+)', in: 1, out: 1 \}/g, |
| 13 | + "{ id: '$1', type: 'TRIGGER', name: '$2', desc: '$3', in: 0, out: 1 }" |
| 14 | +); |
| 15 | + |
| 16 | +// Update INITIAL_NODES positions |
| 17 | +content = content.replace(/export const INITIAL_NODES = \[([\s\S]*?)\];/, `export const INITIAL_NODES = [ |
| 18 | + { protoIdx: 1, instId: 'init-t', x: 50, y: 150 }, // t_pulsar |
| 19 | + { protoIdx: 6, instId: 'init-a', x: 250, y: 150 }, // o_aim |
| 20 | + { protoIdx: 20, instId: 'init-e', x: 450, y: 150 }, // e_photon |
| 21 | + { protoIdx: 0, instId: 'init-self', x: 650, y: 150 } // n_self |
| 22 | +];`); |
| 23 | + |
| 24 | +// Update INITIAL_CONNS |
| 25 | +content = content.replace(/export const INITIAL_CONNS = \[([\s\S]*?)\];/, `export const INITIAL_CONNS = [ |
| 26 | + { fromId: 'init-t', fromPort: 0, toId: 'init-a', toPort: 0 }, |
| 27 | + { fromId: 'init-a', fromPort: 0, toId: 'init-e', toPort: 0 }, |
| 28 | + { fromId: 'init-e', fromPort: 0, toId: 'init-self', toPort: 0 } |
| 29 | +];`); |
| 30 | + |
| 31 | +fs.writeFileSync('src/js/config.js', content, 'utf8'); |
0 commit comments