Using playable team config from Alliance system.

This commit is contained in:
Nick Winter 2014-02-06 16:05:41 -08:00
parent cde7a4798f
commit 2a3e47b08f
3 changed files with 6 additions and 18 deletions

View file

@ -37,10 +37,6 @@ module.exports = class God
angel = new Angel @
@angels.push angel
return angel.enslave()
#oldestAngel = {started: new Date(2099, 1, 1)}
#for angel in @angels
# oldestAngel = angel if angel.started < oldestAngel.started
#oldestAngel.abort()
null
angelInfinitelyLooped: (angel) ->
@ -70,13 +66,6 @@ module.exports = class God
else
@worldWaiting = true
return
console.log "about to post message", @getUserCodeMap(), @level, @firstWorld, @goalManager?.getGoals(), JSON.stringify({
worldName: @world.name
userCodeMap: @getUserCodeMap()
level: @level
firstWorld: @firstWorld
goals: @goalManager?.getGoals()
}).length
angel.worker.postMessage {func: 'runWorld', args: {
worldName: @world.name
userCodeMap: @getUserCodeMap()
@ -194,7 +183,7 @@ class Angel
@started = null
clearInterval @purgatoryTimer
@purgatoryTimer = null
@worker.terminate()
@worker?.terminate()
@worker = null
@

View file

@ -32,12 +32,6 @@ module.exports = class World
@rand = new Rand 0
@frames = [new WorldFrame(@, 0)]
# --- This config needs to move into Systems config --- TODO
playableTeams: ["humans"]
teamForPlayer: (n) ->
@playableTeams[n % @playableTeams.length]
# -----------------------------------------------------
getFrame: (frameIndex) ->
# Optimize it a bit--assume we have all if @ended and are at the previous frame otherwise
frames = @frames
@ -464,3 +458,7 @@ module.exports = class World
colorConfigs = {}
colorConfigs[teamName] = config.color for teamName, config of teamConfigs
colorConfigs
teamForPlayer: (n) ->
playableTeams = @playableTeams ? ['humans']
playableTeams[n % playableTeams.length]

View file

@ -301,6 +301,7 @@ module.exports = class HUDView extends View
[newFrame, newAction] = [hist.frame, hist.name]
continue if newAction is lastAction
if newFrame > lastFrame
# TODO: don't push it if it didn't exist until then
(@timespans[lastAction] ?= []).push [lastFrame * dt, newFrame * dt]
[lastFrame, lastAction] = [newFrame, newAction]