Added some more world rand shortcut functions. Fixed a bug with toggling collision in level editor. Updated CommunityView contributor class i18n linking.

This commit is contained in:
Nick Winter 2014-12-21 21:37:59 -08:00
parent e7c626656e
commit e153a7ecce
3 changed files with 20 additions and 2 deletions

View file

@ -31,4 +31,22 @@ class Rand
rand2: (min, max) =>
min + @rand max - min
# return a random float min <= f < max
randf2: (min, max) =>
min + @randf() * (max - min)
# return a random float within range around x
randfRange: (x, range) =>
x + (-0.5 + @randf()) * range
# shuffle array in place, and also return it
shuffle: (arr) =>
for i in [arr.length-1 .. 1]
j = Math.floor @randf() * (i - 1)
t = arr[j]
arr[j] = arr[i]
arr[i] = t
arr
module.exports = Rand

View file

@ -8,7 +8,7 @@ module.exports = class CommunityView extends RootView
afterRender: ->
super()
@$el.find('.contribute-classes a').each ->
characterClass = $(@).attr('href').split('#')[1]
characterClass = $(@).attr('href').split('/')[2]
title = $.i18n.t("classes.#{characterClass}_title")
titleDescription = $.i18n.t("classes.#{characterClass}_title_description")
summary = $.i18n.t("classes.#{characterClass}_summary")

View file

@ -652,7 +652,7 @@ module.exports = class ThangsTabView extends CocoView
thangData = @getThangByID thang.id
thangData = $.extend true, {}, thangData
unless component = _.find thangData.components, {original: componentOriginal}
component = original: componentOriginal, config: {}
component = original: componentOriginal, config: {}, majorVersion: 0
thangData.components.push component
modificationFunction component
@thangsTreema.set @pathForThang(thangData), thangData