Add hero placeholder to terrain generator on hero levels.

This commit is contained in:
Nick Winter 2014-09-01 20:22:46 -07:00
parent b7d9e7a095
commit 9094c0ce19
2 changed files with 34 additions and 2 deletions
app/views/editor/level

View file

@ -3,6 +3,10 @@ template = require 'templates/editor/level/modal/terrain_randomize'
CocoModel = require 'models/CocoModel'
clusters = {
'hero': {
'thangs': ['Hero Placeholder']
'margin': 1
}
'rocks': {
'thangs': ['Rock 1', 'Rock 2', 'Rock 3', 'Rock 4', 'Rock 5', 'Rock Cluster 1', 'Rock Cluster 2', 'Rock Cluster 3']
'margin': 1
@ -97,6 +101,14 @@ presets = {
'thickness': [2,2]
'cluster': 'dungeon_wall'
}
'hero': {
'num': [1, 1]
'width': 2
'height': 2
'clusters': {
'hero': [1, 1]
}
}
'Barrels': {
'num': [1,1]
'width': [8, 12]
@ -130,6 +142,14 @@ presets = {
'thickness': [2,2]
'cluster': 'indoor_wall'
}
'hero': {
'num': [1, 1]
'width': 2
'height': 2
'clusters': {
'hero': [1, 1]
}
}
'furniture': {
'num':[1,2]
'width': 15
@ -148,6 +168,14 @@ presets = {
'borderThickness':3
'floors':'grass_floor'
'decorations': {
'hero': {
'num': [1, 1]
'width': 2
'height': 2
'clusters': {
'hero': [1, 1]
}
}
'house': {
'num':[1,2] #min-max
'width': 15

View file

@ -259,7 +259,7 @@ module.exports = class ThangsTabView extends CocoView
# We alt-clicked, so create a clone addThang
@selectAddThangType e.thang.spriteName, @selectedExtantThang
else if @justAdded()
console.log 'Skipping double insert due to extra selection event, since we just added', (new Date() - @lastAddTime), 'ms ago.'
# Skip double insert due to extra selection event
null
else if e.thang and not (@addThangSprite and @addThangType.get('name') in overlappableThangTypeNames)
# We clicked on a Thang (or its Treema), so select the Thang
@ -426,7 +426,11 @@ module.exports = class ThangsTabView extends CocoView
addThang: (thangType, pos, batchInsert=false) ->
@$el.find('#randomize-button').hide()
if batchInsert
thangID = "Random #{thangType.get('name')} #{@thangsBatch.length}"
if thangType.get('name') is 'Hero Placeholder'
thangID = 'Hero Placeholder'
return if @level.get('type') isnt 'hero' or @thangsTreema.get "id=#{thangID}"
else
thangID = "Random #{thangType.get('name')} #{@thangsBatch.length}"
else
thangID = Thang.nextID(thangType.get('name'), @world) until thangID and not @thangsTreema.get "id=#{thangID}"
if @cloneSourceThang