Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/ProductionQueue.js
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.queue.length === 1 && !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. | |||||
// Unset flag that training is blocked | // Unset flag that training is blocked | ||||
cmpPlayer.UnBlockTraining(); | cmpPlayer.UnBlockTraining(); | ||||
} | } | ||||
else if (item.technologyTemplate) | |||||
if (item.technologyTemplate) | |||||
{ | { | ||||
// Mark the research as started. | // Mark the research as started. | ||||
var cmpTechnologyManager = QueryOwnerInterface(this.entity, IID_TechnologyManager); | var cmpTechnologyManager = QueryOwnerInterface(this.entity, IID_TechnologyManager); | ||||
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 | ||||
if (item.timeRemaining > time) | if (item.timeRemaining >= time) | ||||
{ | { | ||||
item.timeRemaining -= time; | item.timeRemaining -= time; | ||||
if (item.timeRemaining < time) | |||||
Not Done Inline ActionsDon't understand what this is good for. bb: Don't understand what this is good for. | |||||
time = item.timeRemaining; | |||||
// send a message for the AIs. | // send a message for the AIs. | ||||
Engine.PostMessage(this.entity, MT_ProductionQueueChanged, { }); | Engine.PostMessage(this.entity, MT_ProductionQueueChanged, { }); | ||||
break; | break; | ||||
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; | |||||
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; | |||||
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