Page 1 of 1

optimized-decorative entities can't be created

Posted: Tue May 02, 2017 7:24 am
by sparr
I've encountered this problem in two mods now. They used "decorative" in 0.13 and I'm trying to use "optimized-decorative" now. Here's one sample entity prototype:

Code: Select all

    {
        type = "optimized-decorative",
        name = "belt-overflow-indicator-tall",
        flags = {"placeable-neutral", "not-on-map"},
        icon = "__belt-overflow__/graphics/indicator-tall.png",
        collision_mask = { "ghost-layer"},
        subgroup = "grass",
        order = "b[decorative]-b[belt-overflow-indicator-tall]",
        collision_box = {{-0.4, -0.9}, {0.4, 0.9}},
        selection_box = {{-0.5, -1}, {0.5, 1}},
        selectable_in_game = false,
        render_layer = "wires",
        pictures = {
            {
                filename = "__belt-overflow__/graphics/indicator-tall.png",
                width = 32,
                height = 64
            }
        }
    },
When I try to create an entity from this prototype get an error that there is no prototype by that name. This is while I'm working on the Belt Overflow mod. I also had the same problem with the Wreckage Pollution mod. I switched to simple-entity, and that worked, but I'd like to know what's wrong here.

Re: optimized-decorative entities can't be created

Posted: Tue May 02, 2017 7:41 am
by posila
Hi, optimized decoratives are not entities. They have their own set of functions. I.e. http://lua-api.factorio.com/0.15.5/LuaS ... ecoratives

Re: optimized-decorative entities can't be created

Posted: Tue May 02, 2017 8:15 am
by sparr
I seriously misinterpreted the changelog entry about decorative/optimized-decorative.

Is there a reason I should choose to create decoratives this way rather than simple-entity that doesn't collide with anything?

Re: optimized-decorative entities can't be created

Posted: Tue May 02, 2017 8:46 am
by posila
I depends what you want to do.
Simple entity is fine for things that that are on map in thousands (so I think belt-overflow-indicator-tall is ok to be simple-entity)
Optimized decoratives should be used for things that are on map in hundreds of thousands or millions.