
LazyLib)
MagicLib)
Have you ever wondered why your Devastator Cannon deems it necessary to fire at a single Frigate at max range?
Ever got into an argument with your gunnery officer, because they insisted that they could hit a Broadsword with a Hellbore Cannon?
Then AdvancedGunneryControl is just the mod for you!
AdvancedGunneryControl is a utility mod that allows you to customize how your weapon groups behave on auto-fire mode.
Apply one or more tags per weapon group, configurable via GUI during battle or on the campaign map.
Latest changes: Scrollbar for tags, option to ignore fighter shields, several new tags (special thanks to Seanra for his contributions!)
Quick instructions:
- Unzip the archive in your Starsector/mods folder
- Play the game and press the “J”-Key during combat (recommended) or on the campaign map to open a GUI
- In combat, target an ally (R-Key) beforehand to adjust their modes
- By default, firing modes are automatically saved/loaded between combats
- (optional) edit Starsector/mods/AdvancedGunneryControl/Settings.editme to add/remove tags, customize mod behaviour etc.
- Can be safely added to/updated/removed from ongoing campaigns
Mod integration for content expansion or faction mod authors
If you have any feature requests or bug reports, please let me know! If you do request a feature, please check back occasionally to provide feedback/clarification!
Also, please do let me know if you are using the mod and it works well =)
Happy modding & gaming together!
I’m currently working on a new version and will probably release it in a couple of days.
The main thing I am working on right now is introducing a setting file where you can customize the behaviour.
Mainly, I want the user to be able to customize the cycle-order of the modes (so that e.g. someone who only wants Default and PD Modes can simply remove all other modes from the cycle-order). Additionally, I am working on implementing a more customizable AI behaviour.
To give an example:
Currently, if you set a weapon group to “fighter-only”, the vanilla AI will still pick the target and if that target is not a fighter, the weapon simply won’t fire. I want to provide an option (enableCustomAI) where, if enabled, if the vanilla AI doesn’t choose a fighter as the target, my custom AI will kick in and try to see if there is a targetable fighter in range and target that instead.
More control over ship systems and weapons is always welcomed. I bid you add one more mode: Ignore fighters. I am really tired of some ships with huge built in spinal cannon trying to hit a fighter while in middle of a battlestation siege. I am going to add this to my modlist and try it out. Thanks for sharing
Awesome, glad to hear! An “Ignore Fighters” mode is a great idea and should be easy enough to implement, I will definitely include this in the next version!
If you have any feedback, please let me know!
Is this only for pilots or could it be used for the AI as well? If the latter I would kiss you. If not, still, good job.
Thanks! =)
To be honest, I’m not sure… I think it should be possible, but I’m afraid that the controls for that wouldn’t be super helpful.
I believe that controlling the fire-mode of AI-controlled ships on a per-weapon-group basis wouldn’t be very user-friendly.
What might be possible though is to simply introduce a hotkey that toggles PD-Mode for all weapons with the “PD-Only”*-Tag for a) all allied ships or b) the selected ship (in the TAB-screen in combat).
Alternatively, I could maybe include an option “Automatically set all AI-controlled PD-Only weapons to PD Mode” in the settings file.
But I’ll have to do some testing for that first, so this might take a little bit longer. I’ll definitely let you know when I made progress on this topic!
* If my understanding is correct, PD-Only refers to weapons such as PD-Lasers and Vulcans, whereas the PD-Tag also includes weapons like light machine guns. I believe that setting weapons such as light machine guns to PD-Mode for all allied ships would probably not be desirable^^

If you could please add a blacklist system, so that other mods can throw a .json or .csv in their config folder to make this not apply to specific weapons? It would be really appreciated. 99% of the time this overwriting the weapon behavior is fine. But in a few cases? It really is not. A couple of low hanging fruit examples would be flare launcher weapons in some mods so if you could do this it would be really appreciated.
Hello DesperatePeter, this is a really cool mod you got here! But I got a request for it
If you could please add a blacklist system, so that other mods can throw a .json or .csv in their config folder to make this not apply to specific weapons? It would be really appreciated. 99% of the time this overwriting the weapon behavior is fine. But in a few cases? It really is not. A couple of low hanging fruit examples would be flare launcher weapons in some mods so if you could do this it would be really appreciated.
First of all, thank you! =)
About your suggestion:
That is a very valid point!
The mod should already conserve the weapon behaviour in the “Default”-fireMode.
However, it might very well break weapons such as the flare launcher in other fire modes…
I’m wondering what the best solution to this problem would be.
So far, I can see three solutions:
- A blacklist in the folder of other mods (your suggestion)
- A blacklist in my mod (that I will prefill with anything from popular mods I can think of and other mod creators can add stuff that I missed to via PRs)
- Using Weapon AIHints for this (for instance, there is an AI Hint called “do not aim” that people can add to their weapons)
If possible, I think I would prefer the third option. But I’m not sure if, for instance, “do not aim” covers all weapons that would interact unfavorably with my mod^^
Please let me know what you think^^
So far, I can see three solutions:
- A blacklist in the folder of other mods (your suggestion)
- A blacklist in my mod (that I will prefill with anything from popular mods I can think of and other mod creators can add stuff that I missed to via PRs)
- Using Weapon AIHints for this (for instance, there is an AI Hint called “do not aim” that people can add to their weapons)
My personal favorite solution to problems like this is to combine all three solutions. First, by creating a blacklist that is automatically generated based on tags and other information accessible through the API. Then by adding everything from blacklist files in my own mod and any other mod that wants to add to it (see Global.getSettings().getMergedSpreadsheetDataForMod)
Most notably, that update contains:
1. Implemented NoFighters mode, as requested
More control over ship systems and weapons is always welcomed. I bid you add one more mode: Ignore fighters. I am really tired of some ships with huge built in spinal cannon trying to hit a fighter while in middle of a battlestation siege. I am going to add this to my modlist and try it out. Thanks for sharing
2. Added custom AI that picks suitable targets if the base AI doesn’t
3. Added a settings file, that allows you to choose which fire modes you want to use and to disable 2. if you don’t like it
(4. code cleanup, refactoring, testing, more polish, a more extensive readme)
Overall, the mod should be in a much better state now.
About the blacklist feature:
I will look into that next! Thank you Dark.Revenant and Sundog for the suggestions, that will definitely make this task less daunting!
Is this only for pilots or could it be used for the AI as well? If the latter I would kiss you. If not, still, good job.
I promise I will look into this in the near future too! But first I wanted to polish up the core features of the mod
And as always, thanks everyone for the feedback! I’m always happy about positive and (constructive) negative feedback, feature requests and suggestions!
Version 0.2.1 is out. This version focuses mostly on improvements to the custom AI* (for missile-only and fighter-only only; other modes use exclusively vanilla AI). While in 0.2.0 the custom AI felt pretty janky, turned around erratically and fired shots into the vast nothingness of space a lot, the current AI actually seems pretty competent. Also, you can now define in the settings how trigger-happy the custom AI should be.
I am planning to do a 0.2.2 release in the near future that will focus mainly on polish, code cleanup, further AI improvements etc.
After that I will work on a 0.3.0 release that will aim to include the requested features of a weapon-blacklist and the option to set fire modes for AI ships (in some capacity).
Might I suggest using MagicSettings (from MagicLib) for this task: https://starsector.fandom.com/wiki/MagicLib#MagicSettings
Just a quick question about this.
Do I understand correctly that I would simply call e.g.:
blacklist = MagicSettings.getList("swp", "weaponBlacklist")
and then l could let people know in my readme that they can include a list of weapons they want to blacklist into their settings.json under the tag “weaponBlacklist”?
Also, is there a way to essentially do
blacklist = MagicSettings.getList("*", "weaponBlacklist")
(get from all mods)? Or would I have to include something like a “modsToGetBlacklistFrom”-field in my settings?
Update: Figured the “all mods” part out: Global.getSettings().modManager.enabledModsCopy is a list that also contains the ids.
This looks amazing! Is there any way to save what you set each weapon group to or do you have to reset it each time you go into combat?
Glad you like it! =)
You will like to hear that that is exactly what I’m currently working on xD
If you’d like, you can get the latest pre-release version, that already contains this feature.
However, I still have to fix a couple of bugs (most prominently: If you refit your ship things get weird^^) and do some more testing before releasing it.
But I’d estimate that it will be ready soon (always hard to say with bugs whether finding the issue will take 10 minutes or 10 hours…), maybe tomorrow.
Update: I think I fixed the bug. I released a new pre-release version. I think that version should work fine. But I’ll do some more testing tommorrow.
Anyone who wants to try it out and report back if they see anything funky would be much appreciated!