diff --git a/app/lib/world/vector.coffee b/app/lib/world/vector.coffee index 93ac08e1f..dd9efe891 100644 --- a/app/lib/world/vector.coffee +++ b/app/lib/world/vector.coffee @@ -8,7 +8,7 @@ class Vector a.copy()[name](b, useZ) isVector: true - apiProperties: ['x', 'y', 'z', 'magnitude', 'heading', 'distance', 'dot', 'equals', 'copy'] + apiProperties: ['x', 'y', 'magnitude', 'heading', 'distance', 'dot', 'equals', 'copy'] constructor: (@x=0, @y=0, @z=0) -> diff --git a/app/views/play/level/hud_view.coffee b/app/views/play/level/hud_view.coffee index 3bacc6e14..3fb5ba321 100644 --- a/app/views/play/level/hud_view.coffee +++ b/app/views/play/level/hud_view.coffee @@ -270,8 +270,8 @@ module.exports = class HUDView extends View if val.id return val.id else if val.x and val.y - #return "x: #{val.x.toFixed(0)} y: #{val.y.toFixed(0)}" - return "x: #{val.x.toFixed(0)} y: #{val.y.toFixed(0)}, z: #{val.z.toFixed(0)}" # Debugging: include z + return "x: #{val.x.toFixed(0)} y: #{val.y.toFixed(0)}" + #return "x: #{val.x.toFixed(0)} y: #{val.y.toFixed(0)}, z: #{val.z.toFixed(0)}" # Debugging: include z else if not val? return "No " + prop return val diff --git a/app/views/play/level/tome/spell.coffee b/app/views/play/level/tome/spell.coffee index 19f2416ee..8918c10fd 100644 --- a/app/views/play/level/tome/spell.coffee +++ b/app/views/play/level/tome/spell.coffee @@ -70,6 +70,7 @@ module.exports = class Spell functionParameters: @parameters yieldConditionally: thang.plan? requiresThis: thang.requiresThis + # TODO: Gridmancer doesn't currently work with protectAPI, so hack it off protectAPI: not (@skipProtectAPI or window.currentView?.level.get('name').match("Gridmancer")) includeFlow: not @skipFlow #callIndex: 0 diff --git a/app/views/play/level/tome/spell_debug_view.coffee b/app/views/play/level/tome/spell_debug_view.coffee index 5174a5cc4..eab097fb0 100644 --- a/app/views/play/level/tome/spell_debug_view.coffee +++ b/app/views/play/level/tome/spell_debug_view.coffee @@ -83,6 +83,40 @@ module.exports = class DebugView extends View if @markerRange @marker = @ace.getSession().addMarker @markerRange, "ace_bracket", "text" + stringifyValue: (value, depth) -> + return value if not value or _.isString value + if _.isFunction value + return if depth is 2 then undefined else "<Function>" + return "<this #{value.id}>" if value is @thang and depth + if depth is 2 + if value.constructor?.className is "Thang" + value = "<#{value.spriteName} - #{value.id}, #{if value.pos then value.pos.toString() else 'non-physical'}>" + else + value = value.toString() + return value + + isArray = _.isArray value + isObject = _.isObject value + return value.toString() unless isArray or isObject + brackets = if isArray then ["[", "]"] else ["{", "}"] + size = _.size value + return brackets.join "" unless size + values = [] + if isArray + for v in value + s = @stringifyValue(v, depth + 1) + values.push "" + s unless s is undefined + else + for key in value.apiProperties ? _.keys value + s = @stringifyValue(value[key], depth + 1) + values.push key + ": " + s unless s is undefined + sep = '\n' + (" " for i in [0 ... depth]).join('') + prefix = value.constructor?.className + prefix ?= "Array" if isArray + prefix ?= "Object" if isObject + prefix = if prefix then prefix + " " else "" + return "#{prefix}#{brackets[0]}#{sep} #{values.join(sep + ' ')}#{sep}#{brackets[1]}" + deserializeVariableChain: (chain) -> keys = [] for prop, i in chain @@ -98,11 +132,7 @@ module.exports = class DebugView extends View value = thang or "<Thang #{value.id} (non-existent)>" else value = theClass.deserializeFromAether(value) - if value and not _.isString value - if value.constructor?.className is "Thang" - value = "<#{value.spriteName} - #{value.id}, #{if value.pos then value.pos.toString() else 'non-physical'}>" - else - value = value.toString() + value = @stringifyValue value, 0 key: keys.join("."), value: value destroy: ->