mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Adds default scripts whenever a new level is created
This commit is contained in:
parent
1e52f237b7
commit
76c784b1de
2 changed files with 28 additions and 0 deletions
25
app/lib/DefaultScripts.coffee
Normal file
25
app/lib/DefaultScripts.coffee
Normal file
|
@ -0,0 +1,25 @@
|
|||
module.exports = [
|
||||
{
|
||||
channel: "god:new-world-created"
|
||||
noteChain: []
|
||||
id: "Introduction"
|
||||
}
|
||||
{
|
||||
channel: "world:won"
|
||||
noteChain: []
|
||||
id: "Victory Playback"
|
||||
scriptPrereqs: ["Introduction"]
|
||||
}
|
||||
{
|
||||
channel: "level-set-playing"
|
||||
noteChain: []
|
||||
scriptPrereqs: ["Victory Playback"]
|
||||
id: "Victory Playback Started"
|
||||
}
|
||||
{
|
||||
channel: "surface:frame-changed"
|
||||
noteChain: []
|
||||
scriptPrereqs: ["Victory Playback Started"]
|
||||
id: "Show Victory"
|
||||
}
|
||||
]
|
|
@ -3,6 +3,7 @@ template = require 'templates/editor/level/scripts_tab'
|
|||
Level = require 'models/Level'
|
||||
Surface = require 'lib/surface/Surface'
|
||||
nodes = require './../treema_nodes'
|
||||
defaultScripts = require 'lib/DefaultScripts'
|
||||
|
||||
module.exports = class ScriptsTabView extends CocoView
|
||||
id: 'editor-level-scripts-tab-view'
|
||||
|
@ -22,6 +23,8 @@ module.exports = class ScriptsTabView extends CocoView
|
|||
@level = e.level
|
||||
@dimensions = @level.dimensions()
|
||||
scripts = $.extend(true, [], @level.get('scripts') ? [])
|
||||
if scripts.length is 0
|
||||
scripts = $.extend(true, [], defaultScripts)
|
||||
treemaOptions =
|
||||
schema: Level.schema.properties.scripts
|
||||
data: scripts
|
||||
|
|
Loading…
Reference in a new issue