How do I find the "what" in data.raw.what?
Posted: Fri Sep 16, 2022 10:11 pm
So in the only Factorio modding tutorial that seems to exist, they make a new armor like this:
This only seems to work with armor though. At first I tried changing it to this:
...but that gave me some error which led to a bunch of search results that were from other people attempting to follow this tutorial. It seems like the links point somewhere else today, but yesterday one of them went to a page where you could find "heavy-armor" in a group named "armor," and you could also find "small-lamp" in a group named "lamp," and other things people were trying on the internet and resulting in the same error. IDK why but today none of the links seem to point to the same page I was looking at yesterday so I can't link it.
Eventually I figured out I can do this:
local flip_dot = table.deepcopy(data.raw.lamp["small-lamp"])
Why I have to do this for the small-lamp, but the previous code works for the armor, I have no idea. ...but it worked, so I went with it.
Today I want to do similarly with the power switch, but I don't know which data.raw.what to copy it from. I tried data.raw.power-switch["power-switch"] and data.raw.switch["power-switch"] and everything else I could think of but no luck guessing it.
Is there some place I can look up stuff like this? Unfortunately that tutorial only goes as far explaining how to copy the character as well. It doesn't say what to copy anything else from and it doesn't say how to find out.
Also, are there any better tutorials? I'm so frustrated with having to guess how to do things that I'm about to give up and delete all the files.
Also, if anyone has any clever ideas how to implement a flip dot, I wouldn't mind hearing them. I made one out of the lamp, but the lamp can't be animated, so now I'm trying to make one out of the power switch, but I don't know that the power switch can be made smaller, and I don't know that I can actually remove that glowing animation it has when it's turned on, as with my attempt at just copying the whole entity definition from the game files, the game refused to get past the point where I didn't want to specify a sparkly animation.
I made some nice graphics for it, which took a while because there also seems to be no documentation of how graphics should be rendered for the game, so I had to guess all the parameters and keep changing them until the thing lined up on the screen correctly.
Having to guess at things is so frustrating.
Code: Select all
local fireArmor = table.deepcopy(data.raw["armor"]["heavy-armor"])
Code: Select all
local flip_dot = table.deepcopy(data.raw["lamp"]["small-lamp"])
Eventually I figured out I can do this:
local flip_dot = table.deepcopy(data.raw.lamp["small-lamp"])
Why I have to do this for the small-lamp, but the previous code works for the armor, I have no idea. ...but it worked, so I went with it.
Today I want to do similarly with the power switch, but I don't know which data.raw.what to copy it from. I tried data.raw.power-switch["power-switch"] and data.raw.switch["power-switch"] and everything else I could think of but no luck guessing it.
Is there some place I can look up stuff like this? Unfortunately that tutorial only goes as far explaining how to copy the character as well. It doesn't say what to copy anything else from and it doesn't say how to find out.
Also, are there any better tutorials? I'm so frustrated with having to guess how to do things that I'm about to give up and delete all the files.
Also, if anyone has any clever ideas how to implement a flip dot, I wouldn't mind hearing them. I made one out of the lamp, but the lamp can't be animated, so now I'm trying to make one out of the power switch, but I don't know that the power switch can be made smaller, and I don't know that I can actually remove that glowing animation it has when it's turned on, as with my attempt at just copying the whole entity definition from the game files, the game refused to get past the point where I didn't want to specify a sparkly animation.
I made some nice graphics for it, which took a while because there also seems to be no documentation of how graphics should be rendered for the game, so I had to guess all the parameters and keep changing them until the thing lined up on the screen correctly.
Having to guess at things is so frustrating.