Ticket #3769: aurapatch.5.diff
File aurapatch.5.diff, 3.1 KB (added by , 8 years ago) |
---|
-
binaries/data/mods/public/simulation/components/AuraManager.js
170 170 if (!template || !template.Identity) 171 171 return value; 172 172 var classes = GetIdentityClasses(template.Identity); 173 174 173 var usedKeys = new Set(); 175 174 var add = 0; 176 175 var multiply = 1; 177 for (let c in cache)176 for (let className of cache.keys()) 178 177 { 179 if (!MatchesClassList(classes, c ))178 if (!MatchesClassList(classes, className)) 180 179 continue; 181 182 for (let key in cache.get(c))180 181 for (let key of cache.get(className).keys()) 183 182 { 184 183 // don't add an aura with the same key twice 185 184 if (usedKeys.has(key)) 186 185 continue; 187 188 add += cache.get(c).get(key).add; 189 multiply *= cache.get(c).get(key).multiply; 186 add += cache.get(className).get(key).add; 187 multiply *= cache.get(className).get(key).multiply; 190 188 usedKeys.add(key); 191 189 } 192 190 } -
binaries/data/mods/public/simulation/components/Foundation.js
28 28 29 29 // Remember our cost here, so if it changes after construction begins (from technologies) 30 30 // we will use the correct values to refund partial construction costs 31 var cmpCost = Engine.QueryInterface(this.entity, IID_Cost); 32 this.costs = cmpCost.GetResourceCosts(); 31 let cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager); 32 let templateFull = cmpTemplateManager.GetTemplate(template); 33 this.costs = {}; 34 for (let r in templateFull.Cost.Resources) 35 this.costs[r] = ApplyValueModificationsToTemplate("Cost/Resources/"+r, +templateFull.Cost.Resources[r], owner, templateFull); 33 36 this.maxProgress = 0; 34 37 35 38 this.initialised = true; -
binaries/data/mods/public/simulation/helpers/Commands.js
969 969 Engine.DestroyEntity(ent); 970 970 } 971 971 972 // We need the cost after tech modifications972 // We need the cost after tech and aura modifications 973 973 // To calculate this with an entity requires ownership, so use the template instead 974 var cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);975 var template = cmpTemplateManager.GetTemplate(foundationTemplate);976 974 var costs = {}; 977 975 for (var r in template.Cost.Resources) 978 { 979 costs[r] = +template.Cost.Resources[r]; 980 if (cmpTechnologyManager) 981 costs[r] = cmpTechnologyManager.ApplyModificationsTemplate("Cost/Resources/"+r, costs[r], template); 982 } 976 costs[r] = ApplyValueModificationsToTemplate("Cost/Resources/"+r, +template.Cost.Resources[r], player, template); 983 977 984 978 if (!cmpPlayer.TrySubtractResources(costs)) 985 979 {