Range radii - renamed few variales for clarity
This commit is contained in:
parent
8f5e8efce0
commit
ee76e41c78
2 changed files with 11 additions and 10 deletions
app/lib/surface
|
@ -423,14 +423,15 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
||||||
for property in allProps
|
for property in allProps
|
||||||
if m = property.match ".*Range$"
|
if m = property.match ".*Range$"
|
||||||
if @thang[m[0]]? and @thang[m[0]] < 9001
|
if @thang[m[0]]? and @thang[m[0]] < 9001
|
||||||
@ranges.push [m[0], @thang[m[0]]]
|
@ranges.push
|
||||||
|
name: m[0]
|
||||||
|
radius: @thang[m[0]]
|
||||||
|
|
||||||
@ranges = @ranges.sort((a, b) ->
|
@ranges = @ranges.sort((range1, range2) ->
|
||||||
return a[1] < b[1]
|
return range1.radius < range2.radius
|
||||||
)
|
)
|
||||||
|
|
||||||
for range in @ranges
|
@addMark range.name for range in @ranges
|
||||||
@addMark range[0]
|
|
||||||
|
|
||||||
@addMark('bounds').toggle true if @thang?.drawsBounds
|
@addMark('bounds').toggle true if @thang?.drawsBounds
|
||||||
@addMark('shadow').toggle true unless @thangType.get('shadow') is 0
|
@addMark('shadow').toggle true unless @thangType.get('shadow') is 0
|
||||||
|
@ -441,9 +442,9 @@ module.exports = CocoSprite = class CocoSprite extends CocoClass
|
||||||
@marks.repair?.toggle @thang?.errorsOut
|
@marks.repair?.toggle @thang?.errorsOut
|
||||||
|
|
||||||
if @selected
|
if @selected
|
||||||
@marks[range[0]].toggle true for range in @ranges
|
@marks[range['name']].toggle true for range in @ranges
|
||||||
else
|
else
|
||||||
@marks[range[0]].toggle false for range in @ranges
|
@marks[range['name']].toggle false for range in @ranges
|
||||||
|
|
||||||
mark.update() for name, mark of @marks
|
mark.update() for name, mark of @marks
|
||||||
#@thang.effectNames = ['berserk', 'confuse', 'control', 'curse', 'fear', 'poison', 'paralyze', 'regen', 'sleep', 'slow', 'haste']
|
#@thang.effectNames = ['berserk', 'confuse', 'control', 'curse', 'fear', 'poison', 'paralyze', 'regen', 'sleep', 'slow', 'haste']
|
||||||
|
|
|
@ -131,8 +131,8 @@ module.exports = class Mark extends CocoClass
|
||||||
]
|
]
|
||||||
|
|
||||||
# Find the index of this range, to find the next-smallest radius
|
# Find the index of this range, to find the next-smallest radius
|
||||||
rangeNames = @sprite.ranges.map((value, index) ->
|
rangeNames = @sprite.ranges.map((range, index) ->
|
||||||
value[0]
|
range['name']
|
||||||
)
|
)
|
||||||
i = rangeNames.indexOf(range)
|
i = rangeNames.indexOf(range)
|
||||||
|
|
||||||
|
@ -148,7 +148,7 @@ module.exports = class Mark extends CocoClass
|
||||||
|
|
||||||
# Cut out the hollow part if necessary
|
# Cut out the hollow part if necessary
|
||||||
if i+1 < @sprite.ranges.length
|
if i+1 < @sprite.ranges.length
|
||||||
@mark.graphics.arc 0, 0, @sprite.ranges[i+1][1], Math.PI*2, 0, true
|
@mark.graphics.arc 0, 0, @sprite.ranges[i+1]['radius'], Math.PI*2, 0, true
|
||||||
|
|
||||||
# Add perspective
|
# Add perspective
|
||||||
@mark.scaleY *= @camera.y2x
|
@mark.scaleY *= @camera.y2x
|
||||||
|
|
Reference in a new issue