mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-04-01 15:50:11 -04:00
Fix for streaming new serialized Aethers into worlds where their Thangs hadn't existed before.
This commit is contained in:
parent
b6f37694e1
commit
45471b8030
2 changed files with 8 additions and 2 deletions
app
|
@ -448,6 +448,8 @@ module.exports = class World
|
|||
for thangID, methods of o.userCodeMap
|
||||
for methodName, serializedAether of methods
|
||||
for aetherStateKey in ['flow', 'metrics', 'style', 'problems']
|
||||
w.userCodeMap[thangID] ?= {}
|
||||
w.userCodeMap[thangID][methodName] ?= {}
|
||||
w.userCodeMap[thangID][methodName][aetherStateKey] = serializedAether[aetherStateKey]
|
||||
else
|
||||
w = new World o.userCodeMap, classMap
|
||||
|
|
|
@ -107,10 +107,14 @@ module.exports = class DocFormatter
|
|||
v = @options.thang[@doc.name]
|
||||
else
|
||||
v = window[@doc.owner][@doc.name] # grab Math or Vector
|
||||
if @doc.type is 'number' and not isNaN v
|
||||
if @doc.type is 'number' and not _.isNaN v
|
||||
if v == Math.round v
|
||||
return v
|
||||
return v?.toFixed(2) ? 'null'
|
||||
if _.isNumber v
|
||||
return v.toFixed 2
|
||||
unless v
|
||||
return 'null'
|
||||
return '' + v
|
||||
if _.isString v
|
||||
return "\"#{v}\""
|
||||
if v?.id
|
||||
|
|
Loading…
Add table
Reference in a new issue