mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-05-02 17:03:42 -04:00
Add hero placeholder to terrain generator on hero levels.
This commit is contained in:
parent
b7d9e7a095
commit
9094c0ce19
2 changed files with 34 additions and 2 deletions
app/views/editor/level
|
@ -3,6 +3,10 @@ template = require 'templates/editor/level/modal/terrain_randomize'
|
||||||
CocoModel = require 'models/CocoModel'
|
CocoModel = require 'models/CocoModel'
|
||||||
|
|
||||||
clusters = {
|
clusters = {
|
||||||
|
'hero': {
|
||||||
|
'thangs': ['Hero Placeholder']
|
||||||
|
'margin': 1
|
||||||
|
}
|
||||||
'rocks': {
|
'rocks': {
|
||||||
'thangs': ['Rock 1', 'Rock 2', 'Rock 3', 'Rock 4', 'Rock 5', 'Rock Cluster 1', 'Rock Cluster 2', 'Rock Cluster 3']
|
'thangs': ['Rock 1', 'Rock 2', 'Rock 3', 'Rock 4', 'Rock 5', 'Rock Cluster 1', 'Rock Cluster 2', 'Rock Cluster 3']
|
||||||
'margin': 1
|
'margin': 1
|
||||||
|
@ -97,6 +101,14 @@ presets = {
|
||||||
'thickness': [2,2]
|
'thickness': [2,2]
|
||||||
'cluster': 'dungeon_wall'
|
'cluster': 'dungeon_wall'
|
||||||
}
|
}
|
||||||
|
'hero': {
|
||||||
|
'num': [1, 1]
|
||||||
|
'width': 2
|
||||||
|
'height': 2
|
||||||
|
'clusters': {
|
||||||
|
'hero': [1, 1]
|
||||||
|
}
|
||||||
|
}
|
||||||
'Barrels': {
|
'Barrels': {
|
||||||
'num': [1,1]
|
'num': [1,1]
|
||||||
'width': [8, 12]
|
'width': [8, 12]
|
||||||
|
@ -130,6 +142,14 @@ presets = {
|
||||||
'thickness': [2,2]
|
'thickness': [2,2]
|
||||||
'cluster': 'indoor_wall'
|
'cluster': 'indoor_wall'
|
||||||
}
|
}
|
||||||
|
'hero': {
|
||||||
|
'num': [1, 1]
|
||||||
|
'width': 2
|
||||||
|
'height': 2
|
||||||
|
'clusters': {
|
||||||
|
'hero': [1, 1]
|
||||||
|
}
|
||||||
|
}
|
||||||
'furniture': {
|
'furniture': {
|
||||||
'num':[1,2]
|
'num':[1,2]
|
||||||
'width': 15
|
'width': 15
|
||||||
|
@ -148,6 +168,14 @@ presets = {
|
||||||
'borderThickness':3
|
'borderThickness':3
|
||||||
'floors':'grass_floor'
|
'floors':'grass_floor'
|
||||||
'decorations': {
|
'decorations': {
|
||||||
|
'hero': {
|
||||||
|
'num': [1, 1]
|
||||||
|
'width': 2
|
||||||
|
'height': 2
|
||||||
|
'clusters': {
|
||||||
|
'hero': [1, 1]
|
||||||
|
}
|
||||||
|
}
|
||||||
'house': {
|
'house': {
|
||||||
'num':[1,2] #min-max
|
'num':[1,2] #min-max
|
||||||
'width': 15
|
'width': 15
|
||||||
|
|
|
@ -259,7 +259,7 @@ module.exports = class ThangsTabView extends CocoView
|
||||||
# We alt-clicked, so create a clone addThang
|
# We alt-clicked, so create a clone addThang
|
||||||
@selectAddThangType e.thang.spriteName, @selectedExtantThang
|
@selectAddThangType e.thang.spriteName, @selectedExtantThang
|
||||||
else if @justAdded()
|
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
|
null
|
||||||
else if e.thang and not (@addThangSprite and @addThangType.get('name') in overlappableThangTypeNames)
|
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
|
# 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) ->
|
addThang: (thangType, pos, batchInsert=false) ->
|
||||||
@$el.find('#randomize-button').hide()
|
@$el.find('#randomize-button').hide()
|
||||||
if batchInsert
|
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
|
else
|
||||||
thangID = Thang.nextID(thangType.get('name'), @world) until thangID and not @thangsTreema.get "id=#{thangID}"
|
thangID = Thang.nextID(thangType.get('name'), @world) until thangID and not @thangsTreema.get "id=#{thangID}"
|
||||||
if @cloneSourceThang
|
if @cloneSourceThang
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue