Note: If you are using Factorio 0.12.x, you can find updated version of this mod here.
Mod adds a new item and recipe (unlocked with Automated Construction technology): Upgrade Planner - now fully configurable!
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.
Note 1: 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
Note 2: This mod requires Factorio version 0.11.20 or higher, because of this bug that has been fixed in 0.11.20.
Note 3: Since version 1.0.0 interface for other mods to add new rules has been totally removed. Right now it is not needed at all, since players can setup their own rulesets using GUI.
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).
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.0.3
fixed a bug that caused configuration GUI not to appear until game was saved
v1.0.2
fixed a major bug that would make impossible to select certain items for upgrade
v1.0.1
added storage which allows player to store and restore rulesets for convenient switching between them
v1.0.0
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
v0.1.8
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
v0.1.7
added remove_rule method to the interface
updated description and homepage in info.json
v0.1.6
made the GUI easier to use
added rules for replacing stone furnaces with steel furnaces and basic inserters with fast inserters
v0.1.5
added GUI to configure upgrading rules in game
v0.1.4
added migration script, recipe for Upgrade Planner will be unlocked automatically if mod has been enabled after researching Automatic Construction technology
v0.1.3
exposed interface for other mods that allows adding new upgrade rules
renamed variables for consistency with base LUA code of the game
v0.1.2
added code for detection whether transport belt to ground is input or output
added recipe preserving while upgrading assembling machines
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
Re: [MOD 0.11.20] Upgrade with construction robots
Posted: Fri Apr 10, 2015 5:59 pm
by waduk
Wow,..just wow...i haven't test this, since i'm on a break playing factorio. Based on the premise alone, this is a must have mod !
IMO this is a serious contender for the dev to natively support this feature in vanilla.
And it already happen with other mod (pocket construction bot), kovarex says there's a chance a similar feature will be added someday in the future :
Source : https://forums.factorio.com/forum/vie ... =30#p75937
Re: [MOD 0.11.20] Upgrade with construction robots
Posted: Fri Apr 10, 2015 6:33 pm
by Alvin853
Is it possible for other mods to define their own set of upgrade rules? For example additional types of belts, or different mining drills, whatever people want to mod really... This could take off like a rocket.
Re: [MOD 0.11.20] Upgrade with construction robots
Posted: Fri Apr 10, 2015 6:50 pm
by KrzysD
You just made the most asked for mod ever, Thank you for this! I bet the Factorio team will implement this at one point.
Re: [MOD 0.11.20] Upgrade with construction robots
Posted: Fri Apr 10, 2015 6:52 pm
by kds71
Alvin853 wrote:Is it possible for other mods to define their own set of upgrade rules? For example additional types of belts, or different mining drills, whatever people want to mod really... This could take off like a rocket.
Hm yeah, I think it should be possible. I just have to move list of upgrade definitions to some globally accessible variable, then other mods should be able to add new rows to this table easily. Well, there is still a chance that there is an item that can't be easily upgraded because it requires some special action upon placing (like assembling machines require recipe to be restored), but in most cases it should be fine.
Re: [MOD 0.11.20] Upgrade with construction robots
Posted: Fri Apr 10, 2015 9:52 pm
by Vitduo
What about inserted modules in assemblers to be upgraded?
Re: [MOD 0.11.20] Upgrade with construction robots
Posted: Fri Apr 10, 2015 10:47 pm
by kds71
Vitduo wrote:What about inserted modules in assemblers to be upgraded?
I might be wrong, but I think it is not possible to put a module into assembling machine with robots
Re: [MOD 0.11.20] Upgrade with construction robots
Posted: Sat Apr 11, 2015 1:49 am
by MasterBuilder
This looks like it marks old entities for destruction. Could you make a planner that removes anything in the way?
Or more specifically, two variants:
1: Mark anything in the way of the BP for removal.
2: Mark everything not in the BP for removal.
I didn't know we could mod BPs. Are these even possible and would you be interested in making them?
Re: [MOD 0.11.20] Upgrade with construction robots
Posted: Sat Apr 11, 2015 3:34 am
by darkshadow1809
Awh heck yeh! This is freakin cool. Mind if i throw it in both modpacks ?
Re: [MOD 0.11.20] Upgrade with construction robots
Posted: Sat Apr 11, 2015 9:35 am
by kds71
MasterBuilder wrote:This looks like it marks old entities for destruction. Could you make a planner that removes anything in the way?
Or more specifically, two variants:
1: Mark anything in the way of the BP for removal.
2: Mark everything not in the BP for removal.
I didn't know we could mod BPs. Are these even possible and would you be interested in making them?
My upgrade planner is based on the deconstruction planner, not the blueprint. I don't think it is possible to make a blueprint that removes something, but I will investigate that and let you know if I find something
darkshadow1809 wrote:Awh heck yeh! This is freakin cool. Mind if i throw it in both modpacks ?
I don't mind at all! However, this is an early version and I'm going to fix some stuff and improve it, so maybe it is better idea to wait a bit?
Re: [MOD 0.11.20] Upgrade with construction robots
Posted: Sat Apr 11, 2015 9:44 am
by darkshadow1809
kds71 wrote:
MasterBuilder wrote:This looks like it marks old entities for destruction. Could you make a planner that removes anything in the way?
Or more specifically, two variants:
1: Mark anything in the way of the BP for removal.
2: Mark everything not in the BP for removal.
I didn't know we could mod BPs. Are these even possible and would you be interested in making them?
My upgrade planner is based on the deconstruction planner, not the blueprint. I don't think it is possible to make a blueprint that removes something, but I will investigate that and let you know if I find something
darkshadow1809 wrote:Awh heck yeh! This is freakin cool. Mind if i throw it in both modpacks ?
I don't mind at all! However, this is an early version and I'm going to fix some stuff and improve it, so maybe it is better idea to wait a bit?
No need i update the modpack weekly if urgent daily. What better to throw it in the big public? see what bugs come out and see what ideas might come suggested
Re: [MOD 0.11.20] Upgrade with construction robots
Posted: Sat Apr 11, 2015 1:45 pm
by kds71
As requested, I uploaded new version of mod, which exposes interface that allows other mods to add upgrade rules to ruleset. More info in first post in this topic. Big thanks to DaveMcW for the tip!
Edit: And another update - I realized that if you enable mod and load save game in which you had Automatic Construction researched already, you would not get recipe for Upgrade Planner unlocked. It is now fixed in v0.1.4.
Re: [MOD 0.11.20] Upgrade with construction robots
Posted: Mon Apr 13, 2015 7:06 am
by kds71
Big update! Now mod provides GUI which allows you to configure upgrade rules! You can for example upgrade yellow belts directly to blue ones or exclude some type of item from upgrading. More details in first post in this thread.
Another update: stone furnaces can be now upgraded to steel furnaces and basic inserters to fast inserters.
Re: [MOD 0.11.20] Upgrade with construction robots - v0.1.7
Posted: Mon Apr 13, 2015 1:44 pm
by SHiRKiT
Can players create rules themselves without need to go to the code? Like upgrading modded buildings?
Re: [MOD 0.11.20] Upgrade with construction robots - v0.1.7
Posted: Mon Apr 13, 2015 2:02 pm
by kds71
SHiRKiT wrote:Can players create rules themselves without need to go to the code? Like upgrading modded buildings?
Edit: Meh, I worded that poorly. Let me rephrase what I wrote before:
Currently there are there are three ways to add new upgrade rule to ruleset:
1. Execute this code in console, replacing " my-entity-1" with name of entity you want to upgrade and "my-entity-2" with name of entity you want to be a replacement:
Copy it and paste it below, then modify names to suit your needs (change "basic-inserter" to name of entity you want to upgrade and change "fast-inserter" to name of entity you want to be a replacement).
3. The best method - open control.lua file in mod that adds buildings you want to have in the ruleset and add following code somewhere (replacing "my-entity-1" and "my-entity-2" with proper names as described above):
if remote.interfaces.replacer_interface and remote.interfaces.replacer_interface.add_rule then
remote.call("replacer_interface", "add_rule", "my-entity-1", { "my-entity-2" })
end
4. Additional method - contact author of the mod you want to be included in ruleset and ask him to adjust his mod to be compactible with my mod
I don't plan to implement any method of adding a new rules without modifying the code: IMHO it is way too complicated to be included in game.
Re: [MOD 0.11.20] Upgrade with construction robots - v0.1.7
Posted: Mon Apr 13, 2015 3:06 pm
by Ohz
Wow, amazing mod ! Should be implemented in the game !
Re: [MOD 0.11.20] Upgrade with construction robots - v0.1.7
Posted: Mon Apr 13, 2015 3:30 pm
by DaveMcW
You don't need a recipe flag, just use this function:
function has_recipe(entity)
return (game.entityprototypes[entity] and game.entityprototypes[entity].type == "assembling-machine")
end
You are right, I feel ashamed that I haven't thought about that Now code is much simplier, awesome! I could also got rid of has_subtype flag in similar manner. I already uploaded version 0.1.8 without these useless flags. Thanks a lot!
Version 0.1.8 also has a bugfix - there was a bug which could occur if you saved game while configuration panel was open. Now it should work properly.
Re: [MOD 0.11.20] Upgrade with construction robots - v0.1.7
Posted: Mon Apr 13, 2015 7:28 pm
by kds71
SHiRKiT wrote:Can players create rules themselves without need to go to the code? Like upgrading modded buildings?
Haha, disregard everything I wrote earlier, I realized that it is actually simple to do it that way. Now I updated mod to (hopefully) stable version v1.0.0 and you can setup your own ruleset using in game GUI as you wish. Also new version should work in multiplayer.
Re: [MOD 0.11.20] Upgrade with construction robots - v1.0.0!
Posted: Mon Apr 13, 2015 8:34 pm
by dee-
Gosh! This is wonderful!
Is it possible to have multiple and different upgrade/downgrade plans? Like having different yellow blueprints that each have their own rules. That way you don't have to redefine the rules when you want to change something but just use the other ruleset.