[0.12.29][Oxyd] Crash on load while modding

This subforum contains all the issues which we already resolved.
DevilXD
Fast Inserter
Fast Inserter
Posts: 213
Joined: Tue Aug 12, 2014 10:47 am
Contact:

[0.12.29][Oxyd] Crash on load while modding

Post by DevilXD »

So, I was modding. I just rewritten some of my mod's code. I tried to launch Factorio to see if I didn't miss anything and then Factorio crashed on about 25% through loading.

Mod: https://www.dropbox.com/s/afeh61bmattht ... 4.zip?dl=1
Attachments
factorio-current.log
(3.54 KiB) Downloaded 117 times
Oxyd
Former Staff
Former Staff
Posts: 1428
Joined: Thu May 07, 2015 8:42 am
Contact:

Re: [0.12.29][Oxyd] Crash on load while modding

Post by Oxyd »

Well, I made it so that in 0.12.30, Factorio will exit with an error instead of crashing.

The problem is in your furnace_module_slots definition:

Code: Select all

        furnace_module_slots = function()
            if tier <= 2 then
                return 2
            else
                return 3
            end
        end,
You defined furnace_module_slots to be a function, but it needs to be an integer.

You could possibly define another helper function, and have

Code: Select all

function furnace_module_slots_for_tier(tier)
    if tier <= 2 then
        return 2
    else
        return 3
    end
end

function get_modifiers_for_tier(tier)
    return
    {
        …,
        furnace_module_slots = furnace_module_slots_for_tier(tier)
    }
end
DevilXD
Fast Inserter
Fast Inserter
Posts: 213
Joined: Tue Aug 12, 2014 10:47 am
Contact:

Re: [0.12.29][Oxyd] Crash on load while modding

Post by DevilXD »

Oxyd wrote:You defined furnace_module_slots to be a function, but it needs to be an integer.
Ohh, so it returns a function itself, and not the value that the function returns...

So, instead of defining the furnace_module slots like this:

Code: Select all

module_specification =
{
    module_slots = mods.furnace_module_slots,
},
... I could simply do this:

Code: Select all

module_specification =
{
    module_slots = mods.furnace_module_slots(),
},
... Right ?

EDIT: Well, it seems to work...
Post Reply

Return to “Resolved Problems and Bugs”