Oh, that's fantastic. I was looking at the prospects of simply adding it to the config, although I was under the impression that it was treated as commodity instead of something which slotted in with the cloaking batteries. That being said..
I'm slightly concerned about the limits still. I don't think the configuration listed above should be implemented, and here's why.
Note the configuration. You specify an item to check for, and if it exists, you feed it an entry from weapon_equip.
The one listed above is mine01_mark01_ammo
Lets take a look at that part. There's more to it, but to show the relevant bits..
Note ammo_limit being 1000. That's why you were given 1000 ammo when autobuy kicked in.
I don't like that value being a flat 1000. I think it should be scaled depending on what equipment you're using, and how much space your vessel has. It's not a very 'smart' approach when the system makes decisions on what you should, and should not have, given only a flat value. If you're aiming for convenience, tailor the system a little more to give just the right amount. Even if you have to do that using a custom supplied flat-value for each cloak, fine. Using some vague mine entry with a value of 1000 doesn't really have any correlation to how much fuel each jumpdrive should have. (I'm not saying it's a bad ballpark value mind you!)
Scaling it can be done in two ways.
A) A mathematical formula which is run whenever it checks if you need jump batteries which would use: Your ship max limit, your jumpdrive type, the amount of batteries currently available
or
B) A new addition to the plugin/ini file where you can set flat values. (Something like: item = dsy_hspace_jump_drive_1, 1200 (Being kept under a different ini tag so it doesn't automatically get an ItemID for the supplied value))
Either of these options would be a more proper approach.
While you're at it, just make an option to enable it. (/autobuy jump on)
Note: I'm already 85% done with implementation of the above. I'd wait a day. Or a few hours. You'll get a Github pull request in a bit. I'd say just get the plugin updated if you want this. It's a new category. Let it be added as such.
Which do you folks think is more appropriate?
- Being able to simply define a number in the configuration, and add the autobuy section?
- Trusting a mathematical formula to decide how much is appropriate, or if it should attempt to buy them at all if numbers aren't within correct bounds.
Honestly, the flat value isn't that bad of an idea. It'd be easier to do as well. The problem with the config file right now though, is that it runs all of the ammolimit values through a function which creates the internal ID reference which may or may not match another object loaded in through 'weapon_equip' or 'misc_equip'. (Which is great for actual ammo values! Jumpdrives are a special case, along with cloaks.)