mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-27 09:35:39 -05:00
Using isThang instead of instanceof Thang.
This commit is contained in:
parent
8ccd12866e
commit
8b572f0647
4 changed files with 5 additions and 7 deletions
|
@ -23,7 +23,7 @@ module.exports = class Thang
|
|||
name
|
||||
|
||||
@resetThangIDs: -> Thang.remainingThangNames = {}
|
||||
|
||||
isThang: true
|
||||
apiProperties: ['id', 'spriteName', 'health', 'pos', 'team']
|
||||
|
||||
constructor: (@world, @spriteName, @id) ->
|
||||
|
|
|
@ -18,11 +18,11 @@ module.exports = class WorldScriptNote
|
|||
serialize: ->
|
||||
o = {channel: @channel, event: {}}
|
||||
for key, value of @event
|
||||
if value instanceof Thang
|
||||
if value?.isThang
|
||||
value = {isThang: true, id: value.id}
|
||||
else if _.isArray value
|
||||
for subval, i in value
|
||||
if subval instanceof Thang
|
||||
if subval?.isThang
|
||||
value[i] = {isThang: true, id: subval.id}
|
||||
o.event[key] = value
|
||||
o
|
||||
|
|
|
@ -39,9 +39,7 @@ module.exports.clone = clone = (obj, skipThangs=false) ->
|
|||
if (obj instanceof Vector) or (obj instanceof Rectangle)
|
||||
return obj.copy()
|
||||
|
||||
# We don't have Thang class here, but we can fake it to avoid the circular import
|
||||
#if skipThangs and obj instanceof Thang
|
||||
if skipThangs and obj.id? and obj.trackedPropertiesKeys?
|
||||
if skipThangs and obj.isThang
|
||||
return obj
|
||||
|
||||
if ArrayBufferView and obj instanceof ArrayBufferView
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
"firepad": "~0.1.2",
|
||||
"marked": "~0.3.0",
|
||||
"moment": "~2.5.0",
|
||||
"aether": "~0.1.9",
|
||||
"aether": "~0.1.10",
|
||||
"underscore.string": "~2.3.3",
|
||||
"firebase": "~1.0.2",
|
||||
"catiline": "~2.9.3"
|
||||
|
|
Loading…
Reference in a new issue