| 8 | |
| 9 | module.exports = class VerifierTest extends CocoClass { |
| 10 | constructor (levelID, updateCallback, supermodel, language, options) { |
| 11 | super() |
| 12 | this.onWorldNecessitiesLoaded = this.onWorldNecessitiesLoaded.bind(this) |
| 13 | this.configureSession = this.configureSession.bind(this) |
| 14 | this.cleanup = this.cleanup.bind(this) |
| 15 | this.load = this.load.bind(this) |
| 16 | this.levelID = levelID |
| 17 | this.updateCallback = updateCallback |
| 18 | this.supermodel = supermodel |
| 19 | this.language = language |
| 20 | this.options = options |
| 21 | // TODO: turn this into a Subview |
| 22 | // TODO: listen to the progress report from Angel to show a simulation progress bar (maybe even out of the number of frames we actually know it'll take) |
| 23 | if (!this.supermodel) { this.supermodel = new SuperModel() } |
| 24 | |
| 25 | if (utils.getQueryVariable('dev') || this.options.devMode) { |
| 26 | this.supermodel.shouldSaveBackups = model => // Make sure to load possibly changed things from localStorage. |
| 27 | ['Level', 'LevelComponent', 'LevelSystem', 'ThangType'].includes(model.constructor.className) |
| 28 | } |
| 29 | this.solution = this.options.solution |
| 30 | this.simpleDescription = '' |
| 31 | this.name = '' |
| 32 | if (this.language == null) { this.language = 'python' } |
| 33 | this.userCodeProblems = [] |
| 34 | |
| 35 | this.checkClampedProperties = utils.getQueryVariable('check_prop') || options.enableFuzzyVerifier || false |
| 36 | this.checkPropKeys = ['maxHealth', 'maxSpeed', 'attackDamage', 'maxxSpeed', 'maxxAttackDamage'] |
| 37 | this.checkPropIndex = 0 |
| 38 | this.clampedProperties = { |
| 39 | inited: false |
| 40 | } |
| 41 | // hero.attackDamage |
| 42 | // hero.health |
| 43 | // hero.maxHealth |
| 44 | // hero.maxSpeed |
| 45 | // level.recommendedHealth |
| 46 | this.load() |
| 47 | } |
| 48 | |
| 49 | load () { |
| 50 | this.supermodel.resetProgress() |