usage_priority should be number-based
Posted: Wed Oct 09, 2019 10:17 pm
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.
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.