Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/ProductionQueue.js
Show First 20 Lines • Show All 337 Lines • ▼ Show 20 Lines | else if (type == "technology") | ||||
tech.pair && | tech.pair && | ||||
(tech.top == templateName || tech.bottom == templateName)))) | (tech.top == templateName || tech.bottom == templateName)))) | ||||
{ | { | ||||
error("This entity cannot research " + templateName); | error("This entity cannot research " + templateName); | ||||
return; | return; | ||||
} | } | ||||
let techCostMultiplier = this.GetTechCostMultiplier(); | let techCostMultiplier = this.GetTechCostMultiplier(); | ||||
let time = techCostMultiplier.time * template.researchTime * cmpPlayer.GetCheatTimeMultiplier(); | let time = techCostMultiplier.time * template.researchTime; | ||||
let cost = {}; | let cost = {}; | ||||
for (let res in template.cost) | for (let res in template.cost) | ||||
cost[res] = Math.floor((techCostMultiplier[res] || 1) * template.cost[res]); | cost[res] = Math.floor((techCostMultiplier[res] || 1) * template.cost[res]); | ||||
// TrySubtractResources should report error to player (they ran out of resources) | // TrySubtractResources should report error to player (they ran out of resources) | ||||
if (!cmpPlayer.TrySubtractResources(cost)) | if (!cmpPlayer.TrySubtractResources(cost)) | ||||
return; | return; | ||||
▲ Show 20 Lines • Show All 152 Lines • ▼ Show 20 Lines | |||||
*/ | */ | ||||
ProductionQueue.prototype.GetBatchTime = function(batchSize) | ProductionQueue.prototype.GetBatchTime = function(batchSize) | ||||
{ | { | ||||
var cmpPlayer = QueryOwnerInterface(this.entity); | var cmpPlayer = QueryOwnerInterface(this.entity); | ||||
var batchTimeModifier = ApplyValueModificationsToEntity("ProductionQueue/BatchTimeModifier", +this.template.BatchTimeModifier, this.entity); | var batchTimeModifier = ApplyValueModificationsToEntity("ProductionQueue/BatchTimeModifier", +this.template.BatchTimeModifier, this.entity); | ||||
// TODO: work out what equation we should use here. | // TODO: work out what equation we should use here. | ||||
return Math.pow(batchSize, batchTimeModifier) * cmpPlayer.GetCheatTimeMultiplier(); | return Math.pow(batchSize, batchTimeModifier); | ||||
}; | }; | ||||
ProductionQueue.prototype.OnOwnershipChanged = function(msg) | ProductionQueue.prototype.OnOwnershipChanged = function(msg) | ||||
{ | { | ||||
if (msg.from != -1) | if (msg.from != -1) | ||||
{ | { | ||||
// Unset flag that previous owner's training may be blocked | // Unset flag that previous owner's training may be blocked | ||||
var cmpPlayer = QueryPlayerIDInterface(msg.from); | var cmpPlayer = QueryPlayerIDInterface(msg.from); | ||||
▲ Show 20 Lines • Show All 324 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator