mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-03-27 21:31:16 -04:00
Random thangs are now created and positioned in the thangs view
This commit is contained in:
parent
74205b31d2
commit
38bed0ee93
1 changed files with 4 additions and 0 deletions
|
@ -228,6 +228,8 @@ module.exports = class ThangsTabView extends View
|
|||
console.log e
|
||||
for thang in e.thangs
|
||||
console.log thang.id, thang.pos
|
||||
@selectAddThangType thang.id
|
||||
@addThang @addThangType, 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) ->
|
||||
|
@ -280,6 +282,7 @@ module.exports = class ThangsTabView extends View
|
|||
@selectAddThang {target: icons[nextSelectedIndex]}
|
||||
|
||||
selectAddThangType: (type, @cloneSourceThang) ->
|
||||
console.log type
|
||||
if _.isString type
|
||||
type = _.find @supermodel.getModels(ThangType), (m) -> m.get('name') is type
|
||||
pos = @addThangSprite?.thang.pos # Maintain old sprite's pos if we have it
|
||||
|
@ -397,6 +400,7 @@ module.exports = class ThangsTabView extends View
|
|||
@editThang thangID: id if id
|
||||
|
||||
addThang: (thangType, pos) ->
|
||||
console.log thangType, pos
|
||||
thangID = Thang.nextID(thangType.get('name'), @world) until thangID and not @thangsTreema.get "id=#{thangID}"
|
||||
if @cloneSourceThang
|
||||
components = _.cloneDeep @thangsTreema.get "id=#{@cloneSourceThang.id}/components"
|
||||
|
|
Loading…
Add table
Reference in a new issue