Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/ProductionQueue.js
Context not available. | |||||
// thing twice. | // thing twice. | ||||
var cmpTechnologyManager = QueryOwnerInterface(this.entity, IID_TechnologyManager); | var cmpTechnologyManager = QueryOwnerInterface(this.entity, IID_TechnologyManager); | ||||
cmpTechnologyManager.QueuedResearch(templateName, this.entity); | cmpTechnologyManager.QueuedResearch(templateName, this.entity); | ||||
if (this.queue.length == 0) | |||||
cmpTechnologyManager.StartedResearch(templateName, false); | |||||
this.queue.push({ | this.queue.push({ | ||||
"id": this.nextID++, | "id": this.nextID++, | ||||
Context not available. | |||||
Engine.PostMessage(this.entity, MT_ProductionQueueChanged, { }); | Engine.PostMessage(this.entity, MT_ProductionQueueChanged, { }); | ||||
// If this is the first item in the queue, start the timer | // If this is the first item in the queue. | ||||
if (!this.timer) | if (!this.timer) | ||||
{ | this.ProgressTimeout(); | ||||
var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); | |||||
this.timer = cmpTimer.SetTimeout(this.entity, IID_ProductionQueue, "ProgressTimeout", g_ProgressInterval, {}); | |||||
} | |||||
} | } | ||||
else | else | ||||
{ | { | ||||
Context not available. | |||||
item.productionStarted = true; | item.productionStarted = true; | ||||
if (item.unitTemplate) | if (item.unitTemplate) | ||||
Engine.PostMessage(this.entity, MT_TrainingStarted, {"entity": this.entity}); | Engine.PostMessage(this.entity, MT_TrainingStarted, {"entity": this.entity}); | ||||
break; | |||||
} | } | ||||
bb: Adding this break is wrong. We could be finishing the batch immediately | |||||
// If we won't finish the batch now, just update its timer | // If we won't finish the batch now, just update its timer | ||||
Not Done Inline ActionsDon't understand what this is good for. bb: Don't understand what this is good for. | |||||
Context not available. | |||||
{ | { | ||||
// All entities spawned, this batch finished | // All entities spawned, this batch finished | ||||
cmpPlayer.UnReservePopulationSlots(item.population * numSpawned); | cmpPlayer.UnReservePopulationSlots(item.population * numSpawned); | ||||
time -= item.timeRemaining; | time = 0; | ||||
this.queue.shift(); | this.queue.shift(); | ||||
// Unset flag that training is blocked | // Unset flag that training is blocked | ||||
cmpPlayer.UnBlockTraining(); | cmpPlayer.UnBlockTraining(); | ||||
Context not available. | |||||
cmpSoundManager.PlaySoundGroup(template.soundComplete, this.entity); | cmpSoundManager.PlaySoundGroup(template.soundComplete, this.entity); | ||||
} | } | ||||
Not Done Inline ActionsThis should stay bb: This should stay | |||||
time -= item.timeRemaining; | time = 0; | ||||
this.queue.shift(); | this.queue.shift(); | ||||
Engine.PostMessage(this.entity, MT_ProductionQueueChanged, { }); | Engine.PostMessage(this.entity, MT_ProductionQueueChanged, { }); | ||||
} | } | ||||
Context not available. | |||||
else | else | ||||
{ | { | ||||
var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); | var cmpTimer = Engine.QueryInterface(SYSTEM_ENTITY, IID_Timer); | ||||
Not Done Inline ActionsThis messes up the animation I reckon bb: This messes up the animation I reckon | |||||
this.timer = cmpTimer.SetTimeout(this.entity, IID_ProductionQueue, "ProgressTimeout", g_ProgressInterval, data); | this.timer = cmpTimer.SetTimeout(this.entity, IID_ProductionQueue, "ProgressTimeout", time, {}); | ||||
} | } | ||||
}; | }; | ||||
Context not available. |
Wildfire Games · Phabricator
Adding this break is wrong. We could be finishing the batch immediately