Mekanism Additions

Mekanism Additions

21M Downloads

Config Option For Energy Storage In A Machine

FeedCat02 opened this issue ยท 5 comments

commented

A way to change the amount of energy a machine can hold in a config option (maybe similar to the usage config). This would be useful since if you increase the usage of the machines the factories are then unable to process all the items without energy upgrades due them not having enough energy storage

commented

Hey, I would like to look into this as my first PR on this project, will try to write it this week.

Though, I would appreciate a little bit of guidance from you, maintainers :)
Should the storage values be explicitly listed in a class like
public class StorageConfig extends BaseConfig { .. }
(similar to UsageConfig), or should the baseEnergy = 400 * getUsage() remain something like a default value, while you may / may not list some options in the config?

If you say which is preferrable, I will gladly try to implement it.

commented

I would suggest using some value from the base value and the max speed upgrade multiplier

commented

Not looking right now but if the UsageConfig is its own class, then I think StorageConfig should be its own class as well (that is how they format themselves into the subsections in the config file). In terms of defaults, I think whatever the current default/way to calculate defaults is fine. Just keep in mind you will need to do some sort of handling for what to do if a machine has more energy stored than the value is. (Probably can look at how the energy cube handles that)

commented

@pupnewfster if I may ask, what should end up in mekanism.cfg in the end?

It can be either:

a) explicit value (based on what is currently the default (eg. 400*usage)

storage {
    # Base energy storage (Joules).
    D:EnrichmentChamberStorage=20000.0
...}
usage {
    # Energy per operation tick (Joules).
    D:EnrichmentChamberUsage=50.0
...}

b) reserve some value

storage {
    # Base energy storage (Joules), to determine storage based on machine usage, use "-1.0".
    D:EnrichmentChamberStorage=-1.0
...}
usage {
    # Energy per operation tick (Joules).
    D:EnrichmentChamberUsage=50.0
...}

( b2) Or I could create a special type of option, something like NullableDoubleOption, where you could say either null (which would mean use default), or a Double which would mean use that amount. )

c) some other way?

commented

Just go with (a), We'll make it use max(usage, storage) in code after it loads