Self_Made_Update

Place to get help with not working mods / modding interface.
Post Reply
Benied
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Feb 20, 2020 9:04 pm
Contact:

Self_Made_Update

Post by Benied »

Hey there,
I would not consider myself a developer in tthis regards.
But I had my most played factorio based on a mod, that, to this time, does not recieve updates to 0.18.
Because I didnt want to wait any longer, I decided to "update" it myself a bit. I also made it useable in 0.18.
But: Eventhough the mod does work, and I can craft every item, when I load up the world all objects "caused" by this mod will disappear.
Afterwards I can, like I said, still place them normally and they function as wanted.
So my question in general is, wether someone knows a "simple" reason to this, and how to fix it.

Looking forward in hearing from here.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1645
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Self_Made_Update

Post by Pi-C »

Benied wrote:
Thu Feb 20, 2020 9:09 pm
Because I didnt want to wait any longer, I decided to "update" it myself a bit. I also made it useable in 0.18.
But: Eventhough the mod does work, and I can craft every item, when I load up the world all objects "caused" by this mod will disappear.
Afterwards I can, like I said, still place them normally and they function as wanted.
It seems like you changed some names, so the existing objects are no longer recognized by the game. Just "introduce" these objects to the game again by migrating their old names to the new ones. Here's a guide explaining how it works.
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Benied
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Feb 20, 2020 9:04 pm
Contact:

Re: Self_Made_Update

Post by Benied »

Hello,

Thanks for your responce.
Something I forgot to mention is, that the items in my inventory remained in place.

And I didnt changed the migrations "tab" - the game had a problem with a missing "png", but I simply made a new one and gave the mod the new directory. Could this cause any problem? Because I dont think so.

Since I have not much experience in this area:
Do I have to remake the complete migrations tab, or is copying the old ones "normally" enough?

Pi-C
Smart Inserter
Smart Inserter
Posts: 1645
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Self_Made_Update

Post by Pi-C »

Benied wrote:
Fri Feb 21, 2020 10:22 am
Hello,

Thanks for your responce.
Something I forgot to mention is, that the items in my inventory remained in place.
That's expected (see below).
And I didnt changed the migrations "tab" - the game had a problem with a missing "png", but I simply made a new one and gave the mod the new directory. Could this cause any problem? Because I dont think so.
Probably shouldn't.
Since I have not much experience in this area:
Do I have to remake the complete migrations tab, or is copying the old ones "normally" enough?
The migration script should be adapted to what actually changed.

Here's an example from Bio Industries: I've changed a lot of recipe, item, and entity names there. On starting Factorio, data.lua, data-updates.lua, and date-final-fixes.lua will run and all prototypes will be loaded with the new names. Thus, everything is there in the menus. But an assembling machine that already existed and had a recipe where I changed the name wouldn't know that recipe, so that recipe would be removed and you'd have to set a new one. As a player, you don't see the internal name of the recipe, so with the same icon and ingredients, and taking the same place in the menu, it would appear that it's the same recipe as the old one -- but it isn't because it has a new name internally. Same thing happens with entities you placed on the ground: The game doesn't know the old name of the entity anymore, so it deletes all of these entities if you load an old game.

In BI, I changed (among many others) the names for Bio-reactor related things. So I made this migration script (as file /migrations/Bio_Industries_0.17.19.json"):

Code: Select all

{
  "entity":
  [
    ["bi-bioreactor", "bi-bio-reactor"],
  ],

  "item":
  [
    ["bi-bioreactor", "bi-bio-reactor"],
 ],

  "recipe":
  [
    ["bi_recipe_bioreactor", "bi-bio-reactor"],
  ],

}
On loading an old saved game, Factorio would look through it and replace the name of every entity "bi-bioreactor" with "bi-bio-reactor". Before, in the data stage, it has already loaded the definition of entity "bi-bio-reactor", so during migration the game knows the entity's new name and can silently replace the old entity with the new one.

Perhaps you could show us what you changed, and for which mod (just for reference, so the code from your new version can be compared with the original)? It's always easier to help if one can see the code and doesn't have to poke around in the dark. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Pi-C
Smart Inserter
Smart Inserter
Posts: 1645
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Self_Made_Update

Post by Pi-C »

Just to make sure -- on loading your old game, do you see something like this?
removed-content.png
removed-content.png (1.84 MiB) Viewed 1384 times
If you do, it definitely is a migration issue …
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Benied
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Feb 20, 2020 9:04 pm
Contact:

Re: Self_Made_Update

Post by Benied »

For starters,

yes I do see this screen - but only related to another mod I don't use anymore (that also did not recieve updates).
The mod I changed was this mod: (Additional Turrets - https://mods.factorio.com/mod/Additional-Turret-updated )

I have changed the following files:
info.lua (to match with the 0.18 criteria) {version ; factorio_version ; dependencies}

ammo-item.lua (because a png was not found) {(in my editor) line 414 tthe "__core__/graphics/shoot.png" did not exist. I made a blank png that i referred to in that spot}

And I don't think that I changed much else. If I do remember changing something I will add it accordingly

But I do think, that I have spotted the problem.
A mod, Endgame Combat, that I used allowed me to research turret range boosts. And I didnt thought, that it could interfer with the entities themself, just their attributes. And therefore I just assumed that the migrated content did not contain anything from "my mod".
But as it turns out, the mod made "copies" and entity names according to the state of range boost.

Pi-C
Smart Inserter
Smart Inserter
Posts: 1645
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Self_Made_Update

Post by Pi-C »

Benied wrote:
Fri Feb 21, 2020 12:17 pm
For starters,

yes I do see this screen - but only related to another mod I don't use anymore (that also did not recieve updates).
The mod I changed was this mod: (Additional Turrets - https://mods.factorio.com/mod/Additional-Turret-updated )

I have changed the following files:
info.lua (to match with the 0.18 criteria) {version ; factorio_version ; dependencies}

ammo-item.lua (because a png was not found) {(in my editor) line 414 tthe "__core__/graphics/shoot.png" did not exist. I made a blank png that i referred to in that spot}
This leaves the entity name in place, so it isn't the problem.
But I do think, that I have spotted the problem.
A mod, Endgame Combat, that I used allowed me to research turret range boosts. And I didnt thought, that it could interfer with the entities themself, just their attributes. And therefore I just assumed that the migrated content did not contain anything from "my mod".
But as it turns out, the mod made "copies" and entity names according to the state of range boost.
If you want to have the last word, add a dependency on Endgame Combat in info.json (this ensures it will be loaded before your mod) and act in data-final-fixes.lua. Of course, that may lead to problems with Endgame Combat later on if your entities are not as it expects them …
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Benied
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Feb 20, 2020 9:04 pm
Contact:

Re: Self_Made_Update

Post by Benied »

Well I am currently trying on making endgame combat working in 0.18, but it has some issues, I don't quite get.
Factorio tells me, it tries to index a "nil-value" at the argument:
table.insert(
data.raw["recipe"]
["lightning-turret"].ingredients,
{"steel-plate", 6})

in particular it acts out at the "steel-plate" argument

Pi-C
Smart Inserter
Smart Inserter
Posts: 1645
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Self_Made_Update

Post by Pi-C »

Benied wrote:
Fri Feb 21, 2020 12:51 pm
Well I am currently trying on making endgame combat working in 0.18, but it has some issues, I don't quite get.
Factorio tells me, it tries to index a "nil-value" at the argument:
table.insert(
data.raw["recipe"]
["lightning-turret"].ingredients,
{"steel-plate", 6})

in particular it acts out at the "steel-plate" argument
The game tries to modify the ingredients of the non-existing recipe "lightning-turret" and will error out. You can work around this with a check:

Code: Select all

	local recipe = data.raw["recipe"]["lightning-turret"]
	if recipe then 
		table.insert(recipe.ingredients, {"steel-plate", 6})
	end
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Benied
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Feb 20, 2020 9:04 pm
Contact:

Re: Self_Made_Update

Post by Benied »

Thank you very much.
Although I decided to make a different approach. I changed the file_turret_name (?) of my modded turrets to match the ones created from the other mod. Since I don't rely on endgame combat, just on the additional turrets, that easily doable.
And so far it all works =), I just have to readjust my base to match the decreased range of my turrets
But still thanks for all you've done for me :)

Benied
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Feb 20, 2020 9:04 pm
Contact:

Re: Self_Made_Update

Post by Benied »

And well.
The only "problem" I currently have, when I hover over the turret, the game does not recognize its original name.
It just says "Unknown key: 'entity-name.at-advanced-laser-rangeboost-2' "

Pi-C
Smart Inserter
Smart Inserter
Posts: 1645
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Self_Made_Update

Post by Pi-C »

Benied wrote:
Fri Feb 21, 2020 1:13 pm
And well.
The only "problem" I currently have, when I hover over the turret, the game does not recognize its original name.
It just says "Unknown key: 'entity-name.at-advanced-laser-rangeboost-2' "
Then you should read this tutorial. :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Benied
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu Feb 20, 2020 9:04 pm
Contact:

Re: Self_Made_Update

Post by Benied »

Well thank you for everything :)
Everything works now! ^^

have a nice day

Pi-C
Smart Inserter
Smart Inserter
Posts: 1645
Joined: Sun Oct 14, 2018 8:13 am
Contact:

Re: Self_Made_Update

Post by Pi-C »

Glad I could help, have fun with your new mod! :-)
A good mod deserves a good changelog. Here's a tutorial (WIP) about Factorio's way too strict changelog syntax!

Post Reply

Return to “Modding help”