Name: Upgrade Planner
Description: Adds a new item and recipe (unlocked with Automated Construction technology) - "Upgrade Planner" - that allows to replace entities on the map using construction robots.
LIcense: Public Domain
Release: 2015-08-12
Category: Helper
Tags: automated construction
Long description
It looks like deconstruction planner (except it is yellow instead of red) and works in similar way: you can mark an area and entities in this area will be upgraded (or downgraded) to different entities, according to your configuration.
Recipes set in Assembling Machines are preserved while upgrading.
Since version 1.0.1 multiple rulesets may be stored and restored, so you can easily switch between them. More info below.
Since version 1.1.3 you can use Upgrade Planner for selective deconstruction. Set an item you want to be deconstructed in the left column of setup and click with deconstruction planner in your hand on a button in the right column. Items marked this way will be removed and not replaced with anything.
Note: Mod should work properly in multiplayer now, but there is one minor quirk: if more than one player has an upgrade planner in their hand (or one player has an upgrade planner and another one has a deconstruction planner), the planner will do nothing. Sorry for the inconvenience, but it is impossible to resolve it in different way currently. I don't have means to test this mod in multiplayer right now, if you do and you find any bugs, please report them
Mod has been inspired by this post on reddit.
Before using upgrade planner, you must configure it using button displayed in top-left corner on the screen (button will appear once you discover Automated Construction technology). Configuration is explained below.
Recipes set in Assembling Machines are preserved while upgrading.
Since version 1.0.1 multiple rulesets may be stored and restored, so you can easily switch between them. More info below.
Since version 1.1.3 you can use Upgrade Planner for selective deconstruction. Set an item you want to be deconstructed in the left column of setup and click with deconstruction planner in your hand on a button in the right column. Items marked this way will be removed and not replaced with anything.
Note: Mod should work properly in multiplayer now, but there is one minor quirk: if more than one player has an upgrade planner in their hand (or one player has an upgrade planner and another one has a deconstruction planner), the planner will do nothing. Sorry for the inconvenience, but it is impossible to resolve it in different way currently. I don't have means to test this mod in multiplayer right now, if you do and you find any bugs, please report them
Mod has been inspired by this post on reddit.
Before using upgrade planner, you must configure it using button displayed in top-left corner on the screen (button will appear once you discover Automated Construction technology). Configuration is explained below.
Demo - mod in action
In game configuration
GUI design is a blatant copy of BluePrint Mirror mod by Choumiko
To setup a rule in this GUI simply click on the button with item of your choice in your hand. If something is wrong (for example you tried to upgrade item that is not upgradable), a message explaining details of the problem will appear on top of the window.
You can set any upgrade rule (like Assembling Machine 1 to Assembling Machine 3, even Assembling Machine 3 to Assembling Machine 2 if you want to downgrade), the only condition is that both entites must be the same type (you can't upgrade Assembling Machine to Smart Inserter).
If you put a Deconstruction Planner in the right column instead of an item, robots will deconstruct selected item without replacing it with anything. This way you can use Upgrade Planner to selectively deconstruct items.
Note: Some mods may provide items of same type with different size (like bigger or smaller Assembling Machines, for example). I don't recommend using automated replacing with these items, results may be unpredictable.
If you made some changes and you want to discard them, simply click on button in top-left corner again. Window will disappear and all changes will be reverted.
Since version 1.0.1 multiple (up to 12) rulesets may be stored in the storage. To store ruleset simply type its name into text field (names must be unique - if you try to store two rulesets with the same name, an error message will be displayed on top of the frame) and click "store" button: ruleset will be added to the list. You can restore it any time you want by clicking "restore" button next to its name on the list. Of course, you may remove any ruleset as well.
Note: After restoring a ruleset from the storage, you have to click "save changes" button.
If you need more than 12 rulesets in the storage, you can modify control.lua file of this mod. Maximum number of available rulesets is stored in MAX_STORAGE_SIZE variable at the beginning of this file. Just remember that if you add too many rulesets to the storage, table may not fit on your screen!
GUI design is a blatant copy of BluePrint Mirror mod by Choumiko
To setup a rule in this GUI simply click on the button with item of your choice in your hand. If something is wrong (for example you tried to upgrade item that is not upgradable), a message explaining details of the problem will appear on top of the window.
You can set any upgrade rule (like Assembling Machine 1 to Assembling Machine 3, even Assembling Machine 3 to Assembling Machine 2 if you want to downgrade), the only condition is that both entites must be the same type (you can't upgrade Assembling Machine to Smart Inserter).
If you put a Deconstruction Planner in the right column instead of an item, robots will deconstruct selected item without replacing it with anything. This way you can use Upgrade Planner to selectively deconstruct items.
Note: Some mods may provide items of same type with different size (like bigger or smaller Assembling Machines, for example). I don't recommend using automated replacing with these items, results may be unpredictable.
If you made some changes and you want to discard them, simply click on button in top-left corner again. Window will disappear and all changes will be reverted.
Since version 1.0.1 multiple (up to 12) rulesets may be stored in the storage. To store ruleset simply type its name into text field (names must be unique - if you try to store two rulesets with the same name, an error message will be displayed on top of the frame) and click "store" button: ruleset will be added to the list. You can restore it any time you want by clicking "restore" button next to its name on the list. Of course, you may remove any ruleset as well.
Note: After restoring a ruleset from the storage, you have to click "save changes" button.
If you need more than 12 rulesets in the storage, you can modify control.lua file of this mod. Maximum number of available rulesets is stored in MAX_STORAGE_SIZE variable at the beginning of this file. Just remember that if you add too many rulesets to the storage, table may not fit on your screen!
Changelog
v1.1.9
- Removed leftover debug message
- Fixed potential conflicts with other mods that add some kind of custom deconstruction planner.
- Updated to work with Factorio v0.12.20
- fixed a bug related to reading name of invalid cursor stack
- fixed a bug that would cause a GUI button to not appear
- fixed a bug that prevented some items to be selected for upgrade
- renamed the mod for consistency
- added new feature - selective deconstruction
- fixed a bug related to clicking with an empty hand on a button in ruleset
- fixed a bug related to loading a game saved before enabling this mod
- fixed a bug related to underground transport belts
- updated to work with Factorio 0.12.x
- fixed a bug that caused configuration GUI not to appear until game was saved
- fixed a major bug that would make impossible to select certain items for upgrade
- added storage which allows player to store and restore rulesets for convenient switching between them
- removed predefined rulesets - now players can configure their own rulesets as they wish
- removed interface for other mods, as it is not longer necessary
- major code cleanup - added comments, reorganized everything
- fixed (hopefully) multiplayer problems
- fixed a bug related to saving and reloading the game while configuration panel was open
- got rid of has_recipe and has_subtype flags, now these properties are checked automatically
- added remove_rule method to the interface
- updated description and homepage in info.json
- made the GUI easier to use
- added rules for replacing stone furnaces with steel furnaces and basic inserters with fast inserters
- added GUI to configure upgrading rules in game
- added migration script, recipe for Upgrade Planner will be unlocked automatically if mod has been enabled after researching Automatic Construction technology
- exposed interface for other mods that allows adding new upgrade rules
- renamed variables for consistency with base LUA code of the game
- added code for detection whether transport belt to ground is input or output
- added recipe preserving while upgrading assembling machines
- first release
Special thanks to
- FlammablePants on reddit for an inspiration for this mod
- Choumiko, DaveMcW, Kevin94, Klonan, Rseding91 in Modding Help subforum for answering my silly questions
- kovarex for quick fix of this bug
- Gamma_Rad on reddit for suggesting a GUI used in mod configuration
- Once again Choumiko for creating this interface, which I shamelessly imitated in my mod
- Once again DaveMcW for suggesting a great simplification to the code
- dee- for suggesting a storage for rulesets, which was added in v1.0.1 of the mod