mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 17:45:40 -05:00
Added tracking properties to systems.
This commit is contained in:
parent
dbbfbcf861
commit
05f4840369
1 changed files with 7 additions and 1 deletions
|
@ -245,11 +245,17 @@ module.exports = class World
|
|||
addScripts: (scripts...) ->
|
||||
@scripts = (@scripts ? []).concat scripts
|
||||
|
||||
addTrackedProperties: (props...) ->
|
||||
@trackedProperties = (@trackedProperties ? []).concat props
|
||||
|
||||
serialize: ->
|
||||
# Code hotspot; optimize it
|
||||
if @frames.length < @totalFrames then worldShouldBeOverBeforeSerialization
|
||||
[transferableObjects, nontransferableObjects] = [0, 0]
|
||||
o = {name: @name, totalFrames: @totalFrames, maxTotalFrames: @maxTotalFrames, frameRate: @frameRate, dt: @dt, victory: @victory, userCodeMap: {}, showCoordinates: @showCoordinates, showGrid: @showGrid, showPaths: @showPaths, indieSprites: @indieSprites}
|
||||
o = {name: @name, totalFrames: @totalFrames, maxTotalFrames: @maxTotalFrames, frameRate: @frameRate, dt: @dt, victory: @victory, userCodeMap: {}}
|
||||
|
||||
o[prop] = @[prop] for prop in @trackedProperties or []
|
||||
|
||||
for thangID, methods of @userCodeMap
|
||||
serializedMethods = o.userCodeMap[thangID] = {}
|
||||
for methodName, method of methods
|
||||
|
|
Loading…
Reference in a new issue