An add-on for HeroTurretRedux or HeroTurretsReduxFork.
When you extend a wall, ranked hero turrets get picked up and plain ones go down, so ranked turrets pile up in your logistic chests. This mod adds a shortcut-bar button that puts that stock back on the wall:
- Per logistic network (found by construction area, since walls are usually outside the logistic area), per base turret and per quality, it pairs the highest ranks in storage with the lowest-ranked placed turrets.
- Every pair where the stored turret outranks the placed one is marked for upgrade. Construction robots do the swap, and the replaced turret goes back to storage as an item.
- Nothing is destroyed or created by script. Pressing the button twice is harmless: turrets already marked reserve their item.
- Pairing the best stock with the worst placed turrets means a replaced turret never outranks what is left in stock. The wall ends up with the best turrets and the stock ends up as plain turrets, as far as the numbers allow.
A chat summary shows how many turrets of each type were marked, and how many ranked turrets stay in stock because no lower-ranked placed turret exists in that network.
Requirement: the hero turret mod's Kill counter setting must be Fuzzy (the default). With Exact, mined turrets become items with tags, which robots won't use for upgrades.
There is also a remote interface: remote.call("hero-turret-restock", "restock", "player").