mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-23 15:48:11 -05:00
Protecting our replacement of Math.random via Aether.
This commit is contained in:
parent
afc14e593d
commit
f3adc216ed
6 changed files with 8 additions and 4 deletions
|
@ -289,6 +289,7 @@ self.setupDebugWorldToRunUntilFrame = function (args) {
|
|||
return;
|
||||
}
|
||||
Math.random = self.debugWorld.rand.randf; // so user code is predictable
|
||||
Aether.replaceBuiltin("Math", Math);
|
||||
}
|
||||
self.debugWorld.totalFrames = args.frame; //hack to work around error checking
|
||||
self.currentDebugWorldFrame = args.frame;
|
||||
|
@ -343,6 +344,7 @@ self.runWorld = function runWorld(args) {
|
|||
return;
|
||||
}
|
||||
Math.random = self.world.rand.randf; // so user code is predictable
|
||||
Aether.replaceBuiltin("Math", Math);
|
||||
self.postMessage({type: 'start-load-frames'});
|
||||
self.world.loadFrames(self.onWorldLoaded, self.onWorldError, self.onWorldLoadProgress);
|
||||
};
|
||||
|
|
|
@ -211,6 +211,7 @@ module.exports = class Angel extends CocoClass
|
|||
doSimulateWorld: (work) ->
|
||||
work.t1 = now()
|
||||
Math.random = work.testWorld.rand.randf # so user code is predictable
|
||||
Aether.replaceBuiltin("Math", Math)
|
||||
i = 0
|
||||
while i < work.testWorld.totalFrames
|
||||
frame = work.testWorld.getFrame i++
|
||||
|
|
|
@ -159,7 +159,7 @@ module.exports = class ThangType extends CocoModel
|
|||
spriteSheet = @builder.build()
|
||||
@logBuild @t0, false, @options.portraitOnly
|
||||
@spriteSheets[key] = spriteSheet
|
||||
delete @building[key]
|
||||
@building[key] = false
|
||||
@builder = null
|
||||
@options = null
|
||||
spriteSheet
|
||||
|
@ -171,7 +171,7 @@ module.exports = class ThangType extends CocoModel
|
|||
buildQueue[0].t0 = new Date().getTime() if buildQueue[0]
|
||||
buildQueue[0]?.buildAsync()
|
||||
@spriteSheets[key] = e.target.spriteSheet
|
||||
delete @building[key]
|
||||
@building[key] = false
|
||||
@trigger 'build-complete', {key:key, thangType:@}
|
||||
@vectorParser = null
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ UserSchema = c.object {},
|
|||
colorConfig: c.object {additionalProperties: c.colorConfig()}
|
||||
|
||||
aceConfig: c.object {},
|
||||
language: {type: 'string', 'default': 'javascript', 'enum': ['javascript', 'coffeescript', 'clojure', 'lua', 'python', 'io']}
|
||||
language: {type: 'string', 'default': 'javascript', 'enum': ['javascript', 'coffeescript', 'python', 'clojure', 'lua', 'io']}
|
||||
keyBindings: {type: 'string', 'default': 'default', 'enum': ['default', 'vim', 'emacs']}
|
||||
invisibles: {type: 'boolean', 'default': false}
|
||||
indentGuides: {type: 'boolean', 'default': false}
|
||||
|
|
|
@ -18,9 +18,9 @@ module.exports = class SpellView extends View
|
|||
editModes:
|
||||
'javascript': 'ace/mode/javascript'
|
||||
'coffeescript': 'ace/mode/coffee'
|
||||
'python': 'ace/mode/python'
|
||||
'clojure': 'ace/mode/clojure'
|
||||
'lua': 'ace/mode/lua'
|
||||
'python': 'ace/mode/python'
|
||||
'io': 'ace/mode/text'
|
||||
|
||||
keyBindings:
|
||||
|
|
|
@ -91,6 +91,7 @@ work = () ->
|
|||
self.onWorldError error
|
||||
return
|
||||
Math.random = self.world.rand.randf # so user code is predictable
|
||||
Aether.replaceBuiltin("Math", Math)
|
||||
console.log "Loading frames."
|
||||
|
||||
self.postMessage type: "start-load-frames"
|
||||
|
|
Loading…
Reference in a new issue