* Constructor
()
| 377 | * Constructor |
| 378 | */ |
| 379 | constructor () { |
| 380 | super() |
| 381 | |
| 382 | // Retrieve default model with its rotors |
| 383 | const model = EnigmaEncoder.getModel('M3') |
| 384 | const rotors = EnigmaEncoder.getRotors(model.slots[0].rotors) |
| 385 | const rotorNames = rotors.map(rotor => rotor.name) |
| 386 | const rotorLabels = rotors.map(rotor => rotor.label) |
| 387 | const reflectorRotors = EnigmaEncoder.getRotors(model.reflectorRotors) |
| 388 | |
| 389 | this.addSetting({ |
| 390 | name: 'model', |
| 391 | type: 'enum', |
| 392 | value: model.name, |
| 393 | elements: models.map(model => model.name), |
| 394 | labels: models.map(model => model.label), |
| 395 | descriptions: models.map(model => model.description), |
| 396 | randomizable: false |
| 397 | }) |
| 398 | |
| 399 | this.addSetting({ |
| 400 | name: 'reflector', |
| 401 | type: 'enum', |
| 402 | value: reflectorRotors[0].name, |
| 403 | elements: reflectorRotors.map(rotor => rotor.name), |
| 404 | labels: reflectorRotors.map(rotor => rotor.label), |
| 405 | width: 4 |
| 406 | }) |
| 407 | |
| 408 | this.addSetting({ |
| 409 | name: 'positionReflector', |
| 410 | label: 'Position', |
| 411 | type: 'number', |
| 412 | value: 1, |
| 413 | integer: true, |
| 414 | min: 1, |
| 415 | max: 27, |
| 416 | describeValue: this.describePositionValue.bind(this), |
| 417 | width: 4 |
| 418 | }) |
| 419 | |
| 420 | this.addSetting({ |
| 421 | name: 'ringReflector', |
| 422 | label: 'Ring', |
| 423 | type: 'number', |
| 424 | value: 1, |
| 425 | integer: true, |
| 426 | min: 1, |
| 427 | max: 27, |
| 428 | describeValue: this.describePositionValue.bind(this), |
| 429 | width: 4 |
| 430 | }) |
| 431 | |
| 432 | // Register settings for each possible slot |
| 433 | for (let i = 0; i < EnigmaEncoder.getMaxSlotCount(); i++) { |
| 434 | this.addSetting({ |
| 435 | name: `rotor${i + 1}`, |
| 436 | label: `Rotor ${i + 1}`, |
nothing calls this directly
no test coverage detected