LuaEntity.clone{direction=...}

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
sparr
Smart Inserter
Smart Inserter
Posts: 1329
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

LuaEntity.clone{direction=...}

Post by sparr »

I have a mod that "clones" entities using LuaSurface.create_entity because it predates LuaEntity.clone. It was actually one of the two mods that inspired me to request clone way back when. Now I want to switch to using clone but I am stymied because some entities (like rails) can't have their direction changed after they are spawned. With create_entity I can specify the direction as part of the creation call, but with clone I can't. I need a direction parameter to clone to be able to use it for this use case.

Existing code:

Code: Select all

                  --TODO type-specific attributes
                  local new_entity = surface.create_entity{
                    name = entity.name,
                    position = pos,
                    direction = dir,
                    force = entity.force,
                    inner_name = entity.name == "entity-ghost" and entity.ghost_name or nil,
                    raise_built = true,
                  }
Desired code:

Code: Select all

local new_entity = entity.clone{position = pos, direction = dir}

sparr
Smart Inserter
Smart Inserter
Posts: 1329
Joined: Fri Feb 14, 2014 5:52 pm
Contact:

Re: LuaEntity.clone{direction=...}

Post by sparr »

I'm working on this mod again and still hoping for this functionality.

Post Reply

Return to “Modding interface requests”