Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/Upgrade.js
Show All 34 Lines | "<element>" + | ||||
"<oneOrMore>" + | "<oneOrMore>" + | ||||
"<choice>" + | "<choice>" + | ||||
Resources.BuildSchema("nonNegativeInteger") + | Resources.BuildSchema("nonNegativeInteger") + | ||||
"</choice>" + | "</choice>" + | ||||
"</oneOrMore>" + | "</oneOrMore>" + | ||||
"</element>" + | "</element>" + | ||||
"</optional>" + | "</optional>" + | ||||
"<optional>" + | "<optional>" + | ||||
"<element name='CanMoveWhileUpgrading' a:help='Whether the entity can keep moving while upgrading'><data type='boolean'/></element>" + | |||||
Freagarach: ? | |||||
"</optional>" + | |||||
"<optional>" + | |||||
"<element name='RequiredTechnology' a:help='Define what technology is required for this upgrade'>" + | "<element name='RequiredTechnology' a:help='Define what technology is required for this upgrade'>" + | ||||
"<choice>" + | "<choice>" + | ||||
"<text/>" + | "<text/>" + | ||||
"<empty/>" + | "<empty/>" + | ||||
"</choice>" + | "</choice>" + | ||||
"</element>" + | "</element>" + | ||||
"</optional>" + | "</optional>" + | ||||
"<optional>" + | "<optional>" + | ||||
▲ Show 20 Lines • Show All 118 Lines • ▼ Show 20 Lines | Upgrade.prototype.IsUpgrading = function() | ||||
return !!this.upgrading; | return !!this.upgrading; | ||||
}; | }; | ||||
Upgrade.prototype.GetUpgradingTo = function() | Upgrade.prototype.GetUpgradingTo = function() | ||||
{ | { | ||||
return this.upgrading; | return this.upgrading; | ||||
}; | }; | ||||
Upgrade.prototype.CanMoveWhileUpgrading = function() | |||||
{ | |||||
return this.template.CanMoveWhileUpgrading == "true"; | |||||
}; | |||||
Upgrade.prototype.WillCheckPlacementRestrictions = function(template) | Upgrade.prototype.WillCheckPlacementRestrictions = function(template) | ||||
{ | { | ||||
if (!this.upgradeTemplates[template]) | if (!this.upgradeTemplates[template]) | ||||
return undefined; | return undefined; | ||||
// is undefined by default so use X in Y | // is undefined by default so use X in Y | ||||
return "CheckPlacementRestrictions" in this.template[this.upgradeTemplates[template]]; | return "CheckPlacementRestrictions" in this.template[this.upgradeTemplates[template]]; | ||||
}; | }; | ||||
Show All 38 Lines | Upgrade.prototype.GetResourceCosts = function(template) | ||||
return costs; | return costs; | ||||
}; | }; | ||||
Upgrade.prototype.Upgrade = function(template) | Upgrade.prototype.Upgrade = function(template) | ||||
{ | { | ||||
if (this.IsUpgrading() || !this.upgradeTemplates[template]) | if (this.IsUpgrading() || !this.upgradeTemplates[template]) | ||||
return false; | return false; | ||||
let cmpUnitMotion = Engine.QueryInterface(this.entity, IID_UnitMotion); | |||||
if (cmpUnitMotion && cmpUnitMotion.IsMoveRequested() && !this.CanMoveWhileUpgrading()) | |||||
Done Inline ActionsCanMoveWhileUpgrading bb: CanMoveWhileUpgrading | |||||
cmpUnitMotion.StopMoving(); | |||||
Done Inline Actions^ Freagarach: ^ | |||||
FreagarachUnsubmitted Not Done Inline ActionsI though we gave full control of cmpUnitMotion to cmpUnitAI (which seems good to me). Freagarach: I though we gave full control of cmpUnitMotion to cmpUnitAI (which seems good to me).
Ergo, no… | |||||
let cmpPlayer = QueryOwnerInterface(this.entity, IID_Player); | let cmpPlayer = QueryOwnerInterface(this.entity, IID_Player); | ||||
if (!cmpPlayer) | if (!cmpPlayer) | ||||
return false; | return false; | ||||
let cmpProductionQueue = Engine.QueryInterface(this.entity, IID_ProductionQueue); | let cmpProductionQueue = Engine.QueryInterface(this.entity, IID_ProductionQueue); | ||||
if (cmpProductionQueue && cmpProductionQueue.HasQueuedProduction()) | if (cmpProductionQueue && cmpProductionQueue.HasQueuedProduction()) | ||||
{ | { | ||||
let cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); | let cmpGUIInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface); | ||||
▲ Show 20 Lines • Show All 125 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
?