usage_priority should be number-based

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Honktown
Smart Inserter
Smart Inserter
Posts: 1046
Joined: Thu Oct 03, 2019 7:10 am
Contact:

usage_priority should be number-based

Post by Honktown »

Using a number-based system, the order of power devices could be made into a two-tiered list/table, and when needing power, the game just goes through the groups available, according to usage_priority, and tries to draw from all members of that priority, pulling from the next group if the first is insufficient.

Note: integers would not be necessary, the important thing is these get translated into a group of same importance. Each group is used after the next, but within each group, power is drawn from available members.

I ran into an issue with a mod, that an accumulator meant for carrying large amounts of power from floor to floor (floors of a "ship", warptorio2) couldn't charge a normal accumulator. The reason is because all power devices can only be among the five groups (primary, secondary, tertiary, solar, and lamp???), and an accumulator can't charge another accumulator.

All base-game entities could be easily translated, that using 0-9 for the first group of "important" things, and 5 could be the default value for anything that currently has "primary". Secondary could be 15, tertiary could be 25. Solar could be 1-4, or set to 0 and a modder can change it if they want something used before solar (say an irregular power source). Modders wouldn't have to change anything to update, as if the entry is a string, it can be turned into the "old" values, and if it's a number or string-that-is-a-number, then the number gets used.

This would solve the issue with the mod I'm using, that if the base accumulators were 25, and the entity which can power them is 20, it would charge the accumulators, and because of how the mod is, the corresponding entity on the engine floor would be 20, compared to the steam engines being 15 (interestingly, I did a quick search and nothing comes up as a primary-output in the base game).

There would be a performance hit if there were too many differently-ranked accumulators (each group would simultaneously be pulling and pushing power down the line) but it's an avoidable scenario: people can use the standard priority/string if it should be identical in behavior to the base entity.

Edit: The output priority and input priority wouldn't have to be the same, but you could get weird behavior otherwise. It would allow accumulators to discharge into a new accumulator, forcing it to be equal power faster, like storage tanks.
I have mods! I guess!
Link
PyroFire
Filter Inserter
Filter Inserter
Posts: 356
Joined: Tue Mar 08, 2016 8:18 am
Contact:

Re: usage_priority should be number-based

Post by PyroFire »

So that i may clarify what is being posted here.

The "issue": Accumulators do not share power.
I do not personally see this as an issue, but hey if there is a way to set up the accumulators so the "normal" accumulators drain into my "special" accumulators, let me know.
Last edited by PyroFire on Fri Oct 11, 2019 3:13 pm, edited 1 time in total.
User avatar
darkfrei
Smart Inserter
Smart Inserter
Posts: 2905
Joined: Thu Nov 20, 2014 11:11 pm
Contact:

Re: usage_priority should be number-based

Post by darkfrei »

Honktown wrote: Wed Oct 09, 2019 10:17 pm Edit: The output priority and input priority wouldn't have to be the same, but you could get weird behavior otherwise. It would allow accumulators to discharge into a new accumulator, forcing it to be equal power faster, like storage tanks.
It's actually very good feature: low input power and low outputpower by accumulators with big energy capacity and very powerful accumulators with small capacity, that can take energy from the first one.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: usage_priority should be number-based

Post by eradicator »

@OP: Not a solution at all. You're fighting symptoms by making them worse. Every mod would use a different set of numbers and incompatibility would spread like the plague.
____________
PyroFire wrote: Fri Oct 11, 2019 2:34 am I do not personally see this as an issue, but hey if there is a way to set up the accumulators so the "normal" accumulators drain into my "special" accumulators, let me know.
Don't know that much about warptorio. If it's a one way transfer you can easily use a different priority, if it's a two way transfer then maybe split it up into two entities? Factorissimo only allows one way transfer for this reason i guess.
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.
PyroFire
Filter Inserter
Filter Inserter
Posts: 356
Joined: Tue Mar 08, 2016 8:18 am
Contact:

Re: usage_priority should be number-based

Post by PyroFire »

eradicator wrote: Fri Oct 11, 2019 11:48 am Don't know that much about warptorio. If it's a one way transfer you can easily use a different priority, if it's a two way transfer then maybe split it up into two entities? Factorissimo only allows one way transfer for this reason i guess.
There's power being split between 4 surfaces and 16 accumulators in total.

For regular accumulators to function appropriately, they need to act as overflow to these 16 accumulators.
When one of the special ones gets full, it should "push/supply" power to the network like a generator, charging those overflow accumulators.
When the special accumulators are anything less then full, it should be receiving power like an accumulator (but being charged first, before the overflow accumulators)
If there is no power supply, the regular accumulators should empty first (and supply the special accumulators in the process, keeping them full)
I don't think factorio can do this currently.

The obvious solution is to put the accumulators in the shared pool of power, but the reason not to is because that math isn't exactly cheap, and you could have accumulators number in the thousands.
The stairs should be sufficient for any amount of power needs until the warp accumulators are unlocked, which are included in the shared power.
They're different from regular accumulators by being crazy expensive (but also quite powerful).
Post Reply

Return to “Modding interface requests”