diff --git a/app/lib/world/GoalManager.coffee b/app/lib/world/GoalManager.coffee index 850b06859..b017482b8 100644 --- a/app/lib/world/GoalManager.coffee +++ b/app/lib/world/GoalManager.coffee @@ -105,7 +105,6 @@ module.exports = class GoalManager extends CocoClass notifyGoalChanges: -> overallStatus = @checkOverallStatus() event = {goalStates: @goalStates, goals: @goals, overallStatus: overallStatus} - #console.log JSON.stringify(event), "new goal states" Backbone.Mediator.publish('goal-manager:new-goal-states', event) checkOverallStatus: (ignoreIncomplete=false) -> @@ -126,6 +125,10 @@ module.exports = class GoalManager extends CocoClass keyFrame: 0 # when it became a 'success' or 'failure' } @initGoalState(state, [goal.killThangs, goal.saveThangs], 'killed') + for getTo in goal.getAllToLocations ? [] + @initGoalState(state,[ getTo.getToLocation?.who , [] ], 'arrived') + for keepFrom in goal.keepAllFromLocations ? [] + @initGoalState(state,[ [] , keepFrom.keepFromLocation?.who], 'arrived') @initGoalState(state, [goal.getToLocations?.who, goal.keepFromLocations?.who], 'arrived') @initGoalState(state, [goal.leaveOffSides?.who, goal.keepFromLeavingOffSides?.who], 'left') @initGoalState(state, [goal.collectThangs?.who, goal.keepFromCollectingThangs?.who], 'collected') @@ -143,7 +146,13 @@ module.exports = class GoalManager extends CocoClass onThangTouchedGoal: (e, frameNumber) -> for goal in @goals ? [] @checkArrived(goal.id, goal.getToLocations.who, goal.getToLocations.targets, e.actor, e.touched.id, frameNumber) if goal.getToLocations? + if goal.getAllToLocations? + for getTo in goal.getAllToLocations + @checkArrived(goal.id, getTo.getToLocation.who, getTo.getToLocation.targets, e.actor, e.touched.id, frameNumber) @checkArrived(goal.id, goal.keepFromLocations.who, goal.keepFromLocations.targets, e.actor, e.touched.id, frameNumber) if goal.keepFromLocations? + if goal.keepAllFromLocations? + for keepFrom in goal.keepAllFromLocations + @checkArrived(goal.id, keepFrom.keepFromLocation.who , keepFrom.keepFromLocation.targets, e.actor, e.touched.id, frameNumber ) checkArrived: (goalID, who, targets, thang, touchedID, frameNumber) -> return unless touchedID in targets @@ -191,6 +200,7 @@ module.exports = class GoalManager extends CocoClass initGoalState: (state, whos, progressObjectName) -> # 'whos' is an array of goal 'who' values. # This inits the progress object for the goal tracking. + arrays = (prop for prop in whos when prop?.length) return unless arrays.length state[progressObjectName] = {} @@ -240,7 +250,9 @@ module.exports = class GoalManager extends CocoClass killThangs: 1 saveThangs: 0 getToLocations: 1 + getAllToLocations: 1 keepFromLocations: 0 + keepAllFromLocations: 0 leaveOffSides: 1 keepFromLeavingOffSides: 0 collectThangs: 1 diff --git a/app/lib/world/names.coffee b/app/lib/world/names.coffee index 3b1cd0080..385d2f630 100644 --- a/app/lib/world/names.coffee +++ b/app/lib/world/names.coffee @@ -63,6 +63,7 @@ module.exports.thangNames = thangNames = "Annie" "Lukaz" "Gorgin" + "Coco" ] "Peasant": [ "Yorik" @@ -90,6 +91,7 @@ module.exports.thangNames = thangNames = ] "Peasant F": [ "Hilda" + "Icey" ] "Archer F": [ "Phoebe" @@ -115,6 +117,12 @@ module.exports.thangNames = thangNames = "Alden" "Cairn" "Jensen" + "Yilitha" + "Mirana" + "Lina" + "Luna" + "Alleria" + "Vereesa" ] "Archer M": [ "Brian" @@ -127,6 +135,14 @@ module.exports.thangNames = thangNames = "Arty" "Gimsley" "Fidsdale" + "Slyvos" + "Logos" + "Denin" + "Lycan" + "Loco" + "Vican" + "Mars" + "Dev" ] "Ogre Munchkin M": [ "Brack" @@ -148,6 +164,7 @@ module.exports.thangNames = thangNames = "Thabt" "Snortt" "Kog" + "Ursa" ] "Ogre Munchkin F": [ "Iyert" @@ -155,6 +172,9 @@ module.exports.thangNames = thangNames = "Shmeal" "Gurzunn" "Yugark" + "Dosha" + "Inski" + "Lacos" ] "Ogre M": [ "Krogg" @@ -168,6 +188,9 @@ module.exports.thangNames = thangNames = "Vargutt" "Grumus" "Gug" + "Tarlok" + "Gurulax" + "Mokrul" ] "Ogre F": [ "Nareng" @@ -175,6 +198,11 @@ module.exports.thangNames = thangNames = "Glonc" "Marghurk" "Martha" + "Holkam" + "Alkaz" + "Gar'ah" + "Mak'rah" + "Marnag" ] "Ogre Brawler": [ "Grul'thock" @@ -190,6 +218,8 @@ module.exports.thangNames = thangNames = "Grognar" "Ironjaw" "Tuguro" + "York" + "Ork'han" ] "Ogre Fangrider": [ "Dreek" @@ -205,6 +235,7 @@ module.exports.thangNames = thangNames = "Gurzthrot" "Murgark" "Muttin" + "Bortrok" ] "Ogre Shaman": [ "Sham'uk" @@ -224,6 +255,11 @@ module.exports.thangNames = thangNames = "Zo'Goroth" "Mogadishu" "Nazgareth" + "Gror" + "Grek" + "Gom" + "Gogg" + "Ghuk" ] "Ogre Thrower": [ "Kyrgg" diff --git a/app/models/CocoModel.coffee b/app/models/CocoModel.coffee index 3f4c9455c..34e3e641f 100644 --- a/app/models/CocoModel.coffee +++ b/app/models/CocoModel.coffee @@ -151,7 +151,7 @@ class CocoModel extends Backbone.Model return null unless schema.links? linkObject = _.find schema.links, rel: "db" return null unless linkObject - return null if linkObject.href.match("thang_type") and not @isObjectID(data) # Skip loading hardcoded Thang Types for now (TODO) + return null if linkObject.href.match("thang.type") and not @isObjectID(data) # Skip loading hardcoded Thang Types for now (TODO) # not fully extensible, but we can worry about that later link = linkObject.href diff --git a/app/models/Level.coffee b/app/models/Level.coffee index c260a8178..7832c329a 100644 --- a/app/models/Level.coffee +++ b/app/models/Level.coffee @@ -112,7 +112,7 @@ module.exports = class Level extends CocoModel if path.match(/\/systems\/\d+\/config\//) and data?.indieSprites?.length # Ugh, we need to make sure we grab the IndieSprite ThangTypes for indieSprite in data.indieSprites - link = "/db/thang_type/#{indieSprite.thangType}/version" + link = "/db/thang.type/#{indieSprite.thangType}/version" model = CocoModel.getOrMakeModelFromLink link, shouldLoadProjection models.push model if model else if path is '/' diff --git a/app/models/ThangType.coffee b/app/models/ThangType.coffee index b28bea773..037e1f8d9 100644 --- a/app/models/ThangType.coffee +++ b/app/models/ThangType.coffee @@ -218,8 +218,8 @@ module.exports = class ThangType extends CocoModel @loadUniversalWizard: -> return @wizardType if @wizardType wizOriginal = "52a00d55cf1818f2be00000b" - url = "/db/thang_type/#{wizOriginal}/version" + url = "/db/thang.type/#{wizOriginal}/version" @wizardType = new module.exports() @wizardType.url = -> url @wizardType.fetch() - @wizardType \ No newline at end of file + @wizardType diff --git a/app/templates/play/ladder/my_matches_tab.jade b/app/templates/play/ladder/my_matches_tab.jade index 8cacdb49f..b9cf618a2 100644 --- a/app/templates/play/ladder/my_matches_tab.jade +++ b/app/templates/play/ladder/my_matches_tab.jade @@ -52,8 +52,9 @@ div#columns.row if team.isRanking td(colspan=4).alert.alert-info | Your new code is being simulated by other players for ranking. + | This will refresh as new matches come in. else td(colspan=4).alert.alert-warning - | No ranked matches for this team! + | No ranked matches for the #{team.name} team! | Play against some competitors and then come back here to get your game ranked. - + diff --git a/app/views/account/wizard_settings_view.coffee b/app/views/account/wizard_settings_view.coffee index 8497c32cf..78f9cee6a 100644 --- a/app/views/account/wizard_settings_view.coffee +++ b/app/views/account/wizard_settings_view.coffee @@ -22,7 +22,7 @@ module.exports = class WizardSettingsView extends CocoView loadWizard: -> @wizardThangType = new ThangType() - @wizardThangType.url = -> '/db/thang_type/wizard' + @wizardThangType.url = -> '/db/thang.type/wizard' @wizardThangType.fetch() @wizardThangType.once 'sync', @initCanvas, @ @@ -67,7 +67,7 @@ module.exports = class WizardSettingsView extends CocoView updateSwatchVisibility: (colorGroup) -> enabled = colorGroup.find('.color-group-checkbox').prop('checked') colorGroup.find('.minicolors-swatch').toggle Boolean(enabled) - + updateColorSettings: (colorGroup) => wizardSettings = _.cloneDeep(me.get('wizard')) or {} wizardSettings.colorConfig ?= {} @@ -108,4 +108,4 @@ module.exports = class WizardSettingsView extends CocoView @movieClip.regX = reg.x @movieClip.regY = reg.y @stage.addChild @movieClip - @stage.update() \ No newline at end of file + @stage.update() diff --git a/app/views/editor/level/thangs_tab_view.coffee b/app/views/editor/level/thangs_tab_view.coffee index af5ee3c07..e5d2b79f2 100644 --- a/app/views/editor/level/thangs_tab_view.coffee +++ b/app/views/editor/level/thangs_tab_view.coffee @@ -19,7 +19,7 @@ componentOriginals = "physics.Physical" : "524b75ad7fc0f6d519000001" class ThangTypeSearchCollection extends CocoCollection - url: '/db/thang_type/search?project=true' + url: '/db/thang.type/search?project=true' model: ThangType module.exports = class ThangsTabView extends View diff --git a/app/views/play/ladder/my_matches_tab.coffee b/app/views/play/ladder/my_matches_tab.coffee index 278bcb9b0..073b80a0c 100644 --- a/app/views/play/ladder/my_matches_tab.coffee +++ b/app/views/play/ladder/my_matches_tab.coffee @@ -71,7 +71,7 @@ module.exports = class MyMatchesTabView extends CocoView for team in @teams team.session = (s for s in @sessions.models when s.get('team') is team.id)[0] team.readyToRank = @readyToRank(team.session) - team.isRanking = team.session.get('isRanking') + team.isRanking = team.session?.get('isRanking') team.matches = (convertMatch(match, team.session.get('submitDate')) for match in team.session?.get('matches') or []) team.matches.reverse() team.score = (team.session?.get('totalScore') or 10).toFixed(2) diff --git a/app/views/play/level/tome/spell_view.coffee b/app/views/play/level/tome/spell_view.coffee index 8c98db854..dd9875b16 100644 --- a/app/views/play/level/tome/spell_view.coffee +++ b/app/views/play/level/tome/spell_view.coffee @@ -430,6 +430,7 @@ module.exports = class SpellView extends View flow ?= @spellThang?.castAether?.flow return unless flow executed = [] + executedRows = {} matched = false states = flow.states ? [] currentCallIndex = null @@ -445,20 +446,24 @@ module.exports = class SpellView extends View matched = true break _.last(executed).push state + executedRows[state.range[0].row] = true #state.executing = true if state.userInfo?.time is @thang.world.age # no work currentCallIndex ?= callNumber - 1 #console.log "got call index", currentCallIndex, "for time", @thang.world.age, "out of", states.length + @decoratedGutter = @decoratedGutter || {} + # TODO: don't redo the markers if they haven't actually changed for markerRange in (@markerRanges ?= []) markerRange.start.detach() markerRange.end.detach() @aceSession.removeMarker markerRange.id @markerRanges = [] - @aceSession.removeGutterDecoration row, 'executing' for row in [0 ... @aceSession.getLength()] - @aceSession.removeGutterDecoration row, 'executed' for row in [0 ... @aceSession.getLength()] - $(@ace.container).find('.ace_gutter-cell.executing').removeClass('executing') - $(@ace.container).find('.ace_gutter-cell.executed').removeClass('executed') + for row in [0 ... @aceSession.getLength()] + unless executedRows[row] + @aceSession.removeGutterDecoration row, 'executing' + @aceSession.removeGutterDecoration row, 'executed' + @decoratedGutter[row] = '' if not executed.length or (@spell.name is "plan" and @spellThang.castAether.metrics.statementsExecuted < 20) @toolbarView?.toggleFlow false @debugView.setVariableStates {} @@ -486,7 +491,10 @@ module.exports = class SpellView extends View markerRange.end = @aceDoc.createAnchor markerRange.end markerRange.id = @aceSession.addMarker markerRange, clazz, markerType @markerRanges.push markerRange - @aceSession.addGutterDecoration start.row, clazz + if executedRows[start.row] and @decoratedGutter[start.row] isnt clazz + @aceSession.removeGutterDecoration start.row, @decoratedGutter[start.row] if @decoratedGutter[start.row] isnt '' + @aceSession.addGutterDecoration start.row, clazz + @decoratedGutter[start.row] = clazz @debugView.setVariableStates {} unless gotVariableStates null diff --git a/server/levels/level_schema.coffee b/server/levels/level_schema.coffee index 86f774ad0..7fe7fc00b 100644 --- a/server/levels/level_schema.coffee +++ b/server/levels/level_schema.coffee @@ -36,9 +36,19 @@ GoalSchema = c.object {title: "Goal", description: "A goal that the player can a getToLocations: c.object {title: "Get To Locations", description: "Will be set off when any of the \"who\" touch any of the \"targets\" ", required: ["who", "targets"]}, who: c.array {title: "Who", description: "The Thangs who must get to the target locations.", minItems: 1}, thang targets: c.array {title: "Targets", description: "The target locations to which the Thangs must get.", minItems: 1}, thang + getAllToLocations: c.array {title: "Get all to locations", description: "Similar to getToLocations but now a specific \"who\" can have a specific \"target\", also must be used with the HowMany property for desired effect",required: ["getToLocation"]}, + c.object {title: "", description: ""}, + getToLocation: c.object {title: "Get To Locations", description: "TODO: explain", required: ["who", "targets"]}, + who: c.array {title: "Who", description: "The Thangs who must get to the target locations.", minItems: 1}, thang + targets: c.array {title: "Targets", description: "The target locations to which the Thangs must get.", minItems: 1}, thang keepFromLocations: c.object {title: "Keep From Locations", description: "TODO: explain", required: ["who", "targets"]}, who: c.array {title: "Who", description: "The Thangs who must not get to the target locations.", minItems: 1}, thang targets: c.array {title: "Targets", description: "The target locations to which the Thangs must not get.", minItems: 1}, thang + keepAllFromLocations: c.array {title: "Keep ALL From Locations", description: "Similar to keepFromLocations but now a specific \"who\" can have a specific \"target\", also must be used with the HowMany property for desired effect", required: ["keepFromLocation"]}, + c.object {title: "", description: ""}, + keepFromLocation: c.object {title: "Keep From Locations", description: "TODO: explain", required: ["who", "targets"]}, + who: c.array {title: "Who", description: "The Thangs who must not get to the target locations.", minItems: 1}, thang + targets: c.array {title: "Targets", description: "The target locations to which the Thangs must not get.", minItems: 1}, thang leaveOffSides: c.object {title: "Leave Off Sides", description: "Sides of the level to get some Thangs to leave across.", required: ["who", "sides"]}, who: c.array {title: "Who", description: "The Thangs which must leave off the sides of the level.", minItems: 1}, thang sides: c.array {title: "Sides", description: "The sides off which the Thangs must leave.", minItems: 1}, side @@ -164,7 +174,7 @@ LevelThangSchema = c.object { }, id: thang # TODO: figure out if we can make this unique and how to set dynamic defaults # TODO: split thangType into "original" and "majorVersion" like the rest for consistency - thangType: c.objectId(links: [{rel: "db", href: "/db/thang_type/{($)}/version"}], title: "Thang Type", description: "A reference to the original Thang template being configured.", format: 'thang-type') + thangType: c.objectId(links: [{rel: "db", href: "/db/thang.type/{($)}/version"}], title: "Thang Type", description: "A reference to the original Thang template being configured.", format: 'thang-type') components: c.array {title: "Components", description: "Thangs are configured by changing the Components attached to them.", uniqueItems: true, format: 'thang-components-array'}, ThangComponentSchema # TODO: uniqueness should be based on "original", not whole thing LevelSystemSchema = c.object { diff --git a/server/levels/thangs/LevelThangType.coffee b/server/levels/thangs/LevelThangType.coffee index abdf5d11c..98d89c4b3 100644 --- a/server/levels/thangs/LevelThangType.coffee +++ b/server/levels/thangs/LevelThangType.coffee @@ -61,4 +61,4 @@ LevelThangTypeSchema.plugin(plugins.PermissionsPlugin) LevelThangTypeSchema.plugin(plugins.NamedPlugin) LevelThangTypeSchema.plugin(plugins.SearchablePlugin, {searchable: ['name', 'description']}) -module.exports = LevelThangType = mongoose.model('level.thang_type', LevelThangTypeSchema) +module.exports = LevelThangType = mongoose.model('level.thang.type', LevelThangTypeSchema)