Hi,
I've been away for some time and am trying to get back into Factorio.
I'm trying to port my mod over the Factorio 2. (Not Space Age currently)
I'm getting the following crash that I'm hoping someone could help me with.
It's on the "control.lua" portion, when reading from a Library mod. Not sure what has changed in Factorio 2 to cause this.
I've attached the Crash message, the Control file by itself, the full mod and library.
Thanks,
Help Porting Mod to 2.0
Help Porting Mod to 2.0
- Attachments
-
- stdlib2_2.0.1.zip
- (223.41 KiB) Downloaded 21 times
-
- control.lua
- (42.12 KiB) Downloaded 18 times
-
- Bio_Industries_1.2.00.zip
- (12.57 MiB) Downloaded 19 times
-
- Crash.png (80.84 KiB) Viewed 436 times
Re: Help Porting Mod to 2.0
Not familiar with metatables myself, but there is no global anymore. It was renamed storage in 2.0, so you'll need to change any references to the new name.
Re: Help Porting Mod to 2.0
Thanks Silari,
Okay got past that, now got something new.
It's been a long time since I've coded and will need some help. Not sure what's causing this issue.
Okay got past that, now got something new.
It's been a long time since I've coded and will need some help. Not sure what's causing this issue.
- Attachments
-
- Crash2.png (65.12 KiB) Viewed 399 times
-
- Bio_Industries_1.2.00.zip
- (12.57 MiB) Downloaded 28 times
Re: Help Porting Mod to 2.0
You're going to need to go over all the breaking changes mentioned in viewtopic.php?t=70603 and look through the API pages https://lua-api.factorio.com/latest/index-runtime.html as you find issues. Prototypes have their own global object now, they're not under game anymore.
Re: Help Porting Mod to 2.0
Thanks Silari, this put me on the right track!
Re: Help Porting Mod to 2.0
Okay, I got the mod loaded.
Now, for some reason, most, if not all the items the mod adds to the game show up from the start of the game. Even though the research has not been done and the "recipe" is enabled = false till researched.
I can craft them from the start, but no items appear once crafted.
What should I update now?
Thanks.
Now, for some reason, most, if not all the items the mod adds to the game show up from the start of the game. Even though the research has not been done and the "recipe" is enabled = false till researched.
I can craft them from the start, but no items appear once crafted.
What should I update now?
Code: Select all
--- Bio Farm (ENTITY)
{
type = "recipe",
name = "bi-bio-farm",
localised_name = {"entity-name.bi-bio-farm"},
localised_description = {"entity-description.bi-bio-farm"},
icon = ICONPATH .. "Bio_Farm_Icon.png",
icon_size = 64,
icons = {
{
icon = ICONPATH .. "Bio_Farm_Icon.png",
icon_size = 64,
}
},
normal = {
enabled = false,
energy_required = 5,
ingredients = {
{"bi-bio-greenhouse", 4},
{"stone-crushed", 10},
{"copper-cable", 10},
},
results = {{type = "item", name = "bi-bio-farm", amount = 1}},
main_product = "",
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Added for 0.18.34/1.1.4
allow_decomposition = true, -- Added for 0.18.34/1.1.4
},
expensive = {
enabled = false,
energy_required = 7.5,
ingredients = {
{"bi-bio-greenhouse", 8},
{"stone-crushed", 20},
{"copper-cable", 20},
},
results = {{type = "item", name = "bi-bio-farm", amount = 1}},
main_product = "",
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Added for 0.18.34/1.1.4
allow_decomposition = true, -- Added for 0.18.34/1.1.4
},
subgroup = "bio-bio-farm-fluid-entity",
order = "b[bi]",
allow_as_intermediate = false, -- Added for 0.18.34/1.1.4
always_show_made_in = false, -- Changed for 0.18.34/1.1.4
allow_decomposition = true, -- Changed for 0.18.34/1.1.4
},
- Attachments
-
- Tech.jpg (307.54 KiB) Viewed 307 times
-
- Stuff.jpg (101.88 KiB) Viewed 307 times
-
- Bio_Industries_1.2.00.zip
- (12.53 MiB) Downloaded 21 times
Re: Help Porting Mod to 2.0
There is no normal and expensive modes anymore, so the game is ignoring everything in those sections. Instead those properties are just in the root of the recipe.
Its one of the changes mentioned in the thread.
Its one of the changes mentioned in the thread.
Removed normal and expensive properties from TechnologyPrototype and RecipePrototype.