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='RequiredTechnology' a:help='Define what technology is required for this upgrade'>" + | "<element name='RequiredTechnology' a:help='Define what technology is required for this upgrade'>" + | ||||
Freagarach: ? | |||||
"<choice>" + | "<choice>" + | ||||
"<text/>" + | "<text/>" + | ||||
"<empty/>" + | "<empty/>" + | ||||
"</choice>" + | "</choice>" + | ||||
"</element>" + | "</element>" + | ||||
"</optional>" + | "</optional>" + | ||||
"<optional>" + | "<optional>" + | ||||
"<element name='CheckPlacementRestrictions' a:help='Upgrading will check for placement restrictions (nb:GUI only)'><empty/></element>" + | "<element name='CheckPlacementRestrictions' a:help='Upgrading will check for placement restrictions (nb:GUI only)'><empty/></element>" + | ||||
▲ Show 20 Lines • Show All 170 Lines • ▼ Show 20 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()) | |||||
Done Inline ActionsCanMoveWhileUpgrading bb: CanMoveWhileUpgrading | |||||
cmpUnitMotion.StopMoving() | |||||
Done Inline Actions^ Freagarach: ^ | |||||
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); | ||||
this.expendedResources = this.GetResourceCosts(template); | this.expendedResources = this.GetResourceCosts(template); | ||||
if (!cmpPlayer.TrySubtractResources(this.expendedResources)) | if (!cmpPlayer.TrySubtractResources(this.expendedResources)) | ||||
{ | { | ||||
this.expendedResources = {}; | this.expendedResources = {}; | ||||
return false; | return false; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 111 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
?