Solar Productivity

by RedRafe

Increase the efficiency of Solar panels and Accumulators by progressing through technology!

Content
4 months ago
1.1 - 2.0
29.3K
Power

i [Solved] Only solar productivity

a day ago

Is it possible to add the ability to enable productivity only for solar panels in the settings, without affecting the batteries?

a day ago
(updated a day ago)

Very unlikely.

Not because it cannot be done, it could be added. But if the goal is just increasing solar panel efficiency there's already this value https://lua-api.factorio.com/latest/classes/LuaSurface.html#solar_power_multiplier that could be changed at runtime.
So it would be a simple mod that with max 5 lines of code would do everything you're asking, instead of all this hacks I do in this mod to increase both panels+accumulators performance since there's no API for accumulators :) & would be a lot more UPS efficient.

In conclusion, I will not add that feature to this mod because it could be done differently in another mod which scope is smaller (limited to panels) and a lot better for game performance :)

a day ago

Thanks for answer... I'll try to figure this out myself with chatgpt. (I've never make any mods, maybe it's time)

a day ago
(updated a day ago)

I mean code is pretty simple, but it's a nice first mod if you want to try. It should look like something like this: two files

-- data.lua
data:extend({
    {
        type = "technology",
        name = "solar-panel-productivity",
        icons = util.technology_icon_constant_productivity("__base__/graphics/technology/solar-energy.png"),
        localised_description = "Solar panel productivity",
        effects = {
            {
                type = "nothing",
                effect_description = "Increase solar productivity by +10%",
            },
        },
        prerequisites = { "solar-energy", "space-science-pack" },
        unit = {
            count_formula = "2500*L",
            ingredients = {
                { "automation-science-pack", 1 },
                { "logistic-science-pack", 1 },
                { "chemical-science-pack", 1 },
                { "production-science-pack", 1 },
                { "utility-science-pack", 1 },
                { "space-science-pack", 1 },
            },
            time = 60,
        },
    },
})

-- control.lua
script.on_init(function()
    storage.solar_power_multiplier = 1
end)

script.on_event(defines.events.on_surface_created, function(event)
    game.surfaces[event.surface_index].solar_power_multiplier = storage.solar_power_multiplier
end)

script.on_event(defines.events.on_research_finished, function(event)
    if event.research.name ~= "solar-panel-productivity" then
        return
    end
    storage.solar_power_multiplier = storage.solar_power_multiplier + 0.1

    for _, surface in pairs(game.surfaces) do
        surface.solar_power_multiplier = storage.solar_power_multiplier
    end
end)

beware it will not be compatible with Space Exploration (it has custom multipliers per-surface). But if you want to improve on that it will be a nice journey ;)

a day ago
(updated a day ago)

While I was struggling with chatgpt, it turns out you've already done everything for me, thank you very much. I feel bad asking you this, but could you tweak the code a little? So that this technology would add 20% bonus per research level and have a total of 20 levels of research (for a total of +400% bonus with all research). And so that the first 5 levels could be unlocked with red and green science packs, the next 5 with a blue science pack, and the remaining 10 with a space pack. And so that the cost of research starts at 1000 packs and increases by 1000 for each level. And one more question: will it be compatible with modded solar panels? For example, those added by the Krastorio mod?

New response