Ticket #2706: returncost.diff
File returncost.diff, 1.3 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/simulation/components/Upgrade.js
Upgrade.prototype.Init = function() 74 74 75 75 // On owner change, abort the upgrade 76 76 // This will also deal with the "OnDestroy" case. 77 77 Upgrade.prototype.OnOwnershipChanged = function(msg) 78 78 { 79 this.CancelUpgrade(); 80 79 this.CancelUpgrade(msg.from); 81 80 if (msg.to !== -1) 82 81 this.owner = msg.to; 83 82 }; 84 83 85 84 Upgrade.prototype.ChangeUpgradedEntityCount = function(amount) … … Upgrade.prototype.Upgrade = function(tem 240 239 this.UpgradeProgress(); 241 240 242 241 return true; 243 242 }; 244 243 245 Upgrade.prototype.CancelUpgrade = function( )244 Upgrade.prototype.CancelUpgrade = function(owner) 246 245 { 247 246 if (!this.IsUpgrading()) 248 247 return; 249 248 250 let cmpPlayer = Query OwnerInterface(this.entity, IID_Player);249 let cmpPlayer = QueryPlayerIDInterface(owner, IID_Player); 251 250 if (cmpPlayer) 252 { 253 let costs = this.GetResourceCosts(this.upgrading); 254 cmpPlayer.AddResources(costs); 255 } 251 cmpPlayer.AddResources(this.GetResourceCosts(this.upgrading)); 256 252 257 253 this.ChangeUpgradedEntityCount(-1); 258 254 259 255 this.upgrading = false; 260 256 this.CancelTimer();