Page 1 of 1

[0.12.29][Oxyd] Crash on load while modding

Posted: Sat Apr 02, 2016 5:00 pm
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

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

Posted: Sat Apr 02, 2016 7:19 pm
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

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

Posted: Sun Apr 03, 2016 8:32 am
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...