can't modify module effects

Place to get help with not working mods / modding interface.
_Ax_
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Jul 23, 2019 1:26 pm
Contact:

can't modify module effects

Post by _Ax_ »

Hi, I'm trying to make a mod just for learn but I'm stuck trying to modify the effect values, here's the code:

Code: Select all

-- copying the default modules
local op_speed_module = table.deepcopy(data.raw.module["speed-module"])
local op_production_module = table.deepcopy(data.raw.module["production-module"])
local op_effectivity_module = table.deepcopy(data.raw.module["effectivity-module"])

op_speed_module.name = "op-speed-module"
op_speed_module.type = "prototype.module"
op_speed_module.stacksize = 100
op_speed_module.icons = {
    {
        icon = op_speed_module.icon,
        tint = {r=0,g=0,b=0,a=0.3}
    },
}

-- the category for the module (spped, productivity or effectivity)
op_speed_module.category = "speed"

-- the effects for the module
op_speed_module.effect = {
    {
        speed = 100,
        productivity = 0,
        pollution = 50
        consumption = -50,
    }
}


local op_speed_module_recipe = table.deepcopy(data.raw.module["speed-module"])
op_speed_module_recipe.name = "op-speed-module-1"
op_speed_module_recipe.ingredients = {
    {"speed-module", 1},
    {"advanced-circuit", 20},
    {"processing-unit", 10},
    {"steel-plate", 150},
}
op_speed_module_recipe.result = "op-speed-module"

data:extend(op_speed_module, op_speed_module_recipe)
How do I modify that values?
Factorio gives me an error saying that it's missing a '}'
User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3730
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: can't modify module effects

Post by DaveMcW »

1. Missing comma after pollution = 50.
2. "prototype.module" is not a valid type. If you are using table.deepcopy() you should not change the type anyway.
3. data:extend must be given a table {}.
_Ax_
Burner Inserter
Burner Inserter
Posts: 13
Joined: Tue Jul 23, 2019 1:26 pm
Contact:

Re: can't modify module effects

Post by _Ax_ »

DaveMcW wrote: Mon Sep 02, 2019 12:14 pm 1. Missing comma after pollution = 50.
2. "prototype.module" is not a valid type. If you are using table.deepcopy() you should not change the type anyway.
3. data:extend must be given a table {}.
what I have to write instead of prototype.module?
you mean that I have to write

Code: Select all

data:extend{item, recipe}
?
kingarthur
Smart Inserter
Smart Inserter
Posts: 1463
Joined: Sun Jun 15, 2014 11:39 am
Contact:

Re: can't modify module effects

Post by kingarthur »

type is just a string. for modules

Code: Select all

 type = "module"
.
Post Reply

Return to “Modding help”