Page 1 of 1

can't modify module effects

Posted: Mon Sep 02, 2019 11:51 am
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 '}'

Re: can't modify module effects

Posted: Mon Sep 02, 2019 12:14 pm
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 {}.

Re: can't modify module effects

Posted: Mon Sep 02, 2019 1:16 pm
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}
?

Re: can't modify module effects

Posted: Tue Sep 03, 2019 9:31 am
by kingarthur
type is just a string. for modules

Code: Select all

 type = "module"
.