mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2024-11-28 18:15:52 -05:00
commit
3b84917353
10 changed files with 35 additions and 18 deletions
|
@ -19,3 +19,9 @@ Whether you're novice or pro, the CodeCombat team is ready to help you implement
|
|||
### [License](https://github.com/codecombat/codecombat/blob/master/LICENSE)
|
||||
|
||||
[MIT](https://github.com/codecombat/codecombat/blob/master/LICENSE) for the code, and [CC-BY](http://codecombat.com/legal) for the art and music. Please also [sign the CodeCombat contributor license agreement](http://codecombat.com/cla) so we can accept your pull requests. It is easy.
|
||||
|
||||
----------
|
||||
|
||||
[![](https://dl.dropboxusercontent.com/u/138899/GitHub%20Wikis/challengepost.png)](http://codecombat.challengepost.com/?utm_source-github&utm_medium-oswidget&utm_campaign-codecombat)
|
||||
|
||||
[![](http://1-ps.googleusercontent.com/x/s.google-melange.appspot.com/www.google-melange.com/soc/content/2-1-20140225/images/gsoc/logo/920x156xbanner-gsoc2014.png.pagespeed.ic.gdr4t3Igca.png)](http://www.google-melange.com/gsoc/homepage/google/gsoc2014)
|
|
@ -102,6 +102,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
|
|||
unless script
|
||||
console.warn "Couldn't find script for", scriptID, "from scripts", @scripts, "when restoring session scripts."
|
||||
continue
|
||||
continue if script.repeats # repeating scripts are not 'rerun'
|
||||
@triggered.push(scriptID)
|
||||
@ended.push(scriptID)
|
||||
noteChain = @processScript(script)
|
||||
|
@ -131,6 +132,7 @@ module.exports = ScriptManager = class ScriptManager extends CocoClass
|
|||
alreadyTriggered = script.id in @triggered
|
||||
continue unless script.channel is channel
|
||||
continue if alreadyTriggered and not script.repeats
|
||||
continue if script.lastTriggered? and script.repeats is 'session'
|
||||
continue if script.lastTriggered? and new Date().getTime() - script.lastTriggered < 1
|
||||
continue if script.neverRun
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ block content
|
|||
if !me.get('anonymous')
|
||||
//a(href="http://www.youtube.com/watch?v=IFvfZiJGDsw&list=HL1392928835&feature=mh_lolz").intro-button.btn.btn-primary.btn-lg Watch the Video
|
||||
|
||||
a(href="/play/level/ladder-tutorial").intro-button.btn.btn-primary.btn-lg Play the Tutorial
|
||||
a(href="/play/level/brawlwood-tutorial").intro-button.btn.btn-primary.btn-lg Play the Tutorial
|
||||
|
||||
hr
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ module.exports = class ThangTypeHomeView extends View
|
|||
'click button.new-model-submit': 'makeNewModel'
|
||||
'submit form': 'makeNewModel'
|
||||
'shown.bs.modal #new-model-modal': 'focusOnName'
|
||||
'hidden.bs.modal #new-model-modal': 'onModalHidden'
|
||||
|
||||
getRenderData: ->
|
||||
c = super()
|
||||
|
@ -85,16 +86,21 @@ module.exports = class ThangTypeHomeView extends View
|
|||
res = model.save()
|
||||
return unless res
|
||||
|
||||
modal = @$el.find('.modal')
|
||||
modal = @$el.find('#new-model-modal')
|
||||
forms.clearFormAlerts(modal)
|
||||
@showLoading(modal.find('.modal-body'))
|
||||
res.error =>
|
||||
@hideLoading()
|
||||
forms.applyErrorsToForm(modal, JSON.parse(res.responseText))
|
||||
that = @
|
||||
res.success ->
|
||||
modal.modal('hide')
|
||||
base = document.location.pathname[1..] + '/'
|
||||
app.router.navigate(base + (model.get('slug') or model.id), {trigger:true})
|
||||
that.model = model
|
||||
modal.modal('hide')
|
||||
|
||||
onModalHidden: ->
|
||||
# Can only redirect after the modal hidden event has triggered
|
||||
base = document.location.pathname[1..] + '/'
|
||||
app.router.navigate(base + (@model.get('slug') or @model.id), {trigger:true})
|
||||
|
||||
focusOnName: ->
|
||||
@$el.find('#name').focus()
|
||||
|
|
|
@ -54,8 +54,8 @@ module.exports = class ControlBarView extends View
|
|||
c.ladderGame = @ladderGame
|
||||
c.homeLink = "/"
|
||||
levelID = @level.get('slug')
|
||||
if levelID in ["project-dota", "brawlwood", "ladder-tutorial"]
|
||||
levelID = 'project-dota' if levelID is 'ladder-tutorial'
|
||||
if levelID in ["brawlwood", "brawlwood-tutorial"]
|
||||
levelID = 'brawlwood' if levelID is 'brawlwood-tutorial'
|
||||
c.homeLink = "/play/ladder/" + levelID
|
||||
c
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ module.exports = class CastButtonView extends View
|
|||
# TODO: use a User setting instead of localStorage
|
||||
delay = localStorage.getItem 'autocastDelay'
|
||||
delay ?= 5000
|
||||
if @levelID in ['project-dota', 'brawlwood', 'ladder-tutorial']
|
||||
if @levelID in ['brawlwood', 'brawlwood-tutorial']
|
||||
delay = 90019001
|
||||
@setAutocastDelay delay
|
||||
|
||||
|
|
|
@ -44,15 +44,16 @@ module.exports = class SpellPaletteView extends View
|
|||
allDocs = {}
|
||||
for lc in lcs
|
||||
for doc in (lc.get('propertyDocumentation') ? [])
|
||||
allDocs[doc.name] ?= []
|
||||
allDocs[doc.name].push doc
|
||||
allDocs['__' + doc.name] ?= []
|
||||
allDocs['__' + doc.name].push doc
|
||||
if doc.type is 'snippet' then doc.owner = 'snippets'
|
||||
#allDocs[doc.name] = doc for doc in (lc.get('propertyDocumentation') ? []) for lc in lcs
|
||||
|
||||
propStorage =
|
||||
'this': 'programmableProperties'
|
||||
more: 'moreProgrammableProperties'
|
||||
Math: 'programmableMathProperties'
|
||||
Array: 'programmableArrayProperties'
|
||||
String: 'programmableStringProperties'
|
||||
Vector: 'programmableVectorProperties'
|
||||
snippets: 'programmableSnippets'
|
||||
count = 0
|
||||
|
@ -66,10 +67,10 @@ module.exports = class SpellPaletteView extends View
|
|||
@entries = []
|
||||
for owner, props of propGroups
|
||||
for prop in props
|
||||
doc = _.find (allDocs[prop] ? []), (doc) ->
|
||||
doc = _.find (allDocs['__' + prop] ? []), (doc) ->
|
||||
return true if doc.owner is owner
|
||||
return (owner is 'this' or owner is 'more') and (not doc.owner? or doc.owner is 'this')
|
||||
console.log 'could not find doc for', prop, 'from', allDocs[prop], 'for', owner, 'of', propGroups unless doc
|
||||
console.log 'could not find doc for', prop, 'from', allDocs['__' + prop], 'for', owner, 'of', propGroups unless doc
|
||||
doc ?= prop
|
||||
@entries.push @addEntry(doc, shortenize, tabbify, owner is 'snippets')
|
||||
groupForEntry = (entry) ->
|
||||
|
|
|
@ -129,7 +129,7 @@ module.exports = class TomeView extends View
|
|||
@thangSpells[thang.id].push spellKey
|
||||
unless method.cloneOf
|
||||
skipProtectAPI = true #@getQueryVariable("skip_protect_api") is "true"
|
||||
skipFlow = @getQueryVariable("skip_flow") is "true" or @options.levelID is 'project-dota'
|
||||
skipFlow = @getQueryVariable("skip_flow") is "true" or @options.levelID is 'brawlwood'
|
||||
spell = @spells[spellKey] = new Spell programmableMethod: method, spellKey: spellKey, pathComponents: pathPrefixComponents.concat(pathComponents), session: @options.session, supermodel: @supermodel, skipFlow: skipFlow, skipProtectAPI: skipProtectAPI, worker: @worker
|
||||
for thangID, spellKeys of @thangSpells
|
||||
thang = world.getThangByID thangID
|
||||
|
@ -151,7 +151,7 @@ module.exports = class TomeView extends View
|
|||
@cast()
|
||||
|
||||
cast: ->
|
||||
if @options.levelID is 'project-dota'
|
||||
if @options.levelID is 'brawlwood'
|
||||
# For performance reasons, only includeFlow on the currently Thang.
|
||||
for spellKey, spell of @spells
|
||||
for thangID, spellThang of spell.thangs
|
||||
|
|
|
@ -145,7 +145,7 @@ ScriptSchema = c.object {
|
|||
id: c.shortString(title: "ID", description: "A unique ID that other scripts can rely on in their Happens After prereqs, for sequencing.") # uniqueness?
|
||||
channel: c.shortString(title: "Event", format: 'event-channel', description: 'Event channel this script might trigger for, like "world:won".')
|
||||
eventPrereqs: c.array {title: "Event Checks", description: "Logical checks on the event for this script to trigger.", format:'event-prereqs'}, EventPrereqSchema
|
||||
repeats: {title: "Repeats", description: "Whether this script can trigger more than once during a level.", type: 'boolean', "default": false}
|
||||
repeats: {title: "Repeats", description: "Whether this script can trigger more than once during a level.", enum: [true, false, 'session'], "default": false}
|
||||
scriptPrereqs: c.array {title: "Happens After", description: "Scripts that need to fire first."},
|
||||
c.shortString(title: "ID", description: "A unique ID of a script.")
|
||||
notAfter: c.array {title: "Not After", description: "Do not run this script if any of these scripts have run."},
|
||||
|
|
|
@ -181,7 +181,8 @@ findNearestBetterSessionID = (sessionTotalScore, opponentSessionTotalScore, oppo
|
|||
$gt:opponentSessionTotalScore + 0.5
|
||||
_id:
|
||||
$ne: opponentSessionID
|
||||
levelID: "project-dota"
|
||||
"level.original": "52d97ecd32362bc86e004e87"
|
||||
"level.majorVersion": 0
|
||||
submitted: true
|
||||
submittedCode:
|
||||
$exists: true
|
||||
|
@ -280,7 +281,8 @@ updateSessionToSubmit = (sessionToUpdate, callback) ->
|
|||
fetchInitialSessionsToRankAgainst = (opposingTeam, callback) ->
|
||||
console.log "Fetching sessions to rank against for opposing team #{opposingTeam}"
|
||||
findParameters =
|
||||
levelID: "project-dota"
|
||||
"level.original": "52d97ecd32362bc86e004e87"
|
||||
"level.majorVersion": 0
|
||||
submitted: true
|
||||
submittedCode:
|
||||
$exists: true
|
||||
|
|
Loading…
Reference in a new issue