Edit-Blueprints deprecated

by V453000

Editing blueprints while preserving their name and settings.

Content
4 years ago
0.18
153
Blueprints

b Train station names saved in edited blueprint

4 years ago

When editing a blueprint that has train stations in it but no saved names (ie. the checkbox for station names was unchecked when the blueprint was created), the station placed on the editing surface gets a random name assigned to it. When finishing editing, the updated blueprint now has that random name saved into it, so when you build stations using that blueprint they will get the same name.

4 years ago

I'll make sure the settings coming into the editor are the same the go out of the editor, thanks!

4 years ago
(updated 4 years ago)

Holy crap! You're a factorio dev. Thanks!

Did the factorio api get updated for v.18 to add a station-name flag for blueprint creation?
https://forums.factorio.com/viewtopic.php?f=65&t=82459&p=485148#p485148

I have not used this mod, but I've been using https://mods.factorio.com/mod/TheBlueprintLab_bud along with
https://mods.factorio.com/mod/BlueprintExtensions

With Blueprint Extensions, I can edit existing blueprints but due to limitations in the factorio api you can't capture the station name, so I'm forced to re-create every blueprint with train stations that I want to edit.
https://github.com/dewiniaid/BlueprintExtensions/issues/1

How do you get around this limitation? Do you use cut/copy/paste which does capture station names?

4 years ago

The create_blueprint has all of the include options that blueprint creation has through GUI. I've tried to create this mod and this was the first big problem I arrived to. I'm not a C++ programmer so I asked for it and Nexela was kind enough to add it through a pull request to our master branch.

https://lua-api.factorio.com/latest/LuaItemStack.html#LuaItemStack.create_blueprint

So I just do this ... notably I need to add include_fuel, as that was forgotten and added in a later 0.18 version. And of course I need to not juts make them automatically true, but dynamic based on the original properties of the input blueprint.

player.cursor_stack.create_blueprint({
surface = editor_surface_name,
force = 'player',
area = surface_area,
always_include_tiles = true,
include_entities = true,
include_modules = true,
include_trains = true,
include_station_names = true
})

4 years ago

Turns out it's not so easy to code what I imagined I would, so for now I'll just keep the current super basic behaviour which just includes all the things by default. I think I have an idea how to implement this, but the real solution would be more complicated - adding checkboxes for manual control, but automatically try to guess their "correct" state.

4 years ago

I think for the other things there's actually no special handling needed, because when the edited blueprint didn't include let's say trains, then no trains will be placed on the editing surface, so no trains will get saved into the new blueprint after editing. Same goes for entities, modules, tiles and even train fuels. If you want to remove any of those from a blueprint, you can just remove them from the editing surface, and they will no longer be part of the new blueprint.

The only thing that's different are the train stop names, since you can't place a train stop without giving it a name.

An idea how to handle this without creating some new GUI would be if the edited blueprint doesn't contain station names to just give the stations on the editing surface some placeholder name like "<UNNAMED>" or something like that when they are placed (either from the original blueprint, or when the player adds a new station). Then when creating the new blueprint check if the station name has been changed by the user, if so, then include station names in the new blueprint, otherwise don't.

New response