Name: Macromanaged Turrets
Description: Create turrets that request ammo from the logistic network.
Version: v1.1.5
Release: 2017-4-1
Tested-With-Factorio-Version: 0.14.22
Website: https://mods.factorio.com/mods/Subach/M ... ed_Turrets
Long description
This mod can turn any turret into a logistic turret that requests ammo from the logistic network. This mod adds no turrets of its own; it is intended to be used as a supplement to the base game or other mods.
Using this mod
To use this mod, it is recommended that you extract the .zip file into your mod folder, instead of leaving it packaged. This will allow you to edit the configuration file, config.lua.
For this mod to be of any use, a turret must be added the the logistic turret table in the configuration file. Instructions for doing so are found within that file.
Adding a turret to the logistic turret table in config.lua enables the mod for that turret type. Those turrets will then behave just like requester chests, with the limitation that they can only request ammo.
The logistic turret remote
You can change the request slots of turrets in-game by using the logistic turret remote.
The remote is an item that is crafted with one electronic circuit. The recipe is unlocked when you have finished researching the logistic system. To use the remote, click-and-drag its selection box over your turrets, the way you would use a blueprint. This will open a GUI that allows you to edit your logistic turrets' settings.
Circuit network integration
Turrets can also be connected to circuit networks. Each turret has a small selection box near its center that indicates where its circuit connector is. Red and green wires attach to this interface.
Unlike most other entities, an extra step is required to connect a turret to a circuit network. Use the logistic turret remote to open a turret's GUI, click on the Circuit Network icon, and change its mode of operation from "None" to either "Read Contents" or "Set Requests". Then, click on one or both wire icons so the turret knows which wires to connect to.
Using this mod
To use this mod, it is recommended that you extract the .zip file into your mod folder, instead of leaving it packaged. This will allow you to edit the configuration file, config.lua.
For this mod to be of any use, a turret must be added the the logistic turret table in the configuration file. Instructions for doing so are found within that file.
Adding a turret to the logistic turret table in config.lua enables the mod for that turret type. Those turrets will then behave just like requester chests, with the limitation that they can only request ammo.
The logistic turret remote
You can change the request slots of turrets in-game by using the logistic turret remote.
The remote is an item that is crafted with one electronic circuit. The recipe is unlocked when you have finished researching the logistic system. To use the remote, click-and-drag its selection box over your turrets, the way you would use a blueprint. This will open a GUI that allows you to edit your logistic turrets' settings.
Circuit network integration
Turrets can also be connected to circuit networks. Each turret has a small selection box near its center that indicates where its circuit connector is. Red and green wires attach to this interface.
Unlike most other entities, an extra step is required to connect a turret to a circuit network. Use the logistic turret remote to open a turret's GUI, click on the Circuit Network icon, and change its mode of operation from "None" to either "Read Contents" or "Set Requests". Then, click on one or both wire icons so the turret knows which wires to connect to.
Mod compatibility
Bob's Warfare
This mod automatically turns the turrets in Bob's Warfare into logistic turrets, with no configuration necessary. By editing the configuration file, you can:
Autofill profiles are automatically created for logistic turrets, using the ammo specified in their table entry.
For mod authors
This mod has a remote interface that you can use to configure turrets via remote.call. Documentation on the remote interface can be found here.
This mod automatically turns the turrets in Bob's Warfare into logistic turrets, with no configuration necessary. By editing the configuration file, you can:
- Change the default settings for all of Bob's turrets
- Override the default setting for specific turrets
- Disable the default settings and turn them back into normal turrets
Autofill profiles are automatically created for logistic turrets, using the ammo specified in their table entry.
For mod authors
This mod has a remote interface that you can use to configure turrets via remote.call. Documentation on the remote interface can be found here.
Uninstallation
If you no longer wish to use this mod, do simply disable it in the mod list. Doing so would probably delete a lot of ammo from your world. To properly remove this mod, follow these instructions:
- Extract the .zip file if you have not yet done so
- Open config.lua
- Scroll down to the section titled Uninstallation
- Change MMT.UninstallMod to true
- Save and close config.lua
- Load and re-save your world
Known limitations
- Turrets only store half the ammo they are requesting in their own inventory. The other half is stored in an invisible inventory that is accessed as needed. This means the selection GUI (when hovering your mouse over a turret) will show an inaccurate ammo count.
- Circuit network wires are only saved in blueprints if the turret has undergone a "wire update" after the wire was attached. A wire update occurs whenever a turret is selected with the logistic turret remote, and all turrets are updated whenever a world is loaded. The circuit connector light will turn green after the turret has been updated (assuming you have circuit connector sprites enabled). When Factorio v0.15 is released, it will be possible to update turrets simply by hovering your mouse over them, making the process nearly invisible.
- It is possible to create a blueprint containing a "logistic turret requester module" without an associated turret. This won't hurt anything, and will essentially be an empty space in the blueprint.
- When placing a blueprint containing a logistic turret, an alert for missing construction materials will be shown for the requester module.
Version history
- v1.1.5 (2017-4-1):
Autofill integration improvements:
Autofill profiles are only generated for turrets that don't already have one. Existing profiles are no longer overwritten.
When generating a profile, the mod will attempt to match the turret to an existing item set. Only named item sets are considered.
This mod is now aware of any custom item sets if that set is already being used by at least one other object (custom item sets are created through Autofill's "setItemArray" remote call).
If a suitable item set cannot be found, then the turret will be autofilled with any ammo it is capable of using. Priority goes to whatever ammo you happen to have the most of in your inventory.
A turret's default request (or lack of one) no longer has any bearing on what it can be autofilled with. - v1.1.4 (2017-3-19):
Features:
Turrets' requests and circuit network wires can now be saved in blueprints.
Turrets now remember what they were requesting when they die and a ghost is created.
Wires between ghost turrets are now properly shown.
Added the "TimeFactor" setting to the config file.
Added an "UninstallMod" setting to the config file.
Bug fixes:
Fixed a bug that caused turrets to lose their logistic and circuit network functionality.
Fixed a bug that caused construction robots to think turrets were damaged when they were not.
Fixed a potential crash when mining the circuit network interface.
Fixed the desyncs, again, for real this time.
The clipboard is no longer cleared when loading a world in singleplayer.
Scripting:
Added "get_default_configuration" to the remote interface.
Added "get_request_slot" to the remote interface.
Added "get_circuit_mode" to the remote interface.
Added "get_custom_label" to the remote interface.
Added "change_custom_label" to the remote interface.
Added "mod_info" to the remote interface.
Renamed "reload_config" to "reset_mod". - v1.1.3 (2016-11-26):
Bug fix:
Hotfix for a crash when changing the config file. - v1.1.2 (2016-11-23):
Bug fix:
Fixed accumulators neither charging nor discharging when a logistic turret was part of their electric network. - v1.1.1 (2016-11-4):
Bug fixes:
Fixed the configure_logistic_turret remote call. This function now only takes two arguments. The second argument follows the same format as config file entries.
Deleting a surface that had ghost turrets will no longer cause a crash when loading that world.
Turrets will now regain their custom labels when rebuilt from a ghost. - v1.1.0 (2016-10-27):
Updated for Factorio v0.14
This changelong is too large to reasonably post here. Please see this pastebin for the full changelog. - v1.0.4 (2016-05-22):
Fixed multiplayer desync issue
Added TimerInterval setting to the config file - v1.0.3 (2016-05-13):
Fixed the turret GUI display for Factorio v0.12.33
GUIs now close when their turret is destroyed, mined, or marked for deconstruction
GUIs no longer persist through a save and reload
Fixed a method by which a turret could be set to request 0 items
Cleaned up the codebase
Minimum required Factorio version is now v0.12.33 - v1.0.2 (2016-05-08):
Idle turrets are checked less often
Smoothed the distribution of checks to prevent noticeable lag spikes - v1.0.1 (2016-04-30):
Fixed bots sometimes delivering the wrong item after using the remote
Fixed a crash when clicking Save - v1.0.0 (2016-04-29):
Initial release