diff --git a/app/views/editor/level/thangs_tab_view.coffee b/app/views/editor/level/thangs_tab_view.coffee index e2d0d4ac8..f68965bc3 100644 --- a/app/views/editor/level/thangs_tab_view.coffee +++ b/app/views/editor/level/thangs_tab_view.coffee @@ -43,6 +43,7 @@ module.exports = class ThangsTabView extends View 'sprite:mouse-up': 'onSpriteMouseUp' 'sprite:double-clicked': 'onSpriteDoubleClicked' 'surface:stage-mouse-up': 'onStageMouseUp' + 'randomise:terrain-generated': 'onRandomiseTerrain' events: 'click #extant-thangs-filter button': 'onFilterExtantThangs' @@ -223,6 +224,11 @@ module.exports = class ThangsTabView extends View return unless e.thang @editThang thangID: e.thang.id + onRandomiseTerrain: (e) -> + console.log e + for thang in e.thangs + console.log thang.id, thang.pos + # TODO: figure out a good way to have all Surface clicks and Treema clicks just proxy in one direction, so we can maintain only one way of handling selection and deletion onExtantThangSelected: (e) -> @selectedExtantSprite?.setNameLabel? null unless @selectedExtantSprite is e.sprite diff --git a/app/views/modal/terrain_randomise_modal.coffee b/app/views/modal/terrain_randomise_modal.coffee index 6dba35042..0b5f96426 100644 --- a/app/views/modal/terrain_randomise_modal.coffee +++ b/app/views/modal/terrain_randomise_modal.coffee @@ -8,7 +8,7 @@ module.exports = class TerrainRandomiseModal extends ModalView thangs = [] events: - 'click .play-option': 'onRandomise' + 'click .choose-option': 'onRandomise' onRevertModel: (e) -> id = $(e.target).val() @@ -17,6 +17,17 @@ module.exports = class TerrainRandomiseModal extends ModalView @reloadOnClose = true onRandomise: (e) -> + @thangs = [] + @thangs.push { + 'id':'Grass01' + 'pos':{ + 'x':20 + 'y':20 + } + } + Backbone.Mediator.publish('randomise:terrain-generated', + 'thangs': @thangs + ) getRenderData: -> c = super()