Ticket #3769: patch_commands_js.diff

File patch_commands_js.diff, 1.3 KB (added by fatherbushido, 8 years ago)
  • binaries/data/mods/public/simulation/helpers/Commands.js

     
    953953    }
    954954   
    955955    var cmpTechnologyManager = QueryPlayerIDInterface(player, IID_TechnologyManager);
    956    
    957956    if (!cmpTechnologyManager.CanProduce(cmd.template))
    958957    {
    959958        if (g_DebugCommands)
     
    969968        Engine.DestroyEntity(ent);
    970969    }
    971970   
    972     // We need the cost after tech modifications
     971    // We need the cost after tech and aura modifications
    973972    // To calculate this with an entity requires ownership, so use the template instead
    974973    var cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
    975974    var template = cmpTemplateManager.GetTemplate(foundationTemplate);
    976975    var costs = {};
     976   
    977977    for (var r in template.Cost.Resources)
    978978    {
    979         costs[r] = +template.Cost.Resources[r];
    980         if (cmpTechnologyManager)
    981             costs[r] = cmpTechnologyManager.ApplyModificationsTemplate("Cost/Resources/"+r, costs[r], template);
     979        costs[r] = ApplyValueModificationsToTemplate("Cost/Resources/"+r, +template.Cost.Resources[r], cmpPlayer.GetPlayerID(), template);
    982980    }
    983981   
    984982    if (!cmpPlayer.TrySubtractResources(costs))