Coding Assistance: Solar/Accumulator Efficiency Research

Place to get help with not working mods / modding interface.
Post Reply
Neomore
Inserter
Inserter
Posts: 47
Joined: Sun Jun 21, 2015 5:42 pm
Contact:

Coding Assistance: Solar/Accumulator Efficiency Research

Post by Neomore »

Good afternoon/morning.

I'm currently working on updating an old Solar panel mod of mine, and I'm trying to completely rework the mod to no longer need higher-tier solar panels and accumulators. As an alternative, I'm trying to add a research that acts similar to the mining-productivity research (each time you research it, you'd gain a bonus multiplier to the output of solar panels, and the storage of accumulators).

The issue I'm currently having is that I can't figure out a way to add that effect into the game. Is there some way to add a new effect type to the technology effects table which would allow this to be possible?

Any assistance is appreciated.
Author of Advanced Factorio, a set of mods that add small bits of Advanced functionality to your gameplay

Check it out here: https://mods.factorio.com/user/neomore

User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 490
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: Coding Assistance: Solar/Accumulator Efficiency Research

Post by Silari »

The only thing that techs can modify directly are what's built into the game: https://wiki.factorio.com/Types/ModifierPrototype has the list.

However, as long as you're content with just modifying the output of the solar panel building, you can modify the surface's solar_power_multiplier via a script effect when the research is done. Setting it to 1.1 should make all solar panels on that surface make 66 kW max, for instance.

Accumulator storage is baked into the prototype though on game start, so there's no getting around needing multiple prototypes of that that I know of.

Neomore
Inserter
Inserter
Posts: 47
Joined: Sun Jun 21, 2015 5:42 pm
Contact:

Re: Coding Assistance: Solar/Accumulator Efficiency Research

Post by Neomore »

Silari wrote:
Tue May 25, 2021 12:29 am
The only thing that techs can modify directly are what's built into the game: https://wiki.factorio.com/Types/ModifierPrototype has the list.

However, as long as you're content with just modifying the output of the solar panel building, you can modify the surface's solar_power_multiplier via a script effect when the research is done. Setting it to 1.1 should make all solar panels on that surface make 66 kW max, for instance.

Accumulator storage is baked into the prototype though on game start, so there's no getting around needing multiple prototypes of that that I know of.
I know that Techs can only modify things on that list. What I'm specifically looking for is a way to add a custom value to that list, if possible
Author of Advanced Factorio, a set of mods that add small bits of Advanced functionality to your gameplay

Check it out here: https://mods.factorio.com/user/neomore

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Coding Assistance: Solar/Accumulator Efficiency Research

Post by eradicator »

Silari wrote:
Tue May 25, 2021 12:29 am
/LuaSurface.html#LuaSurface.solar_power_multiplier]solar_power_multiplier[/url] via a script effect when the research is done.
Be aware that this is ofc incompatible with any mod that also manipulates that value. (i.e. Space Exploration)
Neomore wrote:
Tue May 25, 2021 12:43 am
if possible
Not. Possible.

To get what you describe you'd need a script that secretely replaces every accumulator in the world with one that looks the same but behaves differently.

(Also personally not a huge fan of infinite research that magically makes everything better. Doesn't add anything new to the gameplay loop except more waiting.)
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Modding help”