Update Entities/Items?

Place to post guides, observations, things related to modding that are not mods themselves.
Post Reply
User avatar
Templarfreak
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Oct 05, 2017 2:21 pm
Contact:

Update Entities/Items?

Post by Templarfreak » Tue Dec 19, 2017 8:22 pm

So, sometimes when Factorio updates and changes or removes entities or items, the game will automatically update those changed/removed things in your save for you. Is there a way to do this for a mod? Preferably without having to have a huge block of code? Maybe there's just an, "updateentities(x=a, y=b, z=c)" kind of thing?

(Also, is it possible to remove recipes that have already been unlocked that I don't want used anymore in case I may want to add them back in later?)

Bilka
Factorio Staff
Factorio Staff
Posts: 1861
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: Update Entities/Items?

Post by Bilka » Tue Dec 19, 2017 8:28 pm

I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
Templarfreak
Burner Inserter
Burner Inserter
Posts: 12
Joined: Thu Oct 05, 2017 2:21 pm
Contact:

Re: Update Entities/Items?

Post by Templarfreak » Tue Dec 19, 2017 8:43 pm

Thanks, but those examples are not totally clear,

Code: Select all

{
  "entity":
  [
    ["wall", "stone-wall"]
  ],
  "item":
  [
    ["wall", "stone-wall"]
  ]
}
Do I need to do something akin to how new Entities/recipes/technologies are added to the game via data:extend ? Or is this the only code needed? Does the Migrations folder just go right in the root of the mod or does it need to be in another folder?

EDIT: All of my initial assumptions were correct, you don't need more code than that and it just goes into the root of the folder, but you just gotta ask these things with a script language that you're new to just to be safe or it could cause hours of frustration.

User avatar
bobingabout
Smart Inserter
Smart Inserter
Posts: 6661
Joined: Fri May 09, 2014 1:01 pm
Contact:

Re: Update Entities/Items?

Post by bobingabout » Wed Dec 20, 2017 9:19 am

It is as simple as the example code you posted.

when a game is loaded, if wall exists, it will be replaced with stone-wall. in your case items and entities only, you could also add the recipe to that list too. It isn't needed, but if you don't, all machines with the recipe set already will lose that setting and be a blank machine waiting for you to tell it what to do. if you add the recipe to the migration, then the recipe will be change, and when you load the game, the existing machine will keep producing walls.

if a technology has it's internal name changed, you can do the same with that too.
Creator of Bob's mods. Expanding your gameplay since version 0.9.8.

Post Reply

Return to “Modding discussion”

Who is online

Users browsing this forum: No registered users